This repository contains a highly optimized TQ1 quantized version of the official prism-ml/Ternary-Bonsai-4B-unpacked model for the ATLAS Engine ecosystem, designed for native, ultra-low-latency CPU inference without any GPU requirement.
Packed using the unified pack_to_atlas.py toolchain (v2.10.0) with BF16 weight scale correction.
Native CPU — Intel AVX2 (Haswell 2013+), no GPU needed
File Size
1.49 GB
Inference Speed
17.4 tok/s (hybrid)
Description
36 layers, 2560 hidden, 9728 intermediate — fast Bonsai
Architecture
Component
Detail
Base Model
prism-ml/Ternary-Bonsai-4B-unpacked
Architecture
qwen3
Layers
36
Hidden Size
2560
Intermediate Size
9728
Attention Heads
32 (GQA, 8 KV heads)
Head Dim
128
RoPE Theta
5000000.0
Vocabulary
151669
Context Window
8192 (YaRN-scalable up to 16384)
Verification
During pre-release evaluation (v2.10.0), this quantized derivative demonstrated correct convergence:
T=0 (argmax):"The capital of France is Paris." — correct deterministic output
T=0.7 (sampling): Coherent structured generation with sensible continuation
Note on scale mathematics: the legacy dequantization path divides by the scale factor rather than multiplying. Since this is a constant across all logits for any given output row, the relative probability distribution remains identical under softmax normalization — no effect on output quality.
Prompt Template
To prevent token degradation and alignment shifting, use the standard chat template:
1from atlas_infer import AtlasModel
23model = AtlasModel("Ternary-Bonsai-4B-ATLAS.tq1.atlas")4output = model.generate_c(5"What is the capital of France?",6 max_new_tokens=100,7 temperature=0.7,8 top_k=40,9)10print(output)
C++ CLI (standalone, no Python required)
atlas --model Ternary-Bonsai-4B-ATLAS.tq1.atlas --prompt "What is the capital of France?" --max-tokens 100
SSE Web Server
bash
1python atlas_server.py --model Ternary-Bonsai-4B-ATLAS.tq1.atlas --port 80802curl http://localhost:8080/v1/chat/completions \3 -H "Content-Type: application/json"\4 -d '{"prompt": "What is the capital of France?", "max_tokens": 100}'
What is ATLAS?
ATLAS is a CPU inference engine for BitNet b1.58 ternary-quantized models. It repacks HuggingFace safetensors into the TQ1.0 format (5 ternary trits per byte, Base-3 encoding, ~1.58 bits/weight) and runs fast inference via a C++ DLL + Python wrapper.
Feature
Description
No GPU required
Runs on any x86-64 CPU with AVX2 (Intel Haswell 2013+, AMD Excavator 2015+)
Hybrid matmul
FFN tensors in int8, QKV/O in TQ1-packed, per-tensor dispatch
int4 FFN mode
Halves FFN memory bandwidth for 18-26% speedup (7B/10B)
f32 bypass
Auto-enabled for small models (≤1B) and SubLN architectures
Ring buffer KV cache
Extended context via NTK-aware RoPE scaling
Standalone C++ CLI
No Python or PyTorch required at runtime
SSE web server
FastAPI-based /v1/chat/completions with prompt caching