--- license: apache-2.0 tags: - qwen3.6 - llama.cpp - mtp - turboquant - kv-cache - benchmark - local-inference - gguf pretty_name: Qwen3.6 MTP Turbo KV Runtime Analysis task_categories: - text-generation language: - en size_categories: - n<1K --- # Qwen3.6 MTP Turbo KV Runtime Analysis This repository is a curated analysis artifact for local Qwen3.6-35B-A3B MTP GGUF inference experiments on Windows CUDA. It compares clean MTP llama.cpp, QuinsZouls llama-next TurboQuant, and the completed subset of Atomic TurboQuant runs under a fixed 64k context, MoE CPU offload, and Unsloth-aligned sampling settings. The raw benchmark runs included incomplete and capability-incompatible rows. This repo keeps only completed, comparable short-form timing rows in the primary tables and records all exclusions explicitly. ## Workload Shape and Real-World Scope The headline timing claims are short-form local inference benchmarks, not full software engineering agent benchmarks. Each completed configuration was run against 21 prompt cases with 10 repeats, giving 210 request instances per configuration. Across the 12 completed configurations, the curated dataset contains 2,520 completed timed requests, 70,440 measured prompt tokens, and 1,005,361 measured generated tokens. This repo contains two different measurement modes: |mode|purpose|sample shape|used for headline statistical claims?| |---|---|---|---| |Repeated short-task benchmark|Compare runtime throughput under controlled coding/technical prompts|21 prompt cases x 10 repeats = 210 timed requests per completed config; about 28 measured prompt tokens in and 399 generated tokens out per request|Yes| |Exploratory cumulative long-output curve|Inspect how throughput changes as a single generation gets longer|8 configs with throughput sampled at 1k-token output milestones from 1k to 8k; sample sizes vary from n=1 to n=3 at each milestone|No| Typical request size in the curated headline rows: |measure|value| |---|---:| |Prompt cases per completed config|21| |Repeats per prompt per completed config|10| |Timed request instances per completed config|210| |Completed timed request instances across curated configs|2,520| |Average measured prompt tokens per request|28.0| |Average measured generated tokens per request|399.0| |Per-config average generated tokens per request range|364.6 to 429.2| The prompt set is application-specific to coding, agentic reasoning, and inference-runtime analysis. It includes Python, C++, TypeScript, Rust, SQL, CUDA debugging, API-contract design, FastAPI/Postgres performance review, security review, JSON transformation, architecture tradeoff analysis, math, translation, factual question answering, and short creative generation. The strongest relevance is therefore for local coding-assistant and technical-agent workloads that produce a few hundred output tokens per turn. Important scope limits: - These results were produced on one local Windows CUDA workstation, not across multiple hardware instances. - The benchmark compares many request instances, but it does not establish cross-machine reproducibility. - The curated headline rows are short-input, medium-output tests. They do not prove performance for full repository ingestion, multi-turn tool use, or true 10k-token output sessions. - The cumulative long-output charts are a separate exploratory exercise. They are retained to show throughput shape over longer generations, but excluded from headline claims because sample sizes are small, the synthetic input overshot the intended 10k-token target, and some streams stopped early. A more detailed workload note is included at [`analysis/workload-scope-and-relevance.md`](analysis/workload-scope-and-relevance.md). ## Headline Results |baseline|config|n_pairs|delta_pct_mean|delta_pct_sem|delta_pct_ci_low|delta_pct_ci_high|actionable| |---|---|---|---|---|---|---|---| |q4_k_m_mtp_clean_q8_q8_ctx64k_moe30|q4_k_m_mtp_quins_q8_q8_ctx64k_moe30|210|37.249|0.737|35.8044292388266|38.69447088206287|True| |q4_k_m_mtp_clean_q8_q8_ctx64k_moe30|q4_k_m_mtp_atomic_q8_q8_ctx64k_moe30|210|16.419|2.356|11.802107883002254|21.036684052527104|True| |q4_k_m_mtp_quins_q8_turbo3_ctx64k_moe30|q4_k_m_mtp_atomic_q8_turbo3_ctx64k_moe30|210|-15.907|1.664|-19.167954010961846|-12.645278954526283|False| |iq3_xxs_mtp_clean_q8_q8_ctx64k_moe30|iq3_xxs_mtp_quins_q8_q8_ctx64k_moe30|210|26.730|0.683|25.391669219912767|28.06834416785834|True| Interpretation: - QuinsZouls llama-next was the fastest completed runtime in the comparable MTP runs. - Atomic TurboQuant improved over clean MTP on Q4_K_M q8/q8, but was slower than Quins on the completed Q4_K_M q8/turbo3 comparison. - Clean MTP llama.cpp cannot isolate Turbo KV effects directly because it does not expose `turbo3` or `turbo4` KV cache types. ## Code-Level Runtime Analysis A detailed teaching appendix is included at [`analysis/mtp-runtime-code-comparison.md`](analysis/mtp-runtime-code-comparison.md). The short version is that the QuinsZouls speedup appears to come primarily from its MTP runtime strategy, not from Turbo KV cache compression. A higher-level narrative summary and tweet-thread draft is included at [`analysis/high-level-analysis-and-tweet-thread.md`](analysis/high-level-analysis-and-tweet-thread.md). It is intended as publishable framing for the main findings, with exact metrics and confidence intervals. Source code links in the appendix point to fixed GitHub commits: - [QuinsZouls/llama-cpp-turboquant `1e5a46d`](https://github.com/QuinsZouls/llama-cpp-turboquant/tree/1e5a46dccb8dd9b8d52817030cf4e334f76a8725) - [TheTom/llama-cpp-turboquant `5aeb2fd`](https://github.com/TheTom/llama-cpp-turboquant/tree/5aeb2fdbe26cd4c534c6fa15de73cb5749bd0403) - [am17an/llama.cpp clean MTP `e7b4848`](https://github.com/am17an/llama.cpp/tree/e7b4848151377395b1693d326d1cda3fcd61c2d9) - [AtomicBot-ai/atomic-llama-cpp-turboquant `0a635dc`](https://github.com/AtomicBot-ai/atomic-llama-cpp-turboquant/tree/0a635dcd92ba66c75fccfef91c3e106f4668f367) The strongest evidence is the `q8_0/q8_0` comparison. Quins was already much faster while using the same requested KV cache type: |model|runtime|wall tok/s|draft / predicted|accepted / predicted|draft accept rate| |---|---:|---:|---:|---:|---:| |Q4_K_M|clean q8/q8|45.55|0.533|0.525|0.986| |Q4_K_M|Quins q8/q8|62.35|0.816|0.589|0.721| |IQ3_XXS|clean q8/q8|42.20|0.534|0.527|0.986| |IQ3_XXS|Quins q8/q8|53.31|0.818|0.588|0.718| The code comparison points to three likely contributors: - Quins loads a dedicated MTP architecture override (`qwen35moe_mtp`) and marks the MTP context as KV-only for the NextN/MTP layers. - Quins registers the MTP context directly on the target context (`llama_set_mtp`) and mirrors hidden states through a target decode hook (`handle_mtp_for_ubatch`) instead of routing all handoff through a separate speculative-processing step. - Quins uses greedy top-1 MTP draft proposals and tends to fill more of the two-token draft budget. Clean MTP uses top-10 plus a `p_min = 0.75` confidence gate, which often stops drafting early. This produces a useful but slightly counterintuitive result: Quins has a lower acceptance percentage, but it attempts enough more drafts that it accepts more speculative tokens per generated token. That is the best current explanation for why wall throughput rises even before Turbo KV is introduced. Reproducibility note: this is still an observational comparison between forks. The appendix lists follow-up ablations that would isolate causality, especially changing only the draft sampler policy or only the MTP handoff path. ## Quins Fork Additions vs Original TurboQuant The original TheTom TurboQuant fork is best understood as a TurboQuant key-value cache runtime: it exposes `turbo2`, `turbo3`, and `turbo4` cache formats, but the local binary did not expose a Qwen MTP mode. Its `--spec-type` help listed `none`, `ngram-cache`, `ngram-simple`, `ngram-map-k`, `ngram-map-k4v`, and `ngram-mod`, with no `mtp`, `draft-mtp`, or `nextn` mode. That means the original TurboQuant runtime could not run the Qwen3.6 embedded multi-token prediction setup used in this report without additional implementation work. Quins adds the missing runtime path. It loads the same GGUF through a dedicated Qwen MTP architecture override (`qwen35moe_mtp` / `qwen35_mtp`), registers the MTP context directly with the target context, and mirrors target hidden-state rows into the MTP context during target decode. In practical terms, the original TurboQuant fork supplied the compressed key-value cache mechanism; the Quins fork supplied the Qwen MTP execution path that made these benchmark rows possible. Quins also adds a GQA-aware cache safety policy. GQA means grouped query attention: many query heads share fewer key/value heads, so one compressed key can affect several attention heads. For high-GQA models such as Qwen-style architectures, compressing the key cache too aggressively can damage attention quality. Quins detects this high grouped-query-attention ratio and can auto-upgrade symmetric Turbo key/value requests such as `turbo3/turbo3` into an asymmetric configuration such as `q8_0/turbo3`. The intent is to keep keys at safer eight-bit precision while still compressing values with TurboQuant. This matters for interpreting the results: Quins is not just "original TurboQuant plus the same flags." It is original TurboQuant-style key-value compression plus Qwen-specific MTP loading, target-to-MTP hidden-state handoff, greedy MTP drafting, MTP key-value synchronization, and GQA-aware asymmetric cache protection. ## Visual Summary ![Mean wall tokens per second](assets/wall_tps_by_config.png) ![Mean decode tokens per second](assets/decode_tps_by_config.png) ![Paired throughput deltas](assets/paired_delta_ci.png) ![MTP acceptance rate vs wall throughput](assets/acceptance_vs_wall_tps.png) ## Test Matrix ### Models - `q4_k_m_mtp`: `Qwen3.6-35B-A3B-MTP UD-Q4_K_M` - `iq3_xxs_mtp`: `Qwen3.6-35B-A3B-MTP UD-IQ3_XXS` Both models are from the Unsloth Qwen3.6 MTP GGUF release. Vision projector tests were not part of the curated text-only timing claims. ### Runtime Binaries - `clean`: [`am17an/llama.cpp` clean MTP](https://github.com/am17an/llama.cpp/tree/e7b4848151377395b1693d326d1cda3fcd61c2d9) - `quins`: [`QuinsZouls/llama-cpp-turboquant` llama-next TurboQuant](https://github.com/QuinsZouls/llama-cpp-turboquant/tree/1e5a46dccb8dd9b8d52817030cf4e334f76a8725) - `atomic`: [`AtomicBot-ai/atomic-llama-cpp-turboquant`](https://github.com/AtomicBot-ai/atomic-llama-cpp-turboquant/tree/0a635dcd92ba66c75fccfef91c3e106f4668f367) Capability probe summary: - clean MTP: MTP yes, Turbo KV no - QuinsZouls: MTP yes, Turbo KV yes - Atomic: Qwen NextN/MTP path yes, Turbo KV yes - TheTom/local TQ3: Turbo KV partially present, but no Qwen MTP/NextN mode in the local binaries, so excluded from MTP claims ### Fixed Runtime Settings - Context: `--ctx-size 64000` - MTP draft count: 2 equivalent draft tokens per round - MoE CPU offload: `--n-cpu-moe 30` - GPU layers: `--gpu-layers 99` - Flash attention: enabled - Parallel slots: `--parallel 1` - Multimodal projector: disabled for these curated text-only comparisons Host memory: - Installed DIMMs: 2 x 16 GiB Kingston - DIMM rated speed reported by Windows: 5,600 MT/s - Configured speed during these benchmark runs: 5,200 MT/s Because the headline runs use MoE CPU offload (`--n-cpu-moe 30`), host memory bandwidth can plausibly influence absolute throughput through offloaded expert access and CPU-to-GPU staging pressure. Faster RAM could therefore improve results, but RAM speed was not swept as an independent variable in this dataset. Sampling: ```text temperature = 0.6 top_p = 0.95 top_k = 20 min_p = 0.0 presence_penalty = 0.0 repeat_penalty = 1.0 cache_prompt = false ``` ## Statistical Method Each completed short-run configuration used 21 prompts and 10 repeats, giving 210 timing rows per completed config. Paired comparisons match rows by: ```text (prompt_id, repeat_id, seed) ``` Reported uncertainty: - mean wall tokens/second - standard error of the mean: `SEM = sd / sqrt(n)` - 95% confidence interval using normal approximation over paired percent deltas Actionability criterion: ```text n >= 90 paired rows and lower bound of 95% CI > +2% wall throughput ``` ## Completed Configuration Tables ### Q4_K_M MTP |config|runtime|requested_k|requested_v|actual_k|actual_v|rows|wall_tps_mean|wall_tps_sem|decode_tps_mean|draft_accept_rate|pred_tokens| |---|---|---|---|---|---|---|---|---|---|---|---| |q4_k_m_mtp_clean_q8_q8_ctx64k_moe30|clean|q8_0|q8_0|q8_0|q8_0|210|45.554|0.464|49.700|0.986|82229| |q4_k_m_mtp_quins_q8_q8_ctx64k_moe30|quins|q8_0|q8_0|q8_0|q8_0|210|62.345|0.608|69.385|0.721|82531| |q4_k_m_mtp_quins_q8_turbo3_ctx64k_moe30|quins|q8_0|turbo3|q8_0|turbo3|210|61.890|0.601|68.823|0.714|81332| |q4_k_m_mtp_quins_q8_turbo4_ctx64k_moe30|quins|q8_0|turbo4|q8_0|turbo4|210|62.241|0.597|68.765|0.717|83962| |q4_k_m_mtp_quins_turbo3_turbo3_ctx64k_moe30|quins|turbo3|turbo3|q8_0|turbo3|210|61.775|0.603|68.728|0.714|81332| |q4_k_m_mtp_atomic_q8_q8_ctx64k_moe30|atomic|q8_0|q8_0|q8_0|q8_0|210|52.547|1.054|60.003|0.774|79631| |q4_k_m_mtp_atomic_q8_turbo3_ctx64k_moe30|atomic|q8_0|turbo3|q8_0|turbo3|210|52.075|1.094|60.941|0.770|76573| ### IQ3_XXS MTP |config|runtime|requested_k|requested_v|actual_k|actual_v|rows|wall_tps_mean|wall_tps_sem|decode_tps_mean|draft_accept_rate|pred_tokens| |---|---|---|---|---|---|---|---|---|---|---|---| |iq3_xxs_mtp_clean_q8_q8_ctx64k_moe30|clean|q8_0|q8_0|q8_0|q8_0|210|42.204|0.416|45.139|0.986|86189| |iq3_xxs_mtp_quins_q8_q8_ctx64k_moe30|quins|q8_0|q8_0|q8_0|q8_0|210|53.311|0.504|58.014|0.718|84720| |iq3_xxs_mtp_quins_q8_turbo3_ctx64k_moe30|quins|q8_0|turbo3|q8_0|turbo3|210|49.616|0.457|53.623|0.716|90122| |iq3_xxs_mtp_quins_q8_turbo4_ctx64k_moe30|quins|q8_0|turbo4|q8_0|turbo4|210|48.286|0.446|52.505|0.720|86618| |iq3_xxs_mtp_quins_turbo3_turbo3_ctx64k_moe30|quins|turbo3|turbo3|q8_0|turbo3|210|51.746|0.466|55.966|0.716|90122| ## Exclusions and Data Hygiene |item|reason| |---|---| |Atomic q8/turbo4 and later fork rows|Interrupted by user request to wrap up; partial rows were excluded from publication tables.| |Long decode curve claims|Synthetic 10k input prompt tokenized to about 22.9k tokens in one runtime; long rows are not comparable to the intended 10k-in condition.| |Clean runtime Turbo KV rows|Not executable: clean MTP llama.cpp help does not expose turbo3/turbo4 cache types.| |TheTom and local TQ3 rows|Capability probe found Turbo KV but no Qwen MTP/NextN spec mode, so they are excluded from MTP runtime claims.| Unsupported clean-runtime Turbo rows: |config|requested_k|requested_v|skip_reason| |---|---|---|---| |q4_k_m_mtp_clean_q8_turbo3_ctx64k_moe30|q8_0|turbo3|unsupported by runtime help: V cache turbo3| |q4_k_m_mtp_clean_q8_turbo4_ctx64k_moe30|q8_0|turbo4|unsupported by runtime help: V cache turbo4| |q4_k_m_mtp_clean_turbo3_turbo3_ctx64k_moe30|turbo3|turbo3|unsupported by runtime help: K cache turbo3, V cache turbo3| |iq3_xxs_mtp_clean_q8_turbo3_ctx64k_moe30|q8_0|turbo3|unsupported by runtime help: V cache turbo3| |iq3_xxs_mtp_clean_q8_turbo4_ctx64k_moe30|q8_0|turbo4|unsupported by runtime help: V cache turbo4| |iq3_xxs_mtp_clean_turbo3_turbo3_ctx64k_moe30|turbo3|turbo3|unsupported by runtime help: K cache turbo3, V cache turbo3| ## Files - `README.md`: Hugging Face-style analysis card - `index.html`: richer visual report - `analysis/mtp-runtime-code-comparison.md`: code-level teaching appendix comparing the Quins and clean MTP paths - `analysis/high-level-analysis-and-tweet-thread.md`: high-level finding summary and tweet-thread draft - `analysis/workload-scope-and-relevance.md`: prompt shape, request count, and real-world relevance notes - `data/curated_summary.csv`: completed and unsupported configuration summaries - `data/curated_paired_comparisons.csv`: paired statistical comparisons - `data/curated_exclusions.csv`: excluded rows and rationale - `data/curated_results.json`: JSON bundle of curated results - `assets/*.png`: charts used in the Hugging Face report - `assets/*.svg`: source SVG versions retained for local inspection ## Limitations - Results are hardware-specific and should not be generalized without rerunning on other GPUs. - Host RAM was configured at 5,200 MT/s. Faster RAM could theoretically improve MoE-offloaded configurations, but this was not tested directly. - The long-output curve was excluded because the synthetic “10k input” prompt tokenized to approximately 22.9k tokens in one runtime, making it unsuitable for the intended 10k-in/10k-out claim. - Atomic q8/turbo4 and later fork rows were interrupted by the wrap-up request and are excluded from publication tables. - Quality scoring here is lightweight and should be treated as a sanity gate, not a full human or benchmark evaluation. ## Exploratory Long-Output Decode Curves The primary report excludes long-output claims because the synthetic prompt did not reliably match the intended 10k-input condition and some generations stopped early. The underlying streaming increment data is still included as an exploratory appendix for qualitative inspection only. ![Exploratory cumulative TPS by output-token mark](assets/exploratory_long_cumulative_tps.png) ![Exploratory interval TPS by 1k output segment](assets/exploratory_long_interval_tps_bars.png) Data files: - `data/exploratory_long_decode_curve.csv`: aggregated cumulative and interval TPS by config and 1k-token mark. - `data/exploratory_long_decode_curve_raw.csv`: raw per-stream 1k-token marks.