Parser Transitions Already Reveal Structural Responsibility: KV Persistence for Structured Generation
Organizations: Hangzhou Institute for Advanced Study, University of Chinese Academy of Sciences, Hangzhou, China
Abstract
LLM agents use structured generation for JSON, SQL, and function calls. Constrained decoding ensures valid formats, but KV compression can discard history needed for correct function and argument selection. Structural responsibility can diverge from model saliency: importance scores can overlook generated tokens' structural roles. Parser transitions already computed for legality encode these roles, including required arguments and structural boundaries, providing a free retention signal. We introduce PASK (Parser-Aware Structural KV Persistence), which reuses this signal for KV persistence by layer group without online importance estimation. Task-error sensitivity sets protection floors, while attention-output distortion ranks upgrades under the remaining budget. Offline calibration produces a frozen table for structural lookup and budget accounting. PASK outperforms budget-controlled baselines on function calling and text-to-SQL, improving BFCL accuracy by up to 8.67 pp over the strongest comparator. Against Full KV, it cuts peak GPU memory by 47.5 percent and achieves up to 3.3 times TPOT speedup.
Figures & tables
| Model | Method | BFCL non-live | BFCL live | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Simple | Multiple | Parallel | Par.-multiple | Overall | Simple | Multiple | Parallel | Par.-multiple | Overall | ||
| Qwen3-4B | Full KV | 95.00 | 95.00 | 90.00 | 84.17 | 91.83 | 78.57 | 74.57 | 60.00 | 78.57 | 75.22 |
| H2O \venuebox NeurIPS 2023 | 75.83 | 81.67 | 31.67 | 19.17 | 56.83 | 45.45 | 48.18 | 0.00 | 21.43 | 46.61 | |
| SnapKV \venuebox NeurIPS 2024 | 85.00 | 87.50 | 42.50 | 35.00 | 67.00 | 55.19 | 59.08 | 0.00 | 14.29 | 56.84 | |
| MiKV \venuebox arXiv 2024 | 87.50 | 90.83 | 64.45 | 30.00 | |||||||
| RocketKV \venuebox ICML 2025 | 75.42 | 65.83 | 33.33 | 25.00 | 55.00 | 48.05 | 47.24 | 0.00 | 46.49 | ||
| Method | KV budget | ||||
|---|---|---|---|---|---|
| 100% | 60% | 50% | 40% | 27.5% | |
| H2O | 56.28 | 41.10 | 35.51 | 32.55 | 24.08 |
| SnapKV | 56.28 | 49.83 | 46.77 | 44.24 | 36.56 |
| MiKV | 56.28 | 54.01 | 52.27 | 50.26 | 48.25 |
| RocketKV | 56.28 | 54.36 | 50.09 | 41.10 | |
| CriticalKV | 56.28 | 50.96 | 44.68 | 41.80 | 37.52 |
| Method | NVIDIA L40S | NVIDIA A100 | ||
|---|---|---|---|---|
| Peak (MiB) | Saving | Peak (MiB) | Saving | |
| Full KV | 40986 | — | 41008 | — |
| SnapKV | 25090 | 38.78% | 25086 | 38.83% |
| RocketKV | 24976 | 39.06% | 24976 | 39.09% |
| CriticalKV | 24976 | 39.06% | 24978 | 39.09% |
| PASK (Ours) | 21528 | 47.47% | 21536 | 47.48% |
| Method | Qwen3-4B | Qwen3-14B | LLaMA-3.1-8B | |
|---|---|---|---|---|
| Live | non-Live | non-Live | ||
| 0.33 | Best baseline | 63.87 | 80.17 | 82.83 |
| PASK (trans) | 69.67 | 88.67 | 87.33 | |
| PASK (recalib) | 72.01 | 88.83 | 91.17 | |
| 0.50 | Best baseline | 71.76 | 85.33 | 84.17 |
| PASK (trans) | 73.98 | 90.83 | 89.50 |
Appendix figures & tables16 assets
Supplementary material from the paper’s appendix.
Appendix
| Component | Function calling (BFCL) | Text-to-SQL (BIRD) |
|---|---|---|
| Class | pure_scaffold , schema_bearing , free_generation | pure_scaffold , schema_bearing , free_generation |
| Role | scaffold_separator , required , optional , dispatch_key | projection , relation , predicate , outside_schema |
| State | boundary , critical | stable , boundary , critical |
| Next | lookahead_critical , no_lookahead | lookahead_critical , no_lookahead |
| Semantic label | Assignment rule |
|---|---|
| Protected content | Prompt text outside validated schema spans: instructions, requests, and chat context. |
| Schema scaffold | JSON/DDL structure and unmatched tokens within validated schema spans. |
| Function name | BFCL tool/function names; BIRD table identifiers. |
| Parameter key | BFCL property names and required entries; BIRD column identifiers. |
| Type constraint | BFCL type values; BIRD declared column types. |
| Enum constraint | BFCL enum values; recognized BIRD constraints, e.g., PRIMARY KEY , REFERENCES , and NOT NULL . |
| Benchmark | Subset | Cases | Test | Description |
| BFCL non-live (cases 1,000) | Simple | 400 | 240 | A single tool call matching one target function schema. |
| Multiple | 200 | 120 | One tool call selected among several candidate functions. | |
| Parallel | 200 | 120 | Several independent tool calls emitted in a single response. | |
| Parallel-multiple | 200 | 120 | Several calls drawn from several candidate functions. | |
| All subsets | 1,000 | 600 | 200 calibration and 200 development cases. | |
| BFCL Live (cases 1,351) | Simple | 258 | 154 | Real-user queries with a single tool call. |
| Baseline | Representative tuned knobs | Candidate values |
|---|---|---|
| H2O | Sink size; recent window | Sink ; recent window . |
| SnapKV | Observation window; pooling; pooling kernel | Observation window ; pooling ; kernel . |
| MiKV | High-precision ratio; low-bit width; group size | High-precision ratio ; low-bit width ; group size . |
| RocketKV | Observation window; pooling kernel; prefill ratio | Observation window ; kernel ; prefill ratio . |
| CriticalKV | First-stage ratio; stabilizer ; scorer window | First-stage ratio ; ; scorer window . |
| LazyEviction | Observation/recent window; attention threshold | Observation/recent window ; . |
| Method | B | BFCL non-live | BFCL live | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Simple | Multiple | Parallel | Par.-multiple | Overall | Simple | Multiple | Parallel | Par.-multiple | Overall | ||
| Full KV | 1.00 | 95.00 | 95.00 | 90.00 | 84.17 | 91.83 | 78.57 | 74.57 | 60.00 | 78.57 | 75.22 |
| H2O | 0.33 | 75.83 | 81.67 | 31.67 | 19.17 | 56.83 | 45.45 | 48.18 | 0.00 | 21.43 | 46.61 |
| SnapKV | 0.33 | 85.00 | 87.50 | 42.50 | 35.00 | 67.00 | 55.19 | 59.08 | 0.00 | 14.29 | 56.84 |
| MiKV | 0.33 | 87.50 | 90.83 | 76.67 | 76.67 | 83.83 | 64.94 | 64.45 | 30.00 | 50.00 | 63.87 |
| RocketKV | 0.33 | 75.42 | 65.83 | 33.33 | 25.00 | 55.00 | 48.05 | 47.24 | 0.00 | 28.57 | 46.49 |
| Method | B | BFCL non-live | BFCL live | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Simple | Multiple | Parallel | Par.-multiple | Overall | Simple | Multiple | Parallel | Par.-multiple | Overall | ||
| Full KV | 1.00 | 96.25 | 98.33 | 92.50 | 81.67 | 93.00 | 79.87 | 75.20 | 70.00 | 64.29 | 75.83 |
| H2O | 0.33 | 72.08 | 85.00 | 22.50 | 16.67 | 53.67 | 54.55 | 51.82 | 0.00 | 0.00 | 50.80 |
| SnapKV | 0.33 | 82.50 | 91.67 | 60.00 | 55.83 | 74.50 | 61.69 | 66.98 | 0.00 | 14.29 | 64.24 |
| MiKV | 0.33 | 83.75 | 88.33 | 79.17 | 65.83 | 80.17 | 66.23 | 63.03 | 40.00 | 42.86 | 63.01 |
| RocketKV | 0.33 | 78.33 | 90.00 | 30.00 | 41.67 | 63.67 | 55.19 | 55.13 | 30.00 | 42.86 | 54.62 |
| Method | B | BFCL non-live | BFCL live | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Simple | Multiple | Parallel | Par.-multiple | Overall | Simple | Multiple | Parallel | Par.-multiple | Overall | ||
| Full KV | 1.00 | 94.58 | 95.00 | 91.67 | 80.83 | 91.33 | 75.32 | 60.98 | 40.00 | 57.14 | 63.38 |
| H2O | 0.33 | 75.42 | 90.00 | 15.83 | 12.50 | 53.83 | 46.75 | 36.65 | 0.00 | 14.29 | 37.73 |
| SnapKV | 0.33 | 87.92 | 94.17 | 43.33 | 35.00 | 69.67 | 51.30 | 53.55 | 10.00 | 35.71 | 52.28 |
| MiKV | 0.33 | 91.67 | 95.00 | 66.67 | 51.67 | 79.33 | 64.94 | 48.50 | 20.00 | 28.57 | 50.92 |
| RocketKV | 0.33 | 82.92 | 90.83 | 25.00 | 21.67 | 60.67 | 51.30 | 47.39 | 0.00 | 21.43 | 47.10 |
| Method | Budget | Simple EX | Moderate EX | Challenging EX | Overall EX |
|---|---|---|---|---|---|
| Full KV | 1.000 | 62.77 | 46.67 | 44.35 | 56.28 |
| H2O | 0.275 | 32.81 | 10.61 | 9.57 | 24.08 |
| SnapKV | 0.275 | 44.79 | 25.15 | 19.13 | 36.56 |
| MiKV | 0.275 | 55.63 | 37.27 | 34.78 | 48.25 |
| RocketKV | 0.275 | 50.36 | 29.70 | 17.39 | 41.10 |
| CriticalKV | 0.275 | 45.22 | 28.18 | 17.39 | 37.52 |
| Input / Output | Method | NVIDIA A100 | NVIDIA L40S | ||
|---|---|---|---|---|---|
| TPOT (ms) | Throughput (T/S) | TPOT (ms) | Throughput (T/S) | ||
| 8k / 256 | Full KV | ||||
| SnapKV | |||||
| RocketKV | |||||
| CriticalKV | |||||
| PASK (Ours) | |||||
| GPU | Input | Throughput (tokens/s) | TPOT (ms) | |||||
|---|---|---|---|---|---|---|---|---|
| Full KV | PASK | SnapKV | Full KV | PASK | SnapKV | |||
| A100 | 32K | 8 | ||||||
| A100 | 32K | 16 | ||||||
| A100 | 32K | 32 | ||||||
| L40S | 32K | 8 | ||||||
| L40S | 32K | 16 | ||||||
| Runtime-V | Runtime-D | |
|---|---|---|
| All-high control | 220.4 s | 260.5 s |
| Candidate time, median | 218.8 s | 222.1 s |
| Candidate time, p90 | 221.1 s | 226.5 s |
| GPU util, mean / peak | 62% / 100% | |
| Peak memory | 75.8 GiB | |
| Full 54-candidate scan | 1.64 h | 1.67 h |
| Action | Model-side score | Recall @20% | Mismatch 20,50 |
|---|---|---|---|
| Release | |||
| Retain-low |
| Variant | Prefill policy | Decode policy | Total | BFCL non-live Acc. | ||
|---|---|---|---|---|---|---|
| Full KV | Full | Full | 1.000 | 1.000 | 1.000 | 93.00 |
| Prefill-only | PASK | Full | 0.250 | 1.000 | 0.489 | 91.17 |
| Decode-only | Full | PASK | 1.000 | 0.501 | 0.841 | 90.67 |
| Combined PASK | PASK | PASK | 0.250 | 0.501 | 0.330 | 88.83 |
KV-Cache Compression
Key-value cache compression reduces the memory and bandwidth needed to retain attention states during long-context inference.
See all 269 papers