Skip to main content

Triton-powered framework for training and deploying Spiking Transformers.

Project description

Tether

Gemini_Generated_Image_xofloxxofloxxofl

Tether is a Triton-powered framework for training and deploying Spiking Transformers.

We’ve solved the non-differentiability of discrete spikes by implementing a custom Arctan Surrogate Gradient in the autograd backward pass.

Key Features

  • Fused LIF Kernel: Manages membrane potential statefulness across temporal windows without global memory stalls, utilizing Triton for high-performance GPU execution.
  • Linear Spike-Driven Attention: Eliminates the $O(N^2)$ Softmax bottleneck, allowing for massive context windows with significantly lower energy per inference (Joules/op).
  • Bit-Packing (In Progress): Optimization for memory-efficient spike storage.
  • Triton-Powered: Leverages OpenAI's Triton language for custom CUDA kernels.

Installation

This project is managed with uv.

uv sync

Or install dependencies manually:

pip install torch triton numpy

Usage

Training a Spiking Language Model

The train_stories.py script demonstrates training a Spiking-LLM on the TinyShakespeare dataset.

python train_stories.py

This will:

  1. Download the input.txt dataset.
  2. Initialize a Tether Spiking Transformer (4 layers, 8 heads).
  3. Train using the custom Arctan Surrogate Gradient.
  4. Generate sample text from the Spiking SNN.

Architecture

  • tether.kernels.lif: Custom Triton kernels for Leaky Integrate-and-Fire (LIF) forward and backward passes.
  • tether.functional.lif: PyTorch autograd function wrapping the Triton kernels.
  • tether.nn.attention: Linear Spike-Driven Attention mechanism.
  • tether.nn.block: Spiking Transformer Block implementation.

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tetherpy-0.0.1.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tetherpy-0.0.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file tetherpy-0.0.1.tar.gz.

File metadata

  • Download URL: tetherpy-0.0.1.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.8

File hashes

Hashes for tetherpy-0.0.1.tar.gz
Algorithm Hash digest
SHA256 316adf11d638090465d8c0764bf95f93a19ca976864cef9fada47c81ff6f0746
MD5 0df8db15112bfe875240cf263bc43f07
BLAKE2b-256 0101263bb8772b94f83c4c6aa54dcda83f1ce68b9eaddf17a0c20d4c02e9a711

See more details on using hashes here.

File details

Details for the file tetherpy-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: tetherpy-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.8

File hashes

Hashes for tetherpy-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 249d5cf1332ea20878fe9dbc132d11c0c901297c1c2d55af2be7a141ae7a750d
MD5 7e67c80e18777c63bb26a8ccc5c905b8
BLAKE2b-256 10b34cfabbdfb1d109584c531543763978ab68dd0a19a016af3f9eb7fe879536

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page