Skip to main content

1.58-bit Quantization + Test-Time Training (TTT) Implementation in Pure Rust

Project description

Bit-TTT Engine: High-Performance Brain Core

Rust License: MIT PyPI

1.58-bit Quantization + Test-Time Training (TTT) Implementation in Pure Rust.

This package provides Python bindings for the Bit-TTT Engine, allowing you to run ultra-light ternary LLMs with real-time adaptation.

✨ Features

  1. Ultra-Light: Runs large LLMs on cheap hardware using 1.58-bit (ternary) weights.
  2. Adaptive (TTT): Learns while inferring, adapting to context in real-time.
  3. Pure Rust: High performance with minimal dependencies.

🚀 Installation

pip install bit-ttt-engine

💻 Usage

import cortex_rust
import json

# Initialize Configuration
config = cortex_rust.BitLlamaConfig(
    vocab_size=32000,
    hidden_dim=512,
    num_layers=12,
    inner_lr=0.001
)

# Initialize Model (Inference)
model = cortex_rust.BitLlama(
    config=config,
    checkpoint_path="path/to/model.safetensors",
    device="cpu", # or "cuda"
    tokenizer_path="path/to/tokenizer.json"
)

# Generate Text
output = model.generate(prompt="Hello, world!", max_tokens=50)
print(output)

🏗️ Training (TTT)

trainer = cortex_rust.PyTrainer(
    config=config,
    checkpoint_path="path/to/model.safetensors",
    device="cuda"
)

# Single training step
loss = trainer.train_step(input_ids=[...], targets=[...])
print(f"Loss: {loss}")

# Save checkpoint
trainer.save_checkpoint("model_updated.safetensors")

📖 Documentation

For more details, please visit the GitHub repository.

🙏 Acknowledgments

This project incorporates ideas and techniques inspired by the DroPE method published by Sakana AI.

💖 License

MIT License

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

bit_ttt_engine-0.6.1-cp310-cp310-win_amd64.whl (2.9 MB view details)

Uploaded CPython 3.10Windows x86-64

File details

Details for the file bit_ttt_engine-0.6.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for bit_ttt_engine-0.6.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 dbeb12e8b8f33bbfe8d91247c781d59c08f8dc2138d0cb931a282f9653be21c2
MD5 b0bf8d3830bb2d9bfbffe7e2326f3238
BLAKE2b-256 8f507db07222275dce75462503332ee1e15ce721f699c3939c8f1932e98029c5

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