| Crates.io | tritter-accel |
| lib.rs | tritter-accel |
| version | 0.1.1 |
| created_at | 2026-01-25 03:03:14.782368+00 |
| updated_at | 2026-01-25 03:03:14.782368+00 |
| description | Rust acceleration for Tritter - BitNet, ternary ops, VSA optimization |
| homepage | |
| repository | https://github.com/tzervas/rust-ai |
| max_upload_size | |
| id | 2067987 |
| size | 68,915 |
Rust acceleration library for Tritter - providing Python bindings for high-performance BitNet, ternary, and VSA operations.
tritter-accel provides Python bindings via PyO3 for the following capabilities:
This crate is designed to be used as a Python extension module, built with maturin.
cd rust-ai/tritter-accel
pip install maturin
maturin develop --release
maturin build --release
pip install target/wheels/tritter_accel-*.whl
from tritter_accel import (
pack_ternary_weights,
unpack_ternary_weights,
ternary_matmul,
quantize_weights_absmean,
compress_gradients_vsa,
decompress_gradients_vsa,
)
# Quantize float weights to ternary {-1, 0, +1}
ternary_weights, scales = quantize_weights_absmean(float_weights)
# Pack for efficient storage (2 bits per trit)
packed, scales = pack_ternary_weights(ternary_weights, scales)
# Efficient matmul with packed weights
output = ternary_matmul(input, packed, scales, original_shape)
# VSA gradient compression for distributed training
compressed = compress_gradients_vsa(gradients, compression_ratio=0.1)
recovered = decompress_gradients_vsa(compressed, original_shape)
| Function | Description |
|---|---|
quantize_weights_absmean(weights) |
Quantize float weights to ternary using AbsMean scaling |
pack_ternary_weights(weights, scales) |
Pack ternary weights into 2-bit representation |
unpack_ternary_weights(packed, scales, shape) |
Unpack ternary weights to float |
| Function | Description |
|---|---|
ternary_matmul(input, packed, scales, shape) |
Matrix multiply with packed ternary weights |
ternary_matmul_simple(input, weights) |
Simple matmul with float ternary weights |
| Function | Description |
|---|---|
compress_gradients_vsa(gradients, ratio, seed) |
Compress gradients using VSA |
decompress_gradients_vsa(compressed, shape, seed) |
Decompress gradients from VSA |
This crate uses the following sister crates:
bitnet-quantize - BitNet b1.58 quantizationtrit-vsa - Balanced ternary VSA operationsvsa-optim-rs - Gradient optimization┌─────────────────────────────────────────────────────────┐
│ Python Interface │
│ (tritter_accel module) │
├─────────────────────────────────────────────────────────┤
│ Exposed Functions │
│ - pack_ternary_weights │
│ - unpack_ternary_weights │
│ - ternary_matmul │
│ - quantize_weights_absmean │
│ - compress_gradients_vsa │
│ - decompress_gradients_vsa │
├─────────────────────────────────────────────────────────┤
│ Rust Implementation │
│ Core Crates: bitnet-quantize, trit-vsa, vsa-optim-rs │
│ - AbsMean quant | PackedTritVec + VSA ops │
│ - INT8 activs | Compression + Prediction │
└─────────────────────────────────────────────────────────┘
MIT License - see LICENSE-MIT
| Crate | Description | crates.io |
|---|---|---|
| trit-vsa | Balanced ternary arithmetic | |
| bitnet-quantize | BitNet b1.58 quantization | |
| vsa-optim-rs | VSA gradient optimization | |
| peft-rs | PEFT adapters | |
| qlora-rs | QLoRA implementation | |
| axolotl-rs | LLM fine-tuning toolkit |