llama.cpp, software for running models, now reduces computation for parts not used in the output when processing input in bulk. Developers using the affected models get an optimization that transforms only the parts needed for output.
1. Select the needed rows before transforming them
Released on December 3, 2026, b12962 changes the order of final-layer operations. It targets laguna and AFMoE models, reducing output projection work during prefill, which precomputes the input context in bulk.
Attention computes relationships between tokens, and output projection transforms its results into a form used for output. Instead of transforming many rows and keeping only the needed ones, the change selects those rows first. It is like selecting the needed lines in a document before processing just those lines.
For AFMoE, row selection now precedes both output projection and normalization, which standardizes the distribution of values. Alongside projection savings shared by both models, AFMoE also filters rows before normalization.
2. Use the independence of rows
The release notes say build_lora_mm and build_norm process each row independently, without mixing positions or accessing the KV cache that stores per-token keys and values. This is why moving final-layer row selection before these operations leaves the computed results for retained rows mathematically unchanged.
According to the release notes, all execution backends reduce final-layer projections during prefill by the difference between input tokens and rows needed for output. Previously, n_tokens rows were projected; now, only the n_outputs rows needed for output are projected. Thus, the number of skipped projections is n_tokens - n_outputs, as stated in the source.
3. Tests passed on CPU and the Vulkan GPU execution backend
The release notes report that both models passed model architecture tests using CPU and Vulkan0. These are the validation results provided for the reordered computation path.
NMSE is an error metric indicating how much computed results differ from the CPU reference.
Table: NMSE comparison against the CPU reference by model
Conditions: CPU and Vulkan0 model architecture tests, using CPU results as the reference
Unit: NMSE (dimensionless)
| Model | NMSE |
|---|---|
| laguna | 2.38e-07 |
| AFMoE | 8.83e-08 |
The tests show how closely results match after the change, while the projection reduction describes the computation skipped.
4. Focus on improving the computation path rather than adding settings
The release notes describe a fix built into the affected models' computation paths, with no separate activation option. The savings depend on how few rows are needed for output relative to input rows. The fewer output rows needed relative to input rows, the more final-layer projections are skipped.
However, the release notes provide no measurements of processing time, tokens per second, or memory usage. Actual speed gains and changes in generation-stage speed or memory usage therefore cannot be confirmed.
b12962 reorders operations while preserving output results, reducing projection work for rows that would be discarded in the final layer.
