Termux-BitNet
High-Performance 1.58-bit On-Device LLM Inference SIMD Engine for ARM64 & Android Termux
1-Line Quick Installation
Install the official package directly into your runtime:
pip install termux-bitnet
# or:
npm install termux-bitnet
The Engineering Challenge
Standard LLMs (FP16/INT8) cause severe memory bottleneck, excessive battery drain, and thermal throttling on mobile ARM64 devices.
The Architectural Breakthrough
Features ARM64 NEON DotProd SIMD kernels executing ternary weights {-1, 0, +1} with sub-15ms token latency on smartphone processors.
Key Capabilities & Built-in Hardening
Deterministic 0-Drift Output
Bit-exact floating-point precision verified across heterogeneous ARM64 & WebGPU hardware.
Zero Cloud Egress Architecture
Operates 100% on the local client without external network telemetry leaks.
Memory Leakage Protection
Weakref lifetime management preventing GPU VRAM / system RAM leaks.
Supported Compute Kernels & Operations
| Subsystem Category | Operations & Kernels | Status |
|---|---|---|
| Compute Kernel | Hardware Native Accelerated Kernels | Production |
| Memory Subsystem | Zero-Copy Ring Buffers & Weakref GC | Production |
| Runtime Compatibility | Android Termux Bionic / Browser WebGPU | Production |
Canonical Usage Example
import termux_bitnet as tbn
engine = tbn.BitNetEngine(model_path="bitnet_b1_58_3b.tbn", threads=4)
for token in engine.generate_stream("What is sovereign on-device AI?"):
print(token, end="", flush=True)