Publish dataset (card cleaned, authored by Nathan Maine)
Browse files- CORRECTION-NOTICE.md +60 -0
- README.md +148 -0
- data/benchmark_results.csv +14 -0
- data/benchmark_results_v3_complete.csv +19 -0
- results/cache_type_compatibility.md +23 -0
CORRECTION-NOTICE.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Correction Notice — KV Cache Benchmark v3
|
| 2 |
+
|
| 3 |
+
**Date:** 2026-04-01
|
| 4 |
+
**Original publication:** 2026-03-31
|
| 5 |
+
**Status:** Correcting methodology and findings
|
| 6 |
+
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
## What Changed
|
| 10 |
+
|
| 11 |
+
### Finding 2 (Memory "Paradox") — RETRACTED
|
| 12 |
+
|
| 13 |
+
**Original claim:** "q4_0 uses MORE memory than f16 on unified memory (+6%)"
|
| 14 |
+
**Methodology used:** Process RSS via `ps`
|
| 15 |
+
**Problem:** RSS measures CPU-side process memory, not GPU/unified memory allocations. On GB10 unified memory, KV cache allocations are not visible in RSS.
|
| 16 |
+
|
| 17 |
+
**Corrected measurement (nvidia-smi + llama.cpp internals):**
|
| 18 |
+
|
| 19 |
+
| Cache Type | KV Buffer (llama.cpp) | Total GPU (nvidia-smi) | vs f16 |
|
| 20 |
+
|-----------|----------------------|----------------------|--------|
|
| 21 |
+
| f16 | 768 MiB | 23,092 MiB | baseline |
|
| 22 |
+
| q8_0 | 408 MiB | 22,732 MiB | **-360 MiB (saves 47%)** |
|
| 23 |
+
| q4_0 | 216 MiB | 22,540 MiB | **-552 MiB (saves 72%)** |
|
| 24 |
+
|
| 25 |
+
**Conclusion:** KV cache quantization DOES save memory on GB10, as expected. The "paradox" was a measurement error.
|
| 26 |
+
|
| 27 |
+
### Finding 1 (Speed Cliff) — RETRACTED
|
| 28 |
+
|
| 29 |
+
**Original claim:** "92.5% prompt throughput collapse at 64K with q4_0"
|
| 30 |
+
**Corrected finding:** No prompt throughput cliff exists. q4_0 prompt processing is essentially identical to f16 at all context lengths including 110K tokens.
|
| 31 |
+
|
| 32 |
+
**What actually happens:** Generation (decode) throughput degrades ~37% at 110K context with q4_0 vs f16. This is a real effect but it is generation speed, not prompt processing, and it is 37% not 92.5%.
|
| 33 |
+
|
| 34 |
+
**Corrected throughput data (full range):**
|
| 35 |
+
|
| 36 |
+
| Context | f16 prompt | q8_0 prompt | q4_0 prompt | f16 gen | q8_0 gen | q4_0 gen |
|
| 37 |
+
|---------|-----------|-------------|-------------|---------|---------|---------|
|
| 38 |
+
| ~1.5K | 923 | 925 | 926 | 45.2 | 45.3 | 45.6 |
|
| 39 |
+
| ~6K | 1,211 | 1,207 | 1,206 | 44.7 | 44.9 | 45.0 |
|
| 40 |
+
| ~12K | 1,188 | 1,184 | 1,191 | 44.9 | 42.9 | 42.7 |
|
| 41 |
+
| ~24K | 1,153 | 1,149 | 1,152 | 44.6 | 39.7 | 39.3 |
|
| 42 |
+
| **~110K** | **815** | **810** | **813** | **38.0** | **25.0** | **24.0** |
|
| 43 |
+
|
| 44 |
+
The original 92.5% collapse was likely caused by failed completion requests returning error data, not actual throughput measurements.
|
| 45 |
+
|
| 46 |
+
### Finding 3 (q8_0 Sweet Spot) — PARTIALLY VALID
|
| 47 |
+
|
| 48 |
+
q8_0 does offer genuine KV buffer savings (47%) with minimal throughput impact at short-to-medium context. The generation speed degradation at 24K (~10%) needs further investigation at longer contexts.
|
| 49 |
+
|
| 50 |
+
---
|
| 51 |
+
|
| 52 |
+
## Root Cause of Original Errors
|
| 53 |
+
|
| 54 |
+
1. **RSS is the wrong metric** for KV cache on unified memory. RSS reflects CPU-side process allocations, not GPU-side unified memory usage.
|
| 55 |
+
2. **nvidia-smi + llama.cpp verbose output** provide the correct measurements.
|
| 56 |
+
3. **The original benchmark did not verify that completions actually succeeded** — some data points may have been from failed requests.
|
| 57 |
+
|
| 58 |
+
## Credit
|
| 59 |
+
|
| 60 |
+
Community feedback from u/audioen on r/LocalLLaMA identified the RSS measurement flaw. Their critique was correct.
|
README.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
tags:
|
| 6 |
+
- kv-cache
|
| 7 |
+
- quantization
|
| 8 |
+
- llama.cpp
|
| 9 |
+
- nvidia
|
| 10 |
+
- dgx-spark
|
| 11 |
+
- gb10
|
| 12 |
+
- benchmarking
|
| 13 |
+
- inference
|
| 14 |
+
pretty_name: DGX Spark GB10 KV Cache Quantization Benchmark
|
| 15 |
+
size_categories:
|
| 16 |
+
- n<1K
|
| 17 |
+
task_categories:
|
| 18 |
+
- other
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# KV Cache Quantization on NVIDIA DGX Spark GB10
|
| 22 |
+
|
| 23 |
+
> **Corrected benchmarks** (v3, April 2026) — KV cache quantization behavior on the NVIDIA DGX Spark's GB10 Grace Blackwell unified memory architecture.
|
| 24 |
+
|
| 25 |
+
**Author:** Nathan Maine
|
| 26 |
+
**Date:** March 2026, corrected April 2026
|
| 27 |
+
**Hardware:** NVIDIA DGX Spark (GB10, compute 12.1, 128GB unified memory)
|
| 28 |
+
|
| 29 |
+
> **Correction Notice:** The original v1 benchmarks (March 31) contained methodology errors. Memory was measured via RSS (wrong on unified memory) and some throughput data came from failed requests. v3 uses nvidia-smi + llama.cpp internal reporting. See [CORRECTION-NOTICE.md](CORRECTION-NOTICE.md) for full details. Credit to u/audioen on r/LocalLLaMA for identifying the RSS measurement flaw.
|
| 30 |
+
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
## TL;DR
|
| 34 |
+
|
| 35 |
+
KV cache quantization on DGX Spark GB10 works as expected:
|
| 36 |
+
|
| 37 |
+
- **q4_0 saves 72% KV buffer memory** (216 MiB vs 768 MiB for f16)
|
| 38 |
+
- **q8_0 saves 47% KV buffer memory** (408 MiB vs 768 MiB for f16)
|
| 39 |
+
- **Prompt throughput is unaffected** by cache quantization at all context lengths
|
| 40 |
+
- **Generation throughput degrades ~37%** at 110K context with q4_0 (24 tps vs 38 tps for f16)
|
| 41 |
+
|
| 42 |
+
---
|
| 43 |
+
|
| 44 |
+
## Memory (Corrected — nvidia-smi + llama.cpp internals)
|
| 45 |
+
|
| 46 |
+
| Cache Type | KV Buffer (llama.cpp) | Total GPU (nvidia-smi) | Savings vs f16 |
|
| 47 |
+
|-----------|----------------------|----------------------|---------------|
|
| 48 |
+
| **f16** | 768 MiB | 23,092 MiB | baseline |
|
| 49 |
+
| **q8_0** | 408 MiB | 22,732 MiB | **-360 MiB (-47% KV)** |
|
| 50 |
+
| **q4_0** | 216 MiB | 22,540 MiB | **-552 MiB (-72% KV)** |
|
| 51 |
+
|
| 52 |
+
At 110K context:
|
| 53 |
+
|
| 54 |
+
| Cache Type | GPU Memory | vs f16 |
|
| 55 |
+
|-----------|-----------|--------|
|
| 56 |
+
| f16 | 23,116 MiB | baseline |
|
| 57 |
+
| q8_0 | 22,856 MiB | -260 MiB |
|
| 58 |
+
| q4_0 | 22,664 MiB | -452 MiB |
|
| 59 |
+
|
| 60 |
+
---
|
| 61 |
+
|
| 62 |
+
## Throughput
|
| 63 |
+
|
| 64 |
+
### Prompt Processing (tokens/sec) — No degradation
|
| 65 |
+
|
| 66 |
+
| Context | f16 | q8_0 | q4_0 |
|
| 67 |
+
|---------|-----|------|------|
|
| 68 |
+
| ~1.5K | 923 | 925 | 926 |
|
| 69 |
+
| ~6K | 1,211 | 1,207 | 1,206 |
|
| 70 |
+
| ~12K | 1,188 | 1,184 | 1,191 |
|
| 71 |
+
| ~24K | 1,153 | 1,149 | 1,152 |
|
| 72 |
+
| **~110K** | **815** | **810** | **813** |
|
| 73 |
+
|
| 74 |
+
Prompt throughput is essentially identical across all cache types at all context lengths.
|
| 75 |
+
|
| 76 |
+
### Generation (tokens/sec) — Degrades at long context
|
| 77 |
+
|
| 78 |
+
| Context | f16 | q8_0 | q4_0 | q4_0 vs f16 |
|
| 79 |
+
|---------|-----|------|------|------------|
|
| 80 |
+
| ~1.5K | 45.2 | 45.3 | 45.6 | +0.9% |
|
| 81 |
+
| ~6K | 44.7 | 44.9 | 45.0 | +0.7% |
|
| 82 |
+
| ~12K | 44.9 | 42.9 | 42.7 | -4.9% |
|
| 83 |
+
| ~24K | 44.6 | 39.7 | 39.3 | -11.9% |
|
| 84 |
+
| **~110K** | **38.0** | **25.0** | **24.0** | **-36.8%** |
|
| 85 |
+
|
| 86 |
+
Generation (decode) throughput degrades with quantized KV cache at long context. At 110K tokens, q4_0 is 37% slower than f16 for generation. q8_0 is similar at 34% slower.
|
| 87 |
+
|
| 88 |
+
---
|
| 89 |
+
|
| 90 |
+
## Test Setup
|
| 91 |
+
|
| 92 |
+
```
|
| 93 |
+
Model: Nemotron-3-Nano-30B-A3B-UD-Q4_K_XL.gguf
|
| 94 |
+
Hardware: NVIDIA DGX Spark GB10 (compute 12.1, 124,610 MiB VRAM)
|
| 95 |
+
OS: DGX OS / Ubuntu aarch64
|
| 96 |
+
llama.cpp: build 8399 (commit 892e3c333), aarch64 + CUDA
|
| 97 |
+
CUDA: 13.0 | Driver: 580.126.09
|
| 98 |
+
Flags: --ctx-size 131072
|
| 99 |
+
Protocol: Server restarted between each configuration
|
| 100 |
+
Memory: nvidia-smi --query-compute-apps for GPU memory
|
| 101 |
+
KV size: llama.cpp verbose output (llama_kv_cache line)
|
| 102 |
+
Throughput: llama.cpp response timings via /v1/chat/completions
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
---
|
| 106 |
+
|
| 107 |
+
## What Was Wrong in v1
|
| 108 |
+
|
| 109 |
+
The original paper (March 31) made two incorrect claims:
|
| 110 |
+
|
| 111 |
+
1. **"92.5% prompt throughput collapse at 64K"** — Wrong. Prompt throughput is unaffected by cache quantization. The original data likely came from failed completion requests. The actual effect is a 37% generation speed reduction at 110K context.
|
| 112 |
+
|
| 113 |
+
2. **"q4_0 uses MORE memory than f16"** — Wrong. This was measured via process RSS, which does not capture GPU/unified memory allocations on GB10. Actual measurement via nvidia-smi + llama.cpp shows q4_0 saves 552 MiB as expected.
|
| 114 |
+
|
| 115 |
+
See [CORRECTION-NOTICE.md](CORRECTION-NOTICE.md) for full methodology comparison.
|
| 116 |
+
|
| 117 |
+
---
|
| 118 |
+
|
| 119 |
+
## Actual Finding: Generation Decode Overhead
|
| 120 |
+
|
| 121 |
+
The real finding is more nuanced: **KV cache quantization saves memory as expected, but imposes a generation speed tax at long context.** At 110K tokens, q4_0 generation is 37% slower than f16 (24 vs 38 tps). This is likely due to dequantization overhead during the decode attention step, which processes the full KV cache for each generated token.
|
| 122 |
+
|
| 123 |
+
Prompt processing is unaffected because it processes all tokens in parallel — the dequantization cost is amortized across the batch.
|
| 124 |
+
|
| 125 |
+
This tradeoff may be acceptable depending on the use case:
|
| 126 |
+
- **Long-context RAG** (mostly prompt, few generated tokens): use q4_0, save memory
|
| 127 |
+
- **Long-form generation at long context**: use f16, preserve decode speed
|
| 128 |
+
|
| 129 |
+
---
|
| 130 |
+
|
| 131 |
+
## Raw Data
|
| 132 |
+
|
| 133 |
+
- [`data/benchmark_results_v3_complete.csv`](data/benchmark_results_v3_complete.csv) — corrected v3 data
|
| 134 |
+
- [`data/benchmark_results.csv`](data/benchmark_results.csv) — original v1 data (flawed, kept for reference)
|
| 135 |
+
|
| 136 |
+
---
|
| 137 |
+
|
| 138 |
+
## Citation
|
| 139 |
+
|
| 140 |
+
```bibtex
|
| 141 |
+
@techreport{maine2026kvcache,
|
| 142 |
+
title = {KV Cache Quantization on NVIDIA DGX Spark GB10},
|
| 143 |
+
author = {Maine, Nathan},
|
| 144 |
+
year = {2026},
|
| 145 |
+
note = {Corrected April 2026},
|
| 146 |
+
url = {https://huggingface.co/datasets/Nathan-Maine/dgx-spark-kv-cache-benchmark}
|
| 147 |
+
}
|
| 148 |
+
```
|
data/benchmark_results.csv
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
context_tokens,cache_type,prompt_tps,gen_tps,rss_gb,notes
|
| 2 |
+
3500,q8_0,30.5,14.2,,quick initial test
|
| 3 |
+
8192,f16,371.3,14.7,1.25,
|
| 4 |
+
8192,q8_0,,,1.34,speed not measured at this context
|
| 5 |
+
8192,q4_0,363.4,14.2,1.34,
|
| 6 |
+
16384,f16,360.7,13.9,1.40,
|
| 7 |
+
16384,q8_0,,,1.49,speed not measured at this context
|
| 8 |
+
16384,q4_0,346.2,12.7,1.49,
|
| 9 |
+
32768,f16,328.3,13.5,1.59,
|
| 10 |
+
32768,q8_0,,,1.69,speed not measured at this context
|
| 11 |
+
32768,q4_0,316.9,11.0,1.69,
|
| 12 |
+
65536,f16,282.7,13.3,1.94,
|
| 13 |
+
65536,q4_0,21.3,8.6,2.06,CLIFF — 92.5% prompt tps collapse
|
| 14 |
+
114688,q4_0,21.3,8.6,,f16 not testable at this context size
|
data/benchmark_results_v3_complete.csv
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
context_tokens,cache_type,kv_buffer_mib,gpu_mem_mib,prompt_tps,gen_tps,notes
|
| 2 |
+
0,f16,768,23092,,,"KV buffer from llama.cpp verbose, baseline GPU from nvidia-smi"
|
| 3 |
+
1493,f16,768,23114,923.2,45.2,
|
| 4 |
+
5916,f16,768,23116,1210.8,44.7,
|
| 5 |
+
11814,f16,768,23116,1187.8,44.9,
|
| 6 |
+
23610,f16,768,23116,1153.4,44.6,
|
| 7 |
+
110019,f16,768,23116,815.0,38.0,64K+ context
|
| 8 |
+
0,q8_0,408,22732,,,"47% smaller KV buffer vs f16"
|
| 9 |
+
1493,q8_0,408,22754,925.1,45.3,
|
| 10 |
+
5916,q8_0,408,22756,1206.7,44.9,
|
| 11 |
+
11814,q8_0,408,22762,1183.9,42.9,
|
| 12 |
+
23610,q8_0,408,22774,1149.1,39.7,
|
| 13 |
+
110019,q8_0,408,22856,810.2,25.0,64K+ context — gen speed degraded 34%
|
| 14 |
+
0,q4_0,216,22540,,,"72% smaller KV buffer vs f16"
|
| 15 |
+
1493,q4_0,216,22562,925.7,45.6,
|
| 16 |
+
5916,q4_0,216,22564,1205.8,45.0,
|
| 17 |
+
11814,q4_0,216,22570,1191.2,42.7,
|
| 18 |
+
23610,q4_0,216,22582,1151.9,39.3,
|
| 19 |
+
110019,q4_0,216,22664,812.6,24.0,64K+ context — gen speed degraded 37%
|
results/cache_type_compatibility.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Cache Type Compatibility on DGX Spark GB10
|
| 2 |
+
|
| 3 |
+
## Supported Types (from --help, llama.cpp build 8399, aarch64+CUDA)
|
| 4 |
+
|
| 5 |
+
```
|
| 6 |
+
--cache-type-k: f32, f16, bf16, q8_0, q4_0, q4_1, iq4_nl, q5_0, q5_1
|
| 7 |
+
--cache-type-v: f32, f16, bf16, q8_0, q4_0, q4_1, iq4_nl, q5_0, q5_1
|
| 8 |
+
Default: f16 for both K and V
|
| 9 |
+
```
|
| 10 |
+
|
| 11 |
+
## Test Results
|
| 12 |
+
|
| 13 |
+
| Format | Loads | Long-ctx safe | Memory benefit | Recommended |
|
| 14 |
+
|--------|-------|--------------|----------------|-------------|
|
| 15 |
+
| f16 | ✅ | ✅ | Baseline | ✅ Default |
|
| 16 |
+
| q8_0 | ✅ | ✅ | None (paradox) | ✅ Long context |
|
| 17 |
+
| q4_0 | ✅ | ❌ cliff at 64K | Negative (+6%) | ❌ Avoid |
|
| 18 |
+
| q4_1 | untested | unknown | unknown | — |
|
| 19 |
+
| iq4_nl | untested | unknown | unknown | — |
|
| 20 |
+
| q5_0 | untested | unknown | unknown | — |
|
| 21 |
+
| q5_1 | untested | unknown | unknown | — |
|
| 22 |
+
| bf16 | untested | unknown | unknown | — |
|
| 23 |
+
| f32 | untested | unknown | unknown | — |
|