TL;DR
Running a 9-billion-parameter language model locally usually requires a beefy GPU, leaving standard laptops and edge devices out in the cold. Ternix changes the equation by squashing model weights down to just three values $\{-1, 0, +1\}$ paired with a clever "shared scaling" trick, shrinking a massive 19.31 GB model into a brisk 2.53 GB file. Paired with a custom lookup-table runtime, it streams text at over 32 tokens per second on an ordinary laptop CPU—faster than human reading speed, with no GPU required.
What Problem Does This Paper Address?
If we want private, offline AI assistants on everyday hardware, we have to meet devices where they are—and the universal denominator is the humble CPU. Unfortunately, standard Large Language Models (LLMs) are memory-heavy giants.
One promising diet is ternary quantization, where standard 16-bit floating-point weights are stripped down to just three discrete values ("trits"): $-1, 0,$ and $+1$. While this slashes file sizes, throwing away weight magnitudes acts like a lobotomy on the model’s intelligence. You can patch this by adding extra floating-point scaling factors to restore nuance, or you can optimize raw speed for CPUs—doing both simultaneously without bloating memory or bottlenecking standard x86 and ARM processors is a notoriously tricky balancing act.
Methods
Ternix approaches this through tight hardware-software co-design, matching how the model learns with how a CPU executes instructions.
- Shared Scaling (The Architecture): Instead of relying solely on standard group scaling (one overall volume knob per block of 64 weights), the authors introduce source scaling. Think of source scales as relative input equalizers applied before the ternary connections, shared across all output rows of a matrix. Remarkably, Ternix applies this ternary + shared-scale recipe across all 427 text tensors—including embeddings, normalization, and the output head.
- Online Teacher Distillation (The Training): Rather than crudely rounding a finished model, Ternix-9B learns from a frozen 16-bit teacher (
Qwen3.5-9B). As both read the same text, the student jointly optimizes its ternary connections and shared scales from scratch to mimic the teacher's token probabilities. - Sub-2-Bit Packing & CPU Execution (
Ternix.cpp): Because $3^3 = 27$ (which neatly fits inside $2^5 = 32$), every three ternary weights are losslessly packed into 5 bits, averaging 1.67 bits per weight. At runtime, instead of multiplying weights one by one, the CPU precomputes the 27 possible addition/subtraction combinations of input triplets into a Lookup Table (LUT). Matrix multiplication turns into ultra-fast SIMD byte lookups (AVX2on x86,NEONon ARM), orchestrated by a dependency-aware thread scheduler that starts downstream work the moment upstream chunks are ready.
Datasets
No new benchmarks were introduced.
- Training: Online distillation ran over 655.36 million tokens (with no repeated blocks) across five domains: English knowledge (25%), Code (25%), Chinese knowledge (20%), Mathematics (15%), and Dialogue (15%).
- Evaluation: Tested across seven established benchmarks covering math (
GSM8K), coding (HumanEval+,MBPP+), commonsense (HellaSwag), general reasoning (MMLU,MMLU-Pro), and Chinese proficiency (MMLU-ProX ZH).
Key Insights and Ideas
- Input-side sharing punches above its weight: Adding shared source scaling costs virtually nothing in extra parameters because a single scale vector is reused across thousands of output rows. Yet in controlled ablations, it beat group-scaling alone on 6 out of 7 benchmarks. Plus, during inference, source scaling fuses right into input preprocessing!
- Multiplication is optional; memory layout is king: Ablating the lookup-table engine caused throughput to plummet by over 60–70% (dropping from 32.19 down to 8.88 tokens/s on an Intel laptop). Replacing arithmetic multiplications with precomputed register lookups is what makes sub-2-bit CPU inference fly.
- Bigger brain, smaller footprint: On the same laptop CPU, a sub-2-bit 9B model (
Ternix-9B) doesn't just beat 4-bit quantized 2B and 3B models (MiniCPM5-2B,Llama-3.2-3B) on intelligence—it actually decodes faster than them too.
Key Results
Distilled Model Quality and On-Device CPU Inference
- Compression & Accuracy: Ternix-9B shrinks the 19.31 GB BF16 teacher down to a 2.53 GB CPU weight file ($7.6\times$ smaller, with $33\times$ lower estimated arithmetic energy). It scores a 50.16% mean across the seven benchmarks—retaining 76.9% of the teacher's capability and ranking #1 among all tested models under 4 GB.
- Distillation Superiority: In head-to-head 5,000-step runs, Ternix outperformed recent distillation baselines (
TAIDandBitDistill) on every single benchmark (e.g., scoring 61.16% on GSM8K vs. BitDistill's 22.42%). - Real-World Speed:
Ternix.cpphits 32.19 tokens/s decoding (93.92 tok/s prefill) on an Intel Core Ultra 5 325 laptop, and 51.85 tokens/s (94.82 tok/s prefill) on an Apple M6. On the Intel laptop, that is $3.3\times$ faster at decoding than running the 4-bitQwen3.5-9Bteacher inllama.cpp(9.76 tok/s) while using less than a quarter of the RAM (2.85 GB vs. 11.61 GB).
Limitations and Future Work
- Training Ceiling: Ternix-9B relies purely on teacher distillation and leaves ~23% of the full-precision teacher's benchmark performance on the table. The authors suggest applying reinforcement learning—specifically Group Relative Policy Optimization (GRPO)—to push reasoning capabilities further.
- Hardware Constraints: General-purpose CPUs don't natively understand "trits," requiring clever bit-packing workarounds, nor do they skip the many
0weights. Designing dedicated edge silicon for ternary connections and shared scales could exploit zero-connection sparsity for massive leaps in speed and battery life.
Summary updated