The Error Jump at Layer Two Was the Recipe, Not a Bug
A converted hybrid model tracked its bf16 original at cosine 0.9996 through layer 1, then fell to 0.991 at layer 2. Quantizing one matrix at a time showed the cause: layers 0 and 1 were 8-bit and layer 2 was the first at 4 and 6 bits. The 4-bit MLP matrices dominated.
Summary
We converted a 0.8B hybrid model to a mixed 4/6/8-bit format and compared hidden states with the bf16 original after chosen layers. The cosine was 0.9996 after layers 0 and 1 and 0.991 after layer 2, a relative error that went from 3% to 13% in one layer. That pattern looks like a bug. It was the recipe: layers 0 and 1 are stored at 8 bits, layer 2 is the first at 4 and 6.
The check
Quantize exactly one matrix, leave everything else in bf16, run the same prompt, and read the error at that layer's output.
| matrix (layer 2) | bits | relative L2 |
|---|---|---|
| MLP up | 4 | 9.5% |
| MLP gate | 4 | 7.8% |
| linear-attention input (q, k, v) | 4 | 5.8% |
| linear-attention output | 6 | 3.6% |
| MLP down | 6 | 2.2% |
| linear-attention z projection | 6 | 1.6% |
Every 8-bit matrix in layers 0 and 1 measured 0.5-2%, and the 8-bit embedding 1.5%. Errors compound across matrices in a layer and across layers: the whole-model cosine bottomed out at 0.946 around layer 11 and recovered to 0.987 at the end.
Gotchas
One prompt, one position. This is a pointer to where to look, not a ranking. Different text can reorder the matrices.
Fused kernels constrain the recipe. Gate and up share a fused kernel in many engines, so you cannot give them different widths; allocate them together.
The oracle must say which recipe it measured. A stale reference built for a different recipe produces a convincing but meaningless gap, so the test page now prints the recipe it was built from.
Key takeaways
- A sudden error step usually marks where the bit width changes; check the recipe before the kernel.
- Isolate one matrix at a time. It is cheap and attributes the error without guessing.
- The 4-bit MLP matrices carry most of the loss here, which says where extra bits are best spent.
- Treat single-prompt measurements as hints and confirm with a paired metric over many passages.
Follow @robotnurseio on X for the short version.
Everything in these notes I also do for hire: local AI set up on hardware you own, configured on-site, then handed over with enough documentation that you do not need me afterward. If that sounds more useful than another weekend of reading forum threads, the details are at /work. No obligation from an email, and the posts stay free either way.