llama.cpp CUDA Few-Row MMQ for F8_E4M3 Weights: Speculative Decoding Speedups

Merged in ggml-org/llama.cpp PR #33584 on December 5, 2026, CUDA few-row MMQ support for F8_E4M3 weights accelerates 2–24 token speculative verification batches by up to 1.599x on RTX 5090 and boosts SPEED-Bench coding throughput from 150.97 to 222.71 tok/s while improving Wikitext-2 accuracy over cuBLASLt.
llama.cpp CUDA Few-Row MMQ for F8_E4M3 Weights: Speculative Decoding Speedups: Merged in ggml-org/llama.cpp PR #33584 on December 5, 2026, CUDA few-row MMQ support for F8_E4M3 weights accelerates 2–24 token speculative verification batches by up to 1.599x on RTX 5090 and boosts SPEED-Bench coding throughput from 150.97 to 222.71 tok/s while improving Wikitext-2 accuracy over cuBLASLt. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.
- 1.475x End-to-End SPEED-Bench Speedup: Qwen3.8-27B NVFP4 + DFlash2 Q4_K_M speculative decoding on RTX 5090 jumps from 150.97 tok/s (27.24 ms/step) to 222.71 tok/s (18.23 ms/step).
- 1.599x Peak Kernel Acceleration: At 8-token verification ubatches on RTX 5090 (Blackwell cc 12.0), few-row MMQ beats MMVF by 59.9% across 208 FP8 matrices.
- Higher Precision Than cuBLASLt: At 16 tokens, replacing cuBLASLt FP8 activations with exact E4M3->FP16 weight conversion and power-of-2 scaled FP16 src1 drops Wikitext-2 KLD from 0.00216 to 0.000285.
- Cross-Generation Coverage: Activates from 2 columns on Blackwell (cc 12.0/12.1), 4 columns on Ada (RTX 4090 cc 8.9), and 6 columns on Ampere (RTX 3090 Ti cc 8.6).
import { createAgent } from '@smoke-monkey/harness';// Coding agent backed by llama.cpp built after PR #33584 (F8_E4M3 few-row MMQ)const agent = createAgent({agentId: 'cuda-mmq-speculative-coder',provider: 'openai-compatible',baseUrl: 'http://127.0.0.1:8080/v1',model: 'Qwen3.8-27B-NVFP4',workspacePath: process.cwd(),permissions: {read_file: 'allow',write_file: 'allow',run_command: 'ask',},});async function main() {const result = await agent.run('Benchmark speculative verification step latency across ubatch sizes 4, 8, and 16 and summarize tok/s gains.');console.log('Agent Verification Result:', result.summary);}main().catch(console.error);
Watch: Related Video Guides
llama.cpp FP8 vs Q8: Which Quant Should You Run?
llama.cpp Just Made Your GPU 2x Faster on Big Models (Turn This On)
Why Did NVFP4 Checkpoints Stall During Speculative Decoding in llama.cpp?
Few-row MMQ for F8_E4M3 (merged in ggml-org/llama.cpp PR #33584) is a specialized CUDA matrix-multiplication kernel path handling 2 to 24 src1 columns. NVIDIA's NVFP4 checkpoints leave attention and Gated DeltaNet projections in F8_E4M3 (208 FP8 matrices in Qwen3.8-27B), which previously fell back to slow MMVF (2–8 tokens) or lower-precision cuBLASLt (9–24 tokens), making NVFP4 ~30% slower than Q8_0 attention.
To avoid the 3.6x higher KL divergence observed when running FP8 Tensor Cores with quantized FP8 src1 activations, PR #33584 converts F8_E4M3 weights cleanly to FP16, scales src1 to FP16 in 256-value power-of-2 blocks (quantize_mmq_few_f16), and executes m16n8k16 FP16 MMAs with FP32 accumulation:
| GPU Architecture | Compute Cap | Activation Threshold | 4-Token Speedup | 8-Token Speedup | 16-Token Speedup |
|---|---|---|---|---|---|
| RTX 5090 (Blackwell) | cc 12.0 | >= 2 columns | 1.302x | 1.599x | 1.081x |
| DGX Spark (Blackwell) | cc 12.1 | >= 2 columns | 1.059x | 1.173x | 1.042x |
| RTX 4090 (Ada) | cc 8.9 | >= 4 columns | 1.061x | 1.412x | 1.056x |
| RTX 3090 Ti (Ampere) | cc 8.6 | >= 6 columns | — (MMVF) | 1.203x | 1.354x |
Building llama.cpp With CUDA Few-Row MMQ and Running SPEED-Bench
Because PR #33584 merged directly into ggml-org/llama.cpp master (commit 8f50b1d), building from source with -DGGML_CUDA=ON enables the F8_E4M3 few-row path automatically on Blackwell, Ada, and Ampere GPUs. It also accelerates MUL_MAT_ID above 8 tokens via the per-expert MUL_MAT fallback and F8 V-cache KQV ops when flash attention is off:
# 1. Clone and build llama.cpp with CUDA support
git clone https://github.com/ggml-org/llama.cpp.git
cd llama.cpp
cmake -B build -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES="86;89;120"
cmake --build build -j --target llama-server llama-bench test-backend-ops
# 2. Verify F8_E4M3 backend operator correctness (132/132 MUL_MAT, 83/83 MUL_MAT_ID)
./build/bin/test-backend-ops -o MUL_MAT -p f8_e4m3
./build/bin/test-backend-ops -o MUL_MAT_ID -p f8_e4m3
# 3. Benchmark small-batch speculative token verification (ubatch 2..16)
./build/bin/llama-bench -m ./Qwen3.8-27B-NVFP4.gguf -p 576 -n 0 -ub 8 -r 5
# 4. Launch server with DFlash2 Q4_K_M speculative drafting
./build/bin/llama-server -m ./Qwen3.8-27B-NVFP4.gguf \
--spec-type draft-dflash --spec-draft-n-max 7 \
--host 127.0.0.1 --port 8080Accuracy Improvement Over cuBLASLt
On 20 chunks of 512 tokens from Wikitext-2 (RTX 5090), PR #33584 cuts KL divergence at ubatch=16 from 0.00216 (cuBLASLt FP8 src1) down to 0.000285—nearly matching ubatch=8 MMVF F32 reference (0.000272).
Why Few-Row Verification Speed Matters for Autonomous Coding Harnesses
In an autonomous loop driven by Smoke Monkey Harness, each Explore -> Plan -> Edit -> Verify cycle issues dozens of short-burst completions and AST tool calls. When speculative decoding pairs a 7-token draft-dflash drafter with an NVFP4 target, every verification forward pass sits squarely inside the 2-to-8 token window where F8_E4M3 previously stalled.
Dropping verification step latency from 27.24 ms down to 18.23 ms pushes coding agent throughput to 222.71 tok/s on a single consumer RTX 5090—making local NVFP4 weights competitive with hosted frontier APIs for multi-file TypeScript refactoring.
Frequently Asked Questions
Q:Which GPUs benefit from llama.cpp PR #33584 F8_E4M3 few-row MMQ?
Blackwell GPUs (RTX 5090, RTX PRO Blackwell cc 12.0, DGX Spark cc 12.1) enable it starting at 2 columns, Ada Lovelace (RTX 4090 cc 8.9) at 4 columns, and Ampere GA10x (RTX 3090 Ti cc 8.6) at 6 columns, up to 24 columns.
Q:Why did the author convert F8_E4M3 weights to FP16 instead of using FP8 Tensor Cores?
Testing FP8 MMA with FP8 src1 activations yielded only 0–0.7% extra speed at 3–8 tokens while increasing KL divergence by 3.6x. Exact E4M3-to-FP16 conversion with FP16 m16n8k16 MMAs preserves reference accuracy.
Q:Does this affect normal single-token generation without speculative decoding?
Single-token generation (1 column) continues to use the existing MMVF vector kernel. Few-row MMQ specifically targets 2–24 column batches produced by speculative decoding, small prompt chunks, and multi-request batching.
Q:What happens on Ampere RTX 3090 Ti above 8 tokens?
Before PR #33584, master converted FP8 weights to F16 for cuBLAS above 8 tokens. With few-row MMQ enabled at 6–24 columns, RTX 3090 Ti achieves 1.354x faster throughput at 8 and 16 tokens.
Related Alternatives & Comparisons
Related Architecture Guides
View all guidesBest Open Source Coding Agents in 2026: Free, Local & Fully Hackable Harnesses
MCP Server Security Best Practices: Hardening Model Context Protocol Agents in 2026
Open Source Coding Agent Harness: Build a Forkable, Local AI Engineering Runtime
Build with Smoke Monkey Harness
Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.