TECHNOLOGY

llama.cpp Q2_0 VNNI: an EPYC kernel proposal and its numerical limits

In this article
THE QUICK TAKE

The author reports substantial gains for one Q2_0 CPU path, while an open proposal and numerical smoke tests leave release availability and application quality as separate questions.

A proposed kernel with a specific target

The original pull request was opened on July 30, 2026. At review it remains open, so its performance should not be described as a feature already merged into every llama.cpp release. It adds an x86 implementation of the Q2_0-by-Q8_0 dot product for AVX-VNNI or AVX-512 VNNI with the required vector-length support.

The change adapts an existing group-128 approach to the group-64 representation. Reading the actual patch shows instruction-specific branches for unpacking and integer dot products. That is a narrower intervention than accelerating every low-bit model or replacing the complete inference engine. CPU support, build targeting and the model’s actual tensor format determine whether the path applies.

The reported CPU-only experiment

The author compares clean upstream and proposed builds on an EPYC 9645 using 8 CPU cores. Native CPU optimization and OpenMP are enabled, BLAS is disabled, GPU offload is zero, and Flash Attention is disabled. Models are Bonsai group-64 Q2_0 GGUFs. Results are means and standard deviations over 3 measurements after warmup.

For Bonsai 8B, prompt processing at 512 tokens rises from 2.815 ± 0.014 to 10.257 ± 0.063 tokens/s. Generation over 128 tokens rises from 2.388 ± 0.008 to 8.199 ± 0.021 tokens/s. These are the author’s measurements, not an independent reproduction or a matched comparison against another CPU family.

Prefill and generation remain different tests

The pinned llama-bench documentation distinguishes prompt processing, token generation and their combined mode. It also states that these measurements exclude tokenization and sampling. The reported kernel improvement therefore does not by itself establish an HTTP service’s complete response time, queueing behavior or user-visible streaming rate.

The larger Bonsai 27B experiment uses 128 prompt tokens and 32 generation tokens because its baseline prompt pass is slow. Its rates cannot be placed beside the smaller models’ rates as if all rows executed the same workload. The phase-regression guide explains why phase, depth and build belong in the result record.

Kernel identity does not guarantee identical model outputs

The author reports passing quantization tests and 14000 randomized generic-versus-optimized comparisons with bitwise agreement for the operation in isolation. Nevertheless, a whole-model perplexity smoke test produces small, repeatable differences. The reported top-token agreement is 99.216 ± 0.554%.

The proposed explanation is different floating-point contraction after the dot product: separate multiply/add in one path and fused operations in the other. The author reports that disabling contraction restores agreement. This is useful diagnostic evidence, but operation-level identity should not be rewritten as identical complete generated answers. The quantization-quality guide provides context for checking task behavior alongside speed.

How far the result travels

The proposal demonstrates a credible optimization opportunity for this representation and tested machine. It does not establish the same multiplier for other quantizations, long-context service loads, different thread counts or every VNNI-capable processor. AI assistance in developing the patch and benchmark commands is disclosed in the source; it does not turn the author’s tests into independent verification.

A deployment comparison needs the actual build revision, confirmed instruction path, matching model artifact and representative quality checks. Release status should be checked separately from the historical benchmark. Keeping those boundaries visible preserves a useful CPU result without turning it into a universal low-bit inference claim.

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