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 Distribution

bit_ttt_engine-0.6.0.tar.gz (233.6 kB view details)

Uploaded Source

Built Distribution

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

bit_ttt_engine-0.6.0-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

File details

Details for the file bit_ttt_engine-0.6.0.tar.gz.

File metadata

  • Download URL: bit_ttt_engine-0.6.0.tar.gz
  • Upload date:
  • Size: 233.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.11.3

File hashes

Hashes for bit_ttt_engine-0.6.0.tar.gz
Algorithm Hash digest
SHA256 eb0fdd2177236b267b737b60732c3945793dc1a78099a140c933c48ea93acc86
MD5 a21ad923e2376ba4c12cb25af7a5e667
BLAKE2b-256 81cd8b3b7069168b230d7fd1e8b7983465eefc88155f2b9ae358c3063b0bd9ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bit_ttt_engine-0.6.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 96b866926b937bcbc29e97a336e0179d7231c2f25b27ef10e72418ce9fefc3fb
MD5 2d0d2654c44facbda50fdcff534f62e1
BLAKE2b-256 0629ad905e81a5b6f03f7175efe6064e1f3df379832177fc76dd06b6d56eab0a

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