The 1.58-bit Singularity. A Datacenter-grade, Zero-Copy, AVX-512 Inference Engine for 1.58-bit Ternary LLMs. Achieves 100+ Tokens/Sec on consumer CPUs. Built in 100% Safe Rust, cross-compiles to WebAssembly (SIMD128).
Rust
13
5 commits
updated Jan 25, 2026
R3-Engine is a radical reimagining of Large Language Model inference. It abandons the traditional GPU-centric, heavy-RAM paradigm in favor of direct-to-CPU execution using 1.58-bit Ternary Quantization (BitNet).
By leveraging Zero-Copy memory mapping, CPU V-Cache pinning, and AVX-512 vector math, the R3-Engine achieves Datacenter-grade inference latency (>100 Tokens/Sec) on a single consumer CPU core, with zero heap allocations in the execution loop.
It is written in 100% Safe Rust and natively cross-compiles to WebAssembly (Wasm) for in-browser, edge-device execution without an OS.
To achieve the physics-defying speeds of the R3-Engine, your hardware must support modern vector extensions.
VPOPCNTDQ instruction).mmap).1.75.0 or higher (Stable).miniserve (for hosting the Wasm interface).We have successfully built the complete High-Performance Computing (HPC) backbone:
VPOPCNTDQ).bitnet-b1.58-2B-4T from HuggingFace, applies quantization, and builds the memory map.The structural pipeline is flawless, but the AI is currently mute.
<unk> (Unknown Token, ID 0) for every generation.Most AI frameworks (llama.cpp, PyTorch) move massive F16 data buffers between the SSD, RAM, and GPU. R3-Engine does not move data.
r3-converter): Downloads the 2B model, threshold-quantizes the FP16 weights into a 1.58-bit ternary state (-1, 0, 1), and bit-packs them into 64-byte aligned CacheLines (.r3 file).mmap pins the .r3 file to the Virtual Memory space.r3-engine): Thread 0 is pinned to the V-Cache. Inputs are bitwise AND-ed with the model weights. The CPU counts the resulting bits to calculate matrix multiplication.# Install the Wasm target
rustup target add wasm32-unknown-unknown
# Install the Wasm dev server
cargo install miniserve
This command will contact HuggingFace, download the 6GB Microsoft model, quantize the weights to 1.58-bit, and generate the bitnet-2b-full.r3 cache-aligned engine file.
cargo run --release --bin r3-converter --features native-io
Execute the Zero-Copy AVX-512 chat loop directly in your terminal.
cargo run --release --bin r3-engine --features native-io
Compile the pure-math inference engine to WebAssembly, stripping out all OS dependencies.
# 1. Compile the Wasm binary
cargo build --target wasm32-unknown-unknown --release
# 2. Copy the binary to the web folder
cp target/wasm32-unknown-unknown/release/r3_engine.wasm www/
# 3. Serve the interface
miniserve .
Open http://localhost:8080/www/index.html in Chrome.
wasmCD integration (Running the engine inside Chrome via Web Workers).5 commits
Rust
82.1%
HTML
9.6%
Nix
4.7%
JavaScript
3.5%
The 1.58-bit Singularity. A Datacenter-grade, Zero-Copy, AVX-512 Inference Engine for 1.58-bit Ternary LLMs. Achieves 100+ Tokens/Sec on consumer CPUs. Built in 100% Safe Rust, cross-compiles to WebAssembly (SIMD128).
Rust
13
5 commits
updated Jan 25, 2026
R3-Engine is a radical reimagining of Large Language Model inference. It abandons the traditional GPU-centric, heavy-RAM paradigm in favor of direct-to-CPU execution using 1.58-bit Ternary Quantization (BitNet).
By leveraging Zero-Copy memory mapping, CPU V-Cache pinning, and AVX-512 vector math, the R3-Engine achieves Datacenter-grade inference latency (>100 Tokens/Sec) on a single consumer CPU core, with zero heap allocations in the execution loop.
It is written in 100% Safe Rust and natively cross-compiles to WebAssembly (Wasm) for in-browser, edge-device execution without an OS.
To achieve the physics-defying speeds of the R3-Engine, your hardware must support modern vector extensions.
VPOPCNTDQ instruction).mmap).1.75.0 or higher (Stable).miniserve (for hosting the Wasm interface).We have successfully built the complete High-Performance Computing (HPC) backbone:
VPOPCNTDQ).bitnet-b1.58-2B-4T from HuggingFace, applies quantization, and builds the memory map.The structural pipeline is flawless, but the AI is currently mute.
<unk> (Unknown Token, ID 0) for every generation.Most AI frameworks (llama.cpp, PyTorch) move massive F16 data buffers between the SSD, RAM, and GPU. R3-Engine does not move data.
r3-converter): Downloads the 2B model, threshold-quantizes the FP16 weights into a 1.58-bit ternary state (-1, 0, 1), and bit-packs them into 64-byte aligned CacheLines (.r3 file).mmap pins the .r3 file to the Virtual Memory space.r3-engine): Thread 0 is pinned to the V-Cache. Inputs are bitwise AND-ed with the model weights. The CPU counts the resulting bits to calculate matrix multiplication.# Install the Wasm target
rustup target add wasm32-unknown-unknown
# Install the Wasm dev server
cargo install miniserve
This command will contact HuggingFace, download the 6GB Microsoft model, quantize the weights to 1.58-bit, and generate the bitnet-2b-full.r3 cache-aligned engine file.
cargo run --release --bin r3-converter --features native-io
Execute the Zero-Copy AVX-512 chat loop directly in your terminal.
cargo run --release --bin r3-engine --features native-io
Compile the pure-math inference engine to WebAssembly, stripping out all OS dependencies.
# 1. Compile the Wasm binary
cargo build --target wasm32-unknown-unknown --release
# 2. Copy the binary to the web folder
cp target/wasm32-unknown-unknown/release/r3_engine.wasm www/
# 3. Serve the interface
miniserve .
Open http://localhost:8080/www/index.html in Chrome.
wasmCD integration (Running the engine inside Chrome via Web Workers).5 commits
Rust
82.1%
HTML
9.6%
Nix
4.7%
JavaScript
3.5%