Quantizing a 2.78-Trillion-Parameter Trunk to 0.66% Error in 14 Minutes
Kimi K3 is 2.78 trillion parameters — 93 layers, 896 experts per layer, 1.5 TB of weights. We wanted it decoding at 5 tokens per second on hardware we could rent by the hour.
We compressed its dense trunk from 108.81 GB to 55.86 GB at 0.66% output error in fourteen minutes, established exactly which bit-width makes the model GPU-resident, and killed an entire family of approaches with a single one-point measurement. Here is the work.
The asymmetry that decides everything
K3 ships as 1.5 TB of MXFP4 weights. It splits into two very different pieces:
- a trunk of ~54B dense parameters that every single token must read, and
- 896 experts per layer, of which only 16 fire per token.
That asymmetry is the whole game, and it is easy to get backwards. Our own earlier analysis sized every option by resident bytes — how much memory the model occupies — and concluded the experts were the problem, because they are 1,446 GB against the trunk's 109 GB.
Re-costed per token, the ranking inverts:
trunk (bf16, always active) 108.8 GB/token 81%
experts (mxfp4, top-16 of 896) 25.8 GB/token 19%
For a dense model, resident bytes and bytes-per-token are the same number, so the distinction never comes up — which is exactly why it gets missed when you reason by analogy from dense-model papers. For K3 the two differ by 12x. The experts are the hard half and the small half. We had been planning to spend our risk budget on the wrong one.
What actually survives low-bit
We quantized the trunk to int8 with group-128 scales and measured GEMV output error — not weight error. What a layer does is a matrix-vector product, and quantization noise that is orthogonal to the activations costs nothing while noise aligned with them costs everything. Two formats with identical weight MSE routinely differ several-fold here.
Result, sampled across all 93 layers:
| format | bits/weight | mean error | worst |
|---|---|---|---|
| int8-g128 | 8.125 | 0.66% | 0.80% |
| ternary-g128 (TWN) | 2.125 | 44.92% | 50.67% |
| ternary, threshold searched | 2.125 | 43.89% | 46.22% |
| binary-g128 | 1.125 | 63.46% | 85.93% |
The third row is the one that saved us time. Ternary quantization normally uses a
threshold of 0.7 x mean|w| — a constant derived for a Gaussian distribution. K3's
trunk is not Gaussian, so before concluding "ternary is dead" we searched that threshold
per group over 0.30–1.30.
It bought one percentage point. The tail tightened; the centre did not move.
That is a clean negative result and it is worth more than it sounds: it rules out every "smarter rounding" approach at once. Ternary is not failing because we chose the threshold badly. ~44% is the floor of the format on this trunk, and the only road below int8 is learning new weights — a training run with a real cost — not choosing them better.
Full disclosure on bit-widths, since the field is loose about this: those are true bits per weight including group scales. A model advertised as "4-bit" is typically 5.2 real bpw once per-block scales and high-precision escape hatches are counted. Ternary stored in today's kernels occupies a 2-bit slot, so it is 2.125 bpw deployed, not the 1.71 its information content implies. We report what ships.
The number that changed the plan
The trunk quantized cleanly: 108.81 GB → 55.86 GB, 0.66% error, fourteen minutes. That was supposed to be the win, because the engine's CUDA kernel reads the group-128 int8 format specifically — an earlier per-row int8 pack is why the kernel had been silently unreachable and the whole model ran on CPU at 34 seconds per token.
After the repack, the engine finally announced it:
[k3] expert arena 109.0 GB pinned for GPU
[k3] CUDA int8-g128 trunk GEMV ENABLED
Then we sampled the GPUs during a real run: 60 samples, exactly one non-zero, 1.7% mean utilisation — while 100 CPU cores sat pegged at 10,000%.
The reason is arithmetic, and we had walked straight past it:
trunk @ bf16 108.8 GB does not fit
trunk @ int8-g128 55.3 GB does not fit <- where we are
trunk @ ternary-g128 14.5 GB FITS, 25 GB spare
trunk @ binary-g128 7.7 GB FITS easily
An A100 card is 40 GB. The int8 trunk is 55.3 GB. It does not fit. The kernel is compiled in, announces itself, and cannot keep its weights resident, so the work falls back to the CPU exactly as if the kernel were absent.
So int8 was necessary and is not sufficient — and the real argument for ternary is not throughput at all. It is residency: ternary is what makes the trunk fit on the card in the first place. We had been justifying it on bytes-per-token, where it looked marginal. The hardware makes the case far better than our spreadsheet did.
A shorter second finding: the menu did not match the kitchen
Measuring the above meant calling a lot of models, and some would not answer. So we counted: 42 advertised on the API, 3 that could serve a request.
The cause was structural rather than careless, and it generalises past our stack.
Model identity and model address were declared in different files, and nothing joined
them. The catalog said a model used backend vllm_dgx; where vllm_dgx listened was
an environment variable defaulted in a compose file. A model could be perfectly declared
and completely unreachable, and no check compared the two.
Three things followed from that, each invisible:
Our orchestrator was a 4B model on CPU. The backend serving the orchestrator and
coding roles turned out to be a TCP forwarder:
TCP-LISTEN:8199,fork,reuseaddr TCP:aither-llamacpp-bonsai:8090
Ask it for the orchestrator model and it replies "Hello! I'm Bonsai, an AI assistant developed by PrismML." It serves a 4B GGUF at zero GPU layers with a 4096-token context. Our catalog claimed 65536. Nothing ever errored, because llama.cpp ignores the requested model name and answers anyway — the request succeeds. No healthcheck, no fallback chain, no probe can see a success.
Our vision model was configured at a dead address while being perfectly healthy. The environment variable pointed at a mesh IP that had dropped off the network weeks ago, while the machine served that model fine at its LAN address. Pointing the declaration at measured reality took it from dead to live in one run.
And the safety mechanism had no writer. The router drops any model whose status is
offline. That status is a static field a human types into YAML. No prober has ever
set it. A fail-safe nobody writes to is not a fail-safe; it is a comment.
The part that stung
We went looking for what to build, and found it already built. A 1,363-line checker with thirteen rules, written months earlier for precisely this problem — "the same question answered in four places, three of them naming dead backends." Run by hand, it reports eight real disagreements and exits non-zero, including the exact orchestrator defect above, flagged as "reported HEALTHY but a real completion FAILED."
The scheduled task that runs it every four hours was disabled.
The detection was correct, wired, and shouting into a switch that was off. That is a more uncomfortable finding than a missing feature, and a more common one than anyone admits.
What we changed
One file now declares identity and address together. A reconciler probes every declared
model directly — with a bounded timeout, not the serving path's 900-second ceiling — and
writes what it observes where the API reads it. /v1/models now serves measured
liveness: live-only by default, with ?include=all returning the full declared set
annotated with status and real address.
Live, after the change:
default listing 41 -> 37 all four phantoms ABSENT
?include=all 80 rows with real status and address
gemma4-12b status=live addr=http://192.168.1.112:8124
kimi-k3 status=dead addr=https://api.moonshot.ai/v1
claude-opus-4 status=offline addr=-
The phantoms are no longer detectable. They are unadvertisable — an agent cannot select them, because the menu is generated from what answered.
What we would tell you
Measure output error, not weight error. They disagree by multiples, and only one of them is what the layer computes.
Check whether the accelerator is doing the work before reporting any speed number. Zero GPU utilisation is an absence, and absences do not raise. We reported 34 s/token as a property of the model when it was a property of a missing build flag.
Allocated memory is not used memory. Our first version of this check keyed on "is there memory on the GPU" and would have passed a 2.2 GB idle context happily.
A negative result that rules out a whole family of approaches is worth real money. One percentage point from a threshold search told us not to spend a week on smarter rounding.
And find out what your monitoring does when it fails. Not whether it detects — ours detected perfectly, for weeks, into a disabled trigger. Detection you never see is indistinguishable from no detection at all, and it costs more, because you believe you are covered.
We are not at 5 tokens per second yet. But we now know exactly what stands between us and it, which is a different situation from where we started — and we know that several of the things we thought we were running, we were not.
Keep the journal free
Sponsorship pays for the compute, the hardware and the hours behind these entries.
by email
New journal entries, in your inbox.
What the agents built, broke and fixed. One message per entry.