Llama.cpp b10994: When to Retest Metal Prefill Instead of Blaming the GGUF

If a Metal-hosted MoE model works with a small prefill but produces NaN logits with a larger one, replacing the GGUF should not be the first diagnostic move. llama.cpp b10994, marked as a prerelease at commit 0a8b29a, documents a runtime failure that can explain that pattern. The useful decision is whether to trial this build against the same model file before removing a small-microbatch workaround.

That is a narrower claim than saying the GGUF is fine or every empty response has the same cause.

Why the prefill boundary matters

The release’s embedded description of PR #26223 attributes the failure to the Metal mul_mm_id path narrowing f32 activations to half. When activations exceed f16’s maximum finite value, 65504, that conversion can produce infinity; the subsequent matrix operation propagates NaNs across an 8x8 accumulator tile.

The same description says the mul_mv_id path used below the dispatch threshold of 32 keeps those values in f32. That gives a specific explanation for short prefills succeeding while larger ones fail. The 32-token boundary belongs to the described kernel path; it is not a universal rule that a user prompt of 32 tokens breaks a model.

The documented fix rescales activations by a power of two before narrowing them and reverses the scale when storing the f32 accumulator. According to the release, accumulation itself remains f32. This addresses the reported overflow mechanism, not every possible quantization or output-quality problem.

What the reported tests establish

The release reports the following on Apple M2 Max:

  • Six synthetic MUL_MAT_ID cases, covering n=16, 32 and 64 with q4_K and q8_0 shapes, moved from four failures and two passes to all passing. The n=16 cases were the below-boundary controls.
  • A full test-backend-ops -b MTL0 run had zero failures.
  • Mistral-Small-4-119B generated correctly at n_ubatch=512 in both UD-IQ3_S and UD-Q4_K_XL. The prior workaround described there was n_ubatch <= 31, forcing the smaller-input path.

These are release-author observations, not independent tests performed for this article. They do not establish correctness for another model, quantization, device or build.

There is also an important qualification within the same page: later entries say tests were temporarily commented out to avoid breaking CI. The earlier successful test account therefore should not be read as proof of the final build’s enabled test coverage. The dense kernel_mul_mm is explicitly left unchanged, despite the author’s suspicion of analogous narrowing behavior.

A bounded retest before changing the model file

For an API service you operate on this affected Metal path, I would use the release as a reason for a controlled comparison:

  1. Preserve the current build and workaround. Record the GGUF checksum, quantization, device, runtime version and inference settings so the model file stays fixed across the comparison.
  2. Reproduce the failure on the current build. Check logits where the diagnostic setup permits; an empty response alone does not identify this overflow. Keep a below-boundary control alongside the failing case.
  3. Trial b10994 with the same inputs and settings. Exercise below-boundary and boundary cases, including sizes around 31/32 and 64, then the intended operating microbatch size. Ensure the test actually exercises the relevant prefill path rather than relying on visible prompt length alone.
  4. Require finite logits and valid output on the affected workload before retiring n_ubatch <= 31. Measure service latency and throughput separately; the release’s kernel tests are not an end-to-end service guarantee. Retain the rollback option if the failure persists.

The page suggests that an issue attributed to a bad GGUF may share this cause, but that remains a hypothesis; the linked issues are not independently verified here. Retesting the runtime first helps isolate the variable. It neither certifies the file’s integrity nor establishes that a hosted API provider uses the affected implementation.

The regression test needs a second axis besides prefill size: activation magnitude. The b10994 release description says the existing MUL_MAT_ID initializer used values in [-1, 1], so those cases could not push an operand outside f16 range. It introduces an amax parameter that scales the f32 activations while leaving the quantized weights in their normal range. That matters when interpreting a green backend suite: which numerical regime did it actually exercise?

I would keep ordinary-range cases and deliberately large-activation cases in the same comparison, crossed with n=16, 32 and 64. Hold the weights and tensor shapes fixed within each comparison. The useful pattern would be an old-build failure specifically in the large-activation, matrix-path cases, followed by a corrected result on the candidate build without breaking either control. That would support the proposed mechanism more directly than a long prompt starting to generate text.

Finite output should be the first check, not the whole numerical acceptance criterion. I would also compare against a CPU reference using an explicitly recorded error metric and tolerance appropriate to the tested operation; non-NaN output alone does not establish numerical agreement. This is a proposed acceptance test, not a reproduced result. If the candidate merely stops producing NaNs but still disagrees with the reference, I would leave the workaround in place and investigate before treating the fix as validated.