cd /news/large-language-models/ternary-weights-compression-and-effi… · home › topics › large-language-models › article
[ARTICLE · art-178274] src=hanzo.blog ↗ pub= topic=large-language-models verified=true sentiment=· neutral

Ternary Weights, Compression, and Efficient Intelligence

A technical analysis of low-bit quantization for local LLM inference reports that ternary GGUF checkpoints for a 27B-parameter dense model shrink on-disk weights to 5.95 GB (PTQ1_0) and 7.21 GB (PQ2_0), versus roughly 54.0 GB in BF16 and 21.92 GB for a mixed NVFP4+FP8 build, per HIP-0904 from hanzoai. The analysis attributes the gains to batch-1 autoregressive decode being memory-bandwidth-bound, where throughput is capped by memory bandwidth divided by active model bytes, so cutting bytes per weight speeds decode directly while prefill still requires fast tiled matrix kernels. It also flags remaining kernel and accuracy limitations for 1.58-bit ternary weights and 1-bit BitDelta compression on Apple Silicon, NVIDIA GB10 and AMD Strix Halo (gfx1151).

recommendation

For bandwidth-bound batch-1 decode, quantize weights to ternary GGUF (PTQ1_0/PQ2_0) to cut streamed bytes roughly 9-10x, but keep fast tiled kernels for prefill where unpacking can stall compute.

more in playbook: Inference and self-hosting
by read8 min views2 publishedNov 29, 2026
Ternary Weights, Compression, and Efficient Intelligence
Image: Hanzo (auto-discovered)

Why autoregressive LLM decode is memory-bandwidth-bound, how 1.58-bit ternary weights and 1-bit BitDelta compression shrink memory traffic on Apple Silicon, GB10, and Strix Halo, and the real kernel and accuracy limits we still have to solve.

On this page #

If you want to understand why frontier intelligence is escaping hyperscale datacenters onto local unified-memory workstations, ignore peak TFLOPs on GPU spec sheets and look at one number instead: memory bandwidth.

During interactive token generation (batch-1 autoregressive decode), a transformer is almost never compute-bound. It is starved waiting for weights to stream out of memory. Low-bit quantization—pushing from 16-bit floats down through 4-bit formats (NVFP4, MXFP4, Q4_K, AFQ4) toward 1.58-bit ternary weights ({-1, 0, +1}) and 1-bit behavioral deltas ( BitDelta)—directly attacks that physical bottleneck.

Here is the first-principles physics, what hanzoai/engine and zenlm actually ship on local unified-memory hardware today, and an honest accounting of the kernel and accuracy limitations that remain.

1. The roofline physics of LLM inference #

Generating a single output token at batch size 1 requires reading every active weight matrix from DRAM or HBM into registers once and performing roughly 2 floating-point operations (one multiply, one accumulate) per parameter.

  • In BF16 / FP16 (2 bytes per parameter), that yields an arithmetic intensity of roughly1 FLOP per byte .
  • Modern accelerators—Apple Silicon unified memory, NVIDIA GB10, AMD Ryzen AI Max+ 395 ("Strix Halo", gfx1151 ), and datacenter H100s—have compute-to-bandwidth ridge points of tens to hundreds of FLOPs per byte.

Because 1 FLOP/byte sits far to the left of the hardware ridge point, decode throughput is bounded directly by:

decode_tok_per_s  <=  memory_bandwidth_bytes_per_s / active_model_bytes

Prefill behaves differently: processing a 4,096-token prompt multiplies each weight across thousands of tokens in parallel, raising arithmetic intensity by orders of magnitude and flipping execution into the compute-bound regime. That split is the defining engineering tension of low-bit inference: cutting bytes per weight speeds up decode immediately, while prefill demands fast tiled matrix kernels so unpacking does not stall compute.

Look at the real artifact sizes for a single 27B-parameter dense architecture (Qwen3.8-27B family), verified directly from the file manifests in HIP-0904 (Zen6 — Dense, Coder and Ternary Checkpoints):

Representation Verified checkpoint / artifact On-disk weight size Relative to BF16 (~54 GB) Notes from HIP-0904 &hanzoai/engine
Dense BF16 baseline 27B params × 2 bytes ~54.0 GB 1.00× Exceeds 32–48 GB laptops; saturates decode bandwidth
Mixed NVFP4 + FP8 zenlm/zen6 (3 safetensors shards,HIP-0904 §2) 21.92 GB 0.41× 193 NVFP4 modules + 208 FP8 attention modules; packed 4-bit loads in ~31 GB RAM vs. ~104 GB dequant-at-load
Ternary GGUF PQ2_0 Ternary-Bonsai-2-27B-PQ2_0.gguf (HIP-0904 §4) 7.21 GB 0.13× 402 GGML type-142 tensors + Walsh–Hadamard pre-rotation ( block 1024 )
Ternary GGUF PTQ1_0 Ternary-Bonsai-2-27B-PTQ1_0.gguf (HIP-0904 §4) 5.95 GB 0.11× Sub-6 GB footprint for a 27B-class dense backbone

