Tether
Tether is a Triton-powered framework for training and deploying Spiking Transformers and deep Spiking Neural Networks (SNNs).
We’ve solved the non-differentiability of discrete spikes by implementing high-performance Triton kernels with modular Surrogate Gradients.
Key Features
- High-Performance Neurons:
- LIF (Leaky Integrate-and-Fire): Standard spiking neuron with fused Triton kernels.
- ALIF (Adaptive LIF): Neurons with adaptive thresholds for better temporal dynamics.
- PLIF (Parametric LIF): Neurons with learnable, per-channel decay and threshold parameters.
- Modular Surrogate Gradients: Choose from
Arctan,Sigmoid, orFastSigmoidto train your SNNs effectively. - Linear Spike-Driven Attention: Eliminates the $O(N^2)$ Softmax bottleneck, allowing for massive context windows with significantly lower energy per inference.
- Data Utilities:
SpikingDatasetWrapperand encoding functions (rate_encoding,latency_encoding) to convert static datasets to spike trains. - Triton-Powered: Leverages OpenAI's Triton language for custom CUDA kernels, enabling massive speedups (60x+) over vanilla PyTorch.
Installation
This project is managed with uv.
uv sync
Or install dependencies manually:
pip install torch triton numpy
Usage
Using PLIF with Sigmoid Surrogate
import torch
from tether import PLIF, Sigmoid
# Create a Parametric LIF layer with Sigmoid surrogate
# Decay and threshold are learnable vectors per neuron
layer = PLIF(
n_neurons=128,
init_decay=0.9,
surrogate=Sigmoid(alpha=4.0)
).cuda()
# Input sequence: (Time, Batch, Neurons)
x = torch.randn(32, 16, 128).cuda()
spikes = layer(x)
Training a Spiking Language Model
The train_stories.py script demonstrates training a Spiking-LLM on the TinyShakespeare dataset.
python train_stories.py
Data Encoding
from tether.data import SpikingDatasetWrapper, rate_encoding
from torchvision.datasets import MNIST
# Wrap MNIST to output spike trains
spiking_mnist = SpikingDatasetWrapper(
MNIST(root="./data", download=True, train=True),
encode_fn=lambda x: rate_encoding(x, n_steps=10)
)
Architecture
tether.kernels: Custom Triton kernels for LIF, ALIF, and PLIF.tether.functional: PyTorch autograd functions wrapping the Triton kernels.tether.nn: Neural network modules includingLIF,ALIF,PLIF,SpikingSelfAttention.tether.data: Utilities for spike encoding and dataset wrapping.
License
Metadata
Release files for tetherpy 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tetherpy-0.2.0.tar.gz | 37.6 kB | With provenance | Details for tetherpy-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tetherpy-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for tetherpy-0.2.0-py3-none-any.whl |
Total release size: 68.7 kB
Release files / tetherpy-0.2.0.tar.gz
| Download URL | tetherpy-0.2.0.tar.gz |
|---|---|
| Size | 37.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
af1e1b797b5100a19b4610bd75f1929bc1afa62be1eb12329e22615643acf8f1
|
|
BLAKE2b-256 checksum How to use checksums |
80044e72ef6f5b746cd80381408a0fb52639f13aa0332c23487a700c78f32eea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 29, 2025.
Transparency logRelease files / tetherpy-0.2.0-py3-none-any.whl
| Download URL | tetherpy-0.2.0-py3-none-any.whl |
|---|---|
| Size | 31.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa9cec81de162abb9fc1d927675e1a8bb2816549e1367b0e29b62c9194bedb5b
|
|
BLAKE2b-256 checksum How to use checksums |
d9116d26e13336a85ca9c862c7a95429e0d334870348449b383a7239e7304504
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 29, 2025.
Transparency logSecurity for tetherpy 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for tetherpy-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 29, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.