TECHNOLOGY

llama.cpp CUDA few-row MMQ: speculative verification has its own matrix regime

In this article
THE QUICK TAKE

The b12342 few-row MMQ kernel targets a narrow CUDA shape regime; verification speed and total speculative-decoding benefit remain separate results.

llama.cpp b12342 adds a CUDA quantized matrix-multiplication kernel for two to 24 activation columns. Upstream identifies small batches and speculative verification as motivating cases. The optimization targets weight reuse across a few columns, so its value depends on internal operation shape rather than the label “speculative decoding” alone.

Several columns can reuse one weight decode

The PR contrasts repeated per-column work with a new kernel that decodes weights once for multiple activation columns. It also explains why a large-batch kernel can be inefficient at these small sizes. This is a shape-specific reuse strategy, not a change to the statistical acceptance rule of speculative decoding. The supported quantized formats and GPU generations are part of the implementation boundary and should accompany any test.

Verification columns are not accepted tokens

A verification pass may process candidate positions that are later rejected. Faster evaluation of those columns does not directly specify useful tokens produced per second. A serving comparison must record draft cost, verification cost and accepted progress, rather than counting all evaluated candidates as output. This distinction is especially important if a configuration change alters the number of drafted positions while also changing which matrix kernel is selected.

Compare the same arithmetic before the pipeline

A proposed backend test uses the same quantized matrix and activations across the old and new implementations, including boundary column counts and representative row sizes. Check numerical error against a trusted reference before timing. Then profile the actual verification graph to establish that the few-row route is selected. A standalone kernel gain cannot explain an end-to-end result unless the application spends a meaningful fraction of time in that operation.

Avoid a universal small-batch speed claim

The release publishes a kernel with explicit format and hardware scope. Small batches outside that scope can still use another route. Report the actual matrix dimensions and device with any result, and keep ordinary decode and prompt processing separate from speculative verification. This article reports the upstream mechanism and proposes measurement boundaries, without importing a microbenchmark ratio as a prediction for every model or declaring new independent throughput measurements.

Sources

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles