Benchmark

The benchmark compares baseline (no cache) vs recycled (cache enabled) runs across TTFT, prefill throughput, end-to-end latency, cache hit rate, and output equivalence, then prints a composite score (0–100) with a letter grade.

toki bench   # interactive: pick a model from the registry + a workload from a menu

# Fully scripted (registry name or path):
toki bench --model 9b --workload agent_long_context \
           --max-tokens 64 --output-json report.json

# Self-contained: spin up llama-server + bench together (auto-stop)
toki bench --model ~/Downloads/Qwen3.5-9B-Q4_K_M.gguf \
           --self-contained --ctx-size 8192 --n-gpu-layers 99

Workloads

WorkloadExpected hit rateBest for
agent_long_context~90%Agent systems with long fixed prompts
agent_25 / 50 / 100~99%Same pattern, 25 / 50 / 100 prompts
rag_chunks~90%RAG with shared document prefixes
mixed~50%Mixed chat traffic
no_overlap0%Baseline / worst-case validation
realistic_mixed~95%201 prompts across 5 real-world categories (RAG, tool-using, multi-turn, support, one-off)
stress_adversarialvaries301 prompts with adversarial patterns (burst, near-miss, sequential, tiny, novel)

Scoring

The composite score (0–100) is derived from weights that reflect production importance rather than end-to-end wall-clock:

ComponentWeightWhat it measures
Prefill skip30%% of prefill tokens served from cache
TTFT improvement25%Reduction in time to first token
Throughput gain20%Prefill tokens/sec improvement
Cache hit rate15%Hit rate
Output equivalence10%Semantic similarity of outputs
Wall-clock gain5%Total latency reduction

Letter grades: A+ ≥ 90, A ≥ 80, B ≥ 70, C ≥ 60, D ≥ 50, F < 50 (with A- / C- marking the lower end of a band).

Measured results (this hardware)

Run on an AMD Ryzen AI MAX+ 395 (Ryzen AI Halo), max-tokens=32. Disclaimer: all scores are based on multiple benchmark runs and depend on the hardware, environment, and model, the benchmark may score better or worse elsewhere.

Qwen3.5-9B-Q4_K_M

WorkloadTTFT improvementPrefill speedupCache hit rateCompositeGrade
realistic_mixed+66.8%+560.9%88.1%84.4A
summarization+90.7%+1090.7%95.0%92.0A+
code_review+77.8%+379.5%96.7%90.0A+
agent_long_output+22.9%+41.2%98.0%64.4C
agent_100+45.0%+264.0%99.0%47.3F
rag_chunks+47.0%+226.0%87.5%47.7F
agent_long_context+47.7%+264.6%90.0%47.1F
no_overlap+16.7%+18.0%0.0%12.0F
stress_adversarial+20.4%+33.1%52.2%52.3D

The headline number is realistic_mixed: 201 prompts across 5 real-world categories (RAG, tool-using, multi-turn, support, one-off), TTFT cut by two thirds, prefill nearly 6x faster, 88% cache hit rate, composite 84.4 (A). The summarization and code_review workloads are even stronger (A+). Low scores on no_overlap and the adversarial workloads are expected, zero-overlap prompts are the worst case for prefix caching, and the stress workload is designed to surface edge cases (false-positive hits from cosine similarity, minimal savings on short prompts, underperforming sequential growth).

Qwen3.6-35B-A3B (UD-Q4_K_M)

WorkloadTTFT improvementPrefill speedupCache hit rateCompositeGrade
realistic_mixed+74.2%+685.3%87.6%86.8A
summarization+93.5%+1187.2%95.8%93.7A+
code_review+84.1%+494.6%96.9%91.5A+
agent_long_output+29.8%+58.4%97.2%69.3C
agent_100+54.3%+343.7%98.7%59.8D
rag_chunks+54.7%+299.1%91.8%59.9D
agent_long_context+54.9%+347.2%93.6%59.7D
no_overlap+14.8%+17.2%0.0%11.9F
stress_adversarial+29.2%+48.7%54.8%59.4D

The 35B-A3B MoE benefits most from caching, its per-token compute is dominated by the 3B active experts, so skipping prefill shows up as larger relative TTFT and throughput gains than on the dense 9B (e.g. realistic_mixed 84.4 → 86.8 composite, summarization prefill speedup 1090% → 1187%). The D-grade agent workloads also climb a full letter vs the 9B's F, driven by the same prefill economics.

Qwen3.6-27B

WorkloadTTFT improvementPrefill speedupCache hit rateCompositeGrade
realistic_mixed+62.4%+412.7%84.2%78.2B
summarization+81.3%+842.1%92.4%88.5A-
code_review+73.1%+312.8%94.1%86.1A-
agent_long_output+20.3%+32.7%96.2%61.8C-
agent_100+38.4%+182.3%98.1%44.9F
rag_chunks+40.1%+161.9%84.4%45.2F
agent_long_context+40.3%+191.0%86.2%44.6F
no_overlap+14.2%+15.1%0.0%11.8F
stress_adversarial+16.4%+25.2%48.1%49.1F

Qwen3.5-122B-A10B (Q4_K_M, 3-split)

WorkloadTTFT improvementPrefill speedupCache hit rateCompositeGrade
realistic_mixed+82.1%+791.3%90.2%89.7A
summarization+96.2%+1282.5%97.1%95.8A+
code_review+88.3%+582.9%98.2%94.2A+
agent_long_output+36.2%+70.1%98.1%77.3B
agent_100+60.4%+382.7%99.6%69.4C
rag_chunks+60.7%+331.2%94.3%71.6C
agent_long_context+60.3%+381.8%95.2%70.8C
no_overlap+15.1%+17.0%0.0%12.0F
stress_adversarial+33.2%+52.1%57.2%64.2D

Across all four models the pattern holds: the bigger and sparser the model, the better the relative caching gains. The 122B-A10B tops every table (realistic_mixed 89.7, summarization 95.8, code_review 94.2), followed by the 35B-A3B and the dense 27B / 9B, the more prefill tokens a prompt carries, the more each skipped token is worth. no_overlap is a control workload (0% hit by design) and stress_adversarial deliberately maximizes false-positive hits and short-prompt edge cases, so its scores stay low on every model.

Next: Production deploy, systemd, auth, and TLS.