Dropping a 27B backbone from ~54 GB to 6–7 GB does two things at once: it fits comfortably inside consumer unified memory with room left for long-context KV caches, and it reduces the memory bytes streamed per generated token by roughly an order of magnitude.

2. How ternary weights ({-1, 0, +1}) and 1-bit deltas work #

A binary weight ({-1, +1}) carries 1 bit of information per parameter, leaving no way to zero out an inactive connection. Adding zero produces a ternary alphabet {-1, 0, +1}, carrying log2(3) ≈ 1.585 bits of entropy per weight (popularized in BitNet b1.58).

In a ternary linear layer, each weight block is scaled by a shared high-precision factor γ, and each element w_ij takes a value in {-1, 0, +1}. The inner dot product with an activation vector x changes character completely:

Standard FP16 GEMV:   y_i = sum_j ( w_ij * x_j )              // multiply-accumulate
Ternary GEMV:         y_i = gamma * sum_j ( s_ij ? x_j : 0 )  // conditional add / subtract / skip

Two properties make ternary compression compelling for systems engineering:

  1. No floating-point multipliers in the inner loop: Multiplication collapses into integer addition, subtraction, or zero-skipping—cutting both memory traffic and arithmetic energy per token when hardware or SIMD kernels natively exploit it.
  2. Packing density + outlier rotation: Five ternary trits have3^5 = 243 < 256 states, so five weights pack cleanly into a single byte (1.6 bits/weight before block-scale overhead). Because real transformer weights contain outlier channels that distort aggressive quantization, modern ternary checkpoints—likezenlm/zen6-flash (Ternary-Bonsai-2-27B-PQ2_0 ) documented inHIP-0904 §4—apply an orthogonalWalsh–Hadamard pre-rotation (prism.hadamard.* , block size1,024 ) across 401 weight matrices to spread outlier energy uniformly before quantizing.

This sits on the exact same compression continuum as BitDelta, which we already ship in hanzo-quant and documented in BitDelta: Serving 14 Zen Models from One GPU Cluster. BitDelta keeps a shared base model and compresses each fine-tuned variant's behavioral delta (Δ = W_ft - W_base) into 1-bit signs plus a per-matrix scale α (W_ft ≈ W_base + α · sign(Δ))—cutting 14 fine-tuned 70B variants from ~1.96 TB to ~262 GB. Ternary weights push extreme compression down from the fine-tuning delta into the base weights themselves.

3. What hanzoai/engine runs on unified-memory hardware today #

Unified-memory machines—Apple Silicon Macs, NVIDIA GB10 (spark), and AMD Strix Halo ( evo, Ryzen AI Max+ 395 / Radeon 8060S iGPU, gfx1151)—give local models a single large pool of GPU-accessible memory (64 GB to 512 GB) without PCIe offload penalties.

Here is what hanzoai/engine actually implements in production source today (docs/QUANTS.md, hanzo-quant/src/lib.rs, and docs/src/content/docs/guides/perf/rocm-apu-gguf.md):

  • **AMD Strix Halo (gfx1151, ROCm):**22 native-resident GGUF quant types decode directly in quantized form (no dequant-to-FP16 round trip) through a single templated compute core (qmatvec_core<WTYPE, XT> andqdp4a<WTYPE> ), verified bit-exact (nbad=0 ) against the CPU reference oracle:
    • K-quants: Q2_K ,Q3_K ,Q4_K ,Q5_K ,Q6_K (int8 dp4a )
    • Legacy quants: Q4_0 ,Q4_1 ,Q5_0 ,Q5_1 ,Q8_0 ,Q8_1
    • I-quants: IQ1_S ,IQ1_M ,IQ2_XXS ,IQ2_XS ,IQ2_S ,IQ3_XXS ,IQ3_S ,IQ4_XS ,IQ4_NL (codebookint8 dp4a /sudot4 )
    • Ternary quants: TQ1_0, TQ2_0 (scalar native-resident decode)
  • K-quants:
  • **Apple Silicon (Metal):**AFQ (2, 3, 4, 6, and 8-bit MLX-native affine quantization) alongside GGUF and In-Situ Quantization (ISQ).
  • NVIDIA CUDA / GB10: Native packedNVFP4 (register-resident E2M1 codebook for decode, tensor cores for prefill),MXFP4 , 4- and 8-bit Marlin kernels (GPTQ/AWQ), FP8, and GGUF.
  • Compounding with Sparse Mixture-of-Experts (MoE): Low-bit weights multiply directly with parameter sparsity. For example,zenlm/zen6-coder (HIP-0904 §3) is a 512-expert architecture activating 10 experts per token, packaged in Unsloth imatrixIQ4_XS across three GGUF splits totaling93.68 GB —meaning a large sparse coding model fits entirely inside a 128 GB unified-memory workstation while touching only a small active parameter slice per token.

4. Honest limitations: what ternary quantization does NOT solve yet #

Low-bit and ternary inference is a genuine systems breakthrough, not free lunch. Four real engineering constraints govern where we deploy it today—and where we do not:

  1. Kernel maturity and decode-only gaps: Inspectinghanzo-quant/src/lib.rs (line 919) and our ROCm APU docs shows the current reality plainly:TQ1_0 ,TQ2_0 ,IQ* , andQ1_0 aredecode-only formats (not ISQ load-time quantization targets). Ongfx1151 ,TQ1_0 /TQ2_0 still run through thescalar matvec path rather thanint8 dp4a orWMMA tensor cores, and decode-only formats mustdequantize to FP16 during prefill . Custom codecs likeHIP-0904 'sPQ2_0 (GGML type 142 with Walsh–Hadamard pre-rotation) require explicit and rotation-kernel support before the weights produce valid tokens at all.
  2. Prefill stalls without tiled kernels: As we showed openly inHow We Benchmark Hanzo , a missing tiled prefill kernel caused a0.141× prefill slowdown onqwen3.8-27b ROCm FP4 (49.4 tok/s vs.349.7 tok/s ) even when the model loaded cleanly. Long-context agent prompts require fast tiled prefilland fast decode.
  3. Training dynamics and post-training fragility: Native 1.58-bit training (Quantization-Aware Training) still requires full-precision shadow master weights, Straight-Through Estimators (STE), and sensitive learning-rate schedules—you do not get 1.58-bit training memory savings automatically. Post-training ternary compression (PTQ) avoids retraining cost but degrades sharply unless paired with orthogonal rotations (Hadamard) and careful calibration.
  4. Dense factual recall and reasoning tails: Compressing every weight below 2 bits preserves syntax, tool-call structure, and local code transformations far better than it preserves high-entropy parametric facts (obscure API signatures, dense multilingual trivia, long multi-step formal derivations). Furthermore, asHIP-0904 §6 states explicitly, upstream model cards for ternary checkpoints often publish unverified speedups and retention numbers without receipts. Until a ternary checkpoint passes a prospectively frozenHIP-1403 accuracy gate and a quiet-boxdossier.sh throughput run, we treat its headline claims as unverified hypotheses.

5. Where ternary fits in the real stack #

The right way to deploy ternary and sub-4-bit models is not as a fragile solo replacement for frontier reasoning. It is as the high-speed local and edge execution tier inside a hybrid system:

  • Pair with hybrid retrieval (/v1/knowledge, /v1/search) so high-entropy facts live in inspectable tenant documents rather than fighting for capacity inside 1.58-bit weights.
  • Pair with Enso's adaptive router (adaptive_route.go) so routine tool continuations and local drafts run at near-zero marginal cost on local unified memory, while genuine deadlocks, formal proofs, or hard multi-step failures escalate cleanly to deeper cloud tiers.
  • Qualify every checkpoint through HIP-1403 and dossier.sh before it earns a production route.

Compression changes the physics of who can afford intelligence. Verification ensures that cheaper intelligence stays trustworthy.

Read the rest of this series:

Read more #

Unfettered Intelligence: Local Hardware, Decentralized Compute, and the Open Personal & Business OS

When a single closed provider controls the model behind your research and software, you inherit opaque rules you cannot audit or pin. Open weights on local unified memory, decentralized compute networks, and an open Personal, Business, and Creative OS put intelligence back under user control.

What a Million Tokens Actually Costs Hanzo

Inside Hanzo's inference unit economics: 4-class token billing, per-thread adaptive tier shifting in adaptive_route.go, NVIDIA NIM + 1M OpenRouter frontier ladders, and the honest trade-offs of upstream capacity vs. local hardware.

Kai 1: Decisions, Not Completions

Kai is Hanzo's decision model, served by the Hanzo API. Give it explicit state and a listed question, and it returns a typed, calibrated answer — a choice, a score, a yes/no, or a reasoned deferral.

── more in #large-language-models 4 stories · sorted by recency
── more on @hanzoai 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/ternary-weights-comp…] indexed:0 read:8min 2026-11-29 · —