{
  "_comment": [
    "Voxtral (2507) FINALIZED tolerances. Correctness regime:",
    "  - reference: transformers VoxtralForConditionalGeneration, dtype=bfloat16,",
    "    attn_implementation=eager (the shipped dtype; jfk/--language en decode).",
    "  - C++: BF16 reference GGUF, backend cpu, threads 1, KV cache f16 (AUTO).",
    "  - C++ mel is computed in-process (NOT injected from ref); enc.mel.in below",
    "    is therefore the real frontend-parity gate (matches ref WhisperFeatureExtractor",
    "    to 2.2e-5 max / 4.1e-8 mean).",
    "",
    "DOMINANT DRIFT SOURCE (measured, not assumed): the reference runs a FULL bf16",
    "forward -- it casts the mel to bf16 before conv1 (modeling_voxtral.py:349) and",
    "keeps bf16 activations through the whole stack -- while the C++ ggml graph runs",
    "f32 activations with bf16 weights. So the C++ is the MORE accurate path; the",
    "cpp-vs-bf16-ref drift is the reference's own bf16 activation rounding, which",
    "compounds with depth to ~1-1.5% relative at the massive-activation late layers.",
    "",
    "This was proven by a three-way decomposition (tmp probes), per tensor:",
    "  A = f32-ref vs bf16-ref  (reference-internal bf16 rounding)",
    "  B = cpp     vs bf16-ref  (what this file gates)",
    "  C = cpp     vs f32-ref   (bf16-WEIGHT + f16-KV residual only)",
    "Result: A ~= B on every tensor (e.g. enc.out mean A 1.11e-2 ~ B 1.13e-2;",
    "dec.block.29 mean A 1.48e-1 == B 1.48e-1), and C is 3-4x TIGHTER than B on the",
    "encoder (enc.out mean C 2.68e-3 vs B 1.13e-2) -- i.e. the C++ tracks the f32",
    "reference, and the B drift is dtype, not a bug. Transcript is byte-exact vs both",
    "the bf16 and f32 references.",
    "",
    "Budgets below are max(1.5 * observed B, 1e-6 floor); ~50% headroom over the",
    "measured cpu/threads-1 drift. Pure GGUF reads / pure adds are pinned to exact 0.",
    "Widened vs the Stage-2 provisional (which assumed f32 ~1e-4 relative precision):",
    "every compute tensor is ~100-1000x looser, by the bf16-activation-rounding",
    "mechanism named above."
  ],

  "enc.mel.in":          { "max_abs": 5.0e-05,  "mean_abs": 1.0e-06,
    "_comment": "C++ mel vs ref WhisperFeatureExtractor (frontend-parity gate); FFT/filterbank f32 precision." },

  "enc.block.0.out":     { "max_abs": 3.8e-02,  "mean_abs": 2.8e-03 },
  "enc.block.16.out":    { "max_abs": 5.6e-01,  "mean_abs": 5.2e-03 },
  "enc.block.31.out":    { "max_abs": 2.8e+01,  "mean_abs": 1.7e-02,
    "_comment": "massive-activation outliers (max |x| ~1e3); worst-element budget large by design, mean stays ~1.5% relative." },
  "enc.out":             { "max_abs": 2.2e+01,  "mean_abs": 1.7e-02 },

  "proj.out":            { "max_abs": 5.3e-01,  "mean_abs": 4.8e-03 },

  "dec.token_emb":       { "max_abs": 0.0,      "mean_abs": 0.0,
    "_comment": "pure GGUF embedding lookup (get_rows of bf16 embd) -- bit-identical to the bf16 reference; nonzero here = an unintended dtype conversion." },
  "dec.audio_injected":  { "max_abs": 5.3e-01,  "mean_abs": 4.7e-03,
    "_comment": "= proj.out spliced into the embedding sequence; drift == proj.out." },
  "dec.block.0.out":     { "max_abs": 5.6e-01,  "mean_abs": 4.8e-03 },
  "dec.block.15.out":    { "max_abs": 1.4e+01,  "mean_abs": 3.0e-02 },
  "dec.block.29.out":    { "max_abs": 2.3e+01,  "mean_abs": 2.3e-01 },
  "dec.out_before_head": { "max_abs": 1.1e+02,  "mean_abs": 7.8e-01,
    "_comment": "post-final-RMSNorm massive-activation outliers; argmax is unchanged (transcript byte-exact)." },
  "dec.logits_raw":      { "max_abs": 6.9e-01,  "mean_abs": 7.0e-02,
    "_comment": "first-token logits (scores[0]); argmax matches the reference (greedy decode byte-exact)." },
  "dec.logits_raw.gen8": { "max_abs": 3.7e-01,  "mean_abs": 8.9e-02,
    "_comment": "mid-generation step logits = scores[8] (9th token, after 8 KV-cached greedy steps); autoregressive coverage. bf16 regime (observed 0.245/0.059, budget = 1.5x); argmax matches (transcript byte-exact)." }
}
