Query-Oblivious Coresets for Softmax Attention: Improved Bounds and Efficient Constructions
Organizations: Tel Aviv University.
Abstract
A query-oblivious coreset for a softmax-attention head is a subset of the key-value pairs whose attention output is within of the full one for every query in a ball. Liberty, Andoni and Kleiner proved that unweighted coresets of size exist, the query radius times the centred key radius, against a lower bound , and conjectured that closing the gap needs new techniques. It does not: a spherical lift of both balls into one exponential-kernel instance lets the Bozzai-Rothvoss chaining bound apply, and Chevet's inequality splits key from value dimension, giving coresets of size in randomised polynomial time, the first constructive whole-ball guarantee within of the lower bound. A sampling cap completes the envelope; in fixed dimension Tai's diameter-free bound removes the logarithm, settling the Gaussian-restriction case of a Bozzai-Rothvoss question for the kernels. We give theLiberty-Andoni-Kleiner lower boud transfer the one-waycommunication bounds of Chen et r is the price of one signing forall queries. A census of every head of Qwen2.5-7B-Instruct and Llama-3-8B-Instruct finds at least 23.877, so everyactor prescribes a coreset larger than the cache: the algorithmic contribution is asymptotic on these models.
Figures & tables
| Device | Source |
|---|---|
| Tensor lift , centring invariance, balanced rescaling | [ 21 , Lem. 16] ; [ 22 , App. B.5] ; [ 11 , §6.1.2] ; [ 30 ] |
| Halving; ratio split into numerator/denominator discrepancies | [ 13 , 28 ] ; [ 25 , Thm. 4] ; [ 22 , §2.2] ; [ 20 , Lem. B.1] |
| Scalar spherical exponential-kernel discrepancy | [ 9 , Thm. 1.11] ; earlier [ 21 , Lem. 17] , [ 28 , Cor. 4.3] |
| Key/value split of the Gaussian width | Chevet [ 14 , 34 ] ; sphere case [ 33 , Thm. 1] |
| Gram–Schmidt walk in halving; Las Vegas rejection | [ 6 ] ; [ 28 , §2] ; [ 9 ] ; [ 32 , Alg. 1] |
| RKHS bounds (sampling and greedy); two-block form | [ 26 ] ; [ 21 , Thm. 24] ; [ 20 , Thm. 4.5] ; [ 36 ] |
| Regime | Best upper bound | Best lower bound | Gap |
|---|---|---|---|
| , , | ( 1.4 a, [ 25 ] ) | ||
| fixed, | only ( 1.4 a; its branch needs ) | unmatched from below | |
| scalar values; or | ( 1.4 a at ; 1.4 c) | whole factor | |
| , , scalar | , i.e. | ( 1.4 c) | |
| ( 1.4 b) | none for |
| median | median | fraction of heads | uncentred | ||||
| Model | max | p99 | max | p99 | median | ||
| Qwen2.5-7B-Instruct | 54.015 | 50.575 | 0% | 100% | 69.719 | ||
| Llama-3-8B-Instruct | 49.442 | 48.733 | 0% | 100% | 54.960 | ||
| median by layer quintile, shallowest to deepest | |||||||
| Model | first | second | third | fourth | fifth | ||
| Qwen2.5-7B-Instruct | 44.716 | 53.935 | 60.708 | 57.344 | 53.062 | ||
| real decoding queries | sphere of radius | |||||
| Method | ||||||
| Qwen2.5-7B-Instruct | ||||||
| Uniform sampling | 0.550 | 0.490 | 0.291 | 1.038 | 0.981 | 0.919 |
| BalanceKV | 0.575 | 0.453 | 0.300 | 1.050 | 0.989 | 0.902 |
| Kernel halving | 0.578 | 0.454 | 0.291 | 1.049 | 0.991 | 0.889 |
| Halving | 0.573 | 0.449 | 0.311 | 1.053 | 0.996 | 0.897 |
| Method | size | open | closed | closed/open | diverged | tracked | agreement |
| Qwen2.5-7B-Instruct | |||||||
| Uniform sampling | 0.582 | 0.567 | 0.984 | 54 of 54 | 4 | 0.09 | |
| BalanceKV | 0.645 | 0.634 | 1.006 | 54 of 54 | 4 | 0.08 | |
| Halving, re-centred subsample | 0.651 | 0.680 | 0.993 | 54 of 54 | 4 | 0.07 | |
| Heavy hitters (oracle) | 0.212 | 0.254 | 1.110 | 36 of 54 | 98 | 0.44 | |
| Uniform sampling | 0.506 | 0.494 | 1.000 | 45 of 54 | 38 | 0.20 | |
| fitted slope of against , and its range over seeds | ||||
|---|---|---|---|---|
| Keys | Method | |||
| Sphere, | Uniform sampling | 0.54 [0.40, 0.60] | 0.81 [0.76, 0.93] | 0.57 [0.40, 0.72] |
| Sphere, | Halving | 0.58 [0.32, 0.86] | 1.10 [0.98, 1.26] | 1.03 [0.82, 1.22] |
| Sphere, | Uniform sampling | 0.34 [0.31, 0.38] | 0.58 [0.54, 0.63] | 0.27 [0.25, 0.27] |
| Sphere, | Halving | 0.41 [0.35, 0.45] | 0.90 [0.86, 0.96] | 0.66 [0.57, 0.75] |
| Clustered, | Uniform sampling | 0.42 [0.31, 0.59] | 0.57 [0.45, 0.72] | 0.44 [0.32, 0.73] |
| size to reach : construction over uniform sampling | |||
| Configuration | |||
| Sphere, , | 0.11 | 0.13 | 0.15 |
| Sphere, , | 0.19 | 0.21 | 0.24 |
| Sphere, , | 0.14 | 0.21 | 0.33 |
| Sphere, , | 0.25 | 0.43 | 0.73 |
| Sphere, , | 0.26 | 0.43 | 1.02 |
| query-oblivious signing at | per-query greedy at | |||
| bound | walk, best of 8 seeds | worst of 8 seeds | ||
| 5.886 | 16.010 | 16.010 | 0.878 | |
| 11.772 | 32.005 | 32.005 | 0.813 | |
| 23.544 | 64.003 | 64.003 | 1.000 | |
| Rule, fixed in advance | Outcome | |
|---|---|---|
| E1 | If the median head satisfies at , the discrepancy branch is meaningful and E2 proceeds on the median heads. If most heads have , the results are reported as asymptotic, the abstract says so, and E2 runs on the low- tail. | Not meaningful at the median head on either model (yes/no: Qwen no, Llama no); on 100% and 100% of heads. Reported as asymptotic, in the abstract. E2 was run on all terciles (Section 7.3 ). |
| E2 | The construction should have lower worst-case error than uniform sampling at every size on every head, and the gap should widen with ; if it does not beat uniform sampling on the median heads, the constants of Section 4 dominate at these and the paper says so. | Not met: over all instances the construction beats uniform sampling in 273 of 540 cells on Qwen and 303 of 540 on Llama (both variants), and its halving variant in 64 of 140 and 76 of 125 after the near-hard-max exclusion; the ratio is flat across terciles. The constants dominate at these , and puts every bound above the cache. |
| E3 | Per-query methods degrade faster in the closed loop than in the open loop, and the uniform-guarantee construction degrades equally in both; the modelling argument of Section 2 loses its support if the two are indistinguishable. | The two differ in the median closed/open ratio on both models over the rows in which the closed loop diverged, a cut chosen after the results, with the oracle as the only query-aware method run: its ratio there is 1.121 (Qwen) and 1.086 (Llama), and 1.000 and 1.047 over all rows; the re-centred variant’s is 1.000 and 1.000. Consistent with the argument, with the ceiling caveat of Section 7.4 . |
| E4 | The size needed to reach should scale as : a log-linear fit of slope over for every method. | Met in 5 of 60 fits, and by the construction in 2 of 12; the largest fitted slope is 1.10. Not met as stated. |
Appendix figures & tables12 assets
Supplementary material from the paper’s appendix.
Appendix
| Run | GPU | hours |
|---|---|---|
| E1, Qwen | RTX 5090 | 0.4 |
| E1, Llama | RTX 5090 | 0.6 |
| E2, Qwen | RTX 3090 | 5.2 |
| E2, Llama | RTX 3090 | 6.2 |
| E3, Qwen | RTX 5090 | 0.4 |
| E3, Llama | RTX 5090 | 0.4 |
| Change | Stage | Reason | Effect | |
|---|---|---|---|---|
| 1 | E2 reports the two query populations as separate columns rather than one worst case over their union. | before run, after pilots not reported here | The sphere’s radius exceeds the real queries’ norms, so the union’s worst case was the sphere’s. | Rule read on the real column; sphere reported beside it. |
| 2 | E1 decomposes over the query heads of a group. | before run | One query head could set for its group. | Table 12 ; no rule affected. |
| 3 | E1 reports after trimming the furthest keys. | before run | The attention-sink explanation needed a test. | Table 12 ; negative. |
| 4 | The uncentred control is reported with the key-projection bias norms recorded per head. | before run | The uncentred radius tracks the bias where a bias exists. | One column of Table 3 . |
| 5 | The 8192-pair cap applies to every Gram–Schmidt or self-balancing walk, and the pairs seen are recorded per row. | before run | Otherwise matched output size at mismatched input size. | Kernel halving remains uncapped, in its favour; stated in Section 7.1 . |
| 6 | is computed over decoding queries only, and the 99th percentile is undefined below 100 queries. | before run, after pilots not reported here | Two call sites disagreed on the population; a percentile of few queries copies the maximum. | Definitions of Appendix E.2 . |
| within one query-head group | after trimming | ||||
|---|---|---|---|---|---|
| Model | largest head | smallest head | ratio | drop | drop |
| Qwen2.5-7B-Instruct | 2.415 | 1.722 | 1.39 | 0.970 | 0.929 |
| Llama-3-8B-Instruct | 1.674 | 1.352 | 1.22 | 0.977 | 0.945 |
| Model | context | heads | prompts | median | median | median |
|---|---|---|---|---|---|---|
| Qwen2.5-7B-Instruct | 512 | 112 | 250 | 18.287 | 2.288 | 41.954 |
| 1024 | 112 | 250 | 19.143 | 2.319 | 44.721 | |
| 2048 | 112 | 250 | 20.047 | 2.339 | 47.942 | |
| 4096 | 112 | 36 | 20.502 | 2.398 | 49.685 | |
| 8192 | 112 | 63 | 21.474 | 2.420 | 52.368 | |
| 16384 | 112 | 62 | 22.517 | 2.445 | 56.454 |
| Head | participation ratio | top-1 mass | near hard max | ||
|---|---|---|---|---|---|
| Qwen2.5-7B-Instruct | |||||
| L00H00 | 193.8 | 292.6 | 4096–32768 | 0.07 | 0 of 6 |
| L00H03 | 37.9 | 586.4 | 4096–32768 | 0.02 | 0 of 6 |
| L03H01 | 52.7 | 298.9 | 4096–32768 | 0.07 | 0 of 6 |
| L07H01 | 48.9 | 3.9 | 4096–32768 | 0.70 | 6 of 6 |
| L15H00 | 66.9 | 12.1 | 4096–32768 | 0.50 | 5 of 6 |
| real decoding queries | sphere of radius | |||||
| Method | ||||||
| Qwen2.5-7B-Instruct | ||||||
| Uniform sampling | 0.676 | 0.565 | 0.415 | 1.078 | 1.046 | 1.007 |
| BalanceKV | 0.707 | 0.624 | 0.401 | 1.079 | 1.053 | 0.984 |
| Kernel halving | 0.671 | 0.506 | 0.413 | 1.091 | 1.047 | 0.986 |
| Halving | 0.706 | 0.582 | 0.403 | 1.088 | 1.048 | 0.975 |
| Qwen2.5-7B-Instruct | Llama-3-8B-Instruct | |||
|---|---|---|---|---|
| Method | size ratio | fewer keys | size ratio | fewer keys |
| BalanceKV | 1.000 | 19% | 1.000 | 15% |
| Kernel halving | 1.000 | 21% | 1.000 | 6% |
| Halving | 1.000 | 25% | 1.000 | 15% |
| Halving, re-centred subsample | 1.000 | 24% | 1.000 | 4% |
| Heavy hitters (oracle) | 0.250 | 93% | 0.250 | 96% |
| pivoted Cholesky | off-diag. correlation | |||||||
|---|---|---|---|---|---|---|---|---|
| Model | band | inst. | heads | rank | saturated | full | degen. | |
| Qwen2.5-7B-Instruct | 14 | 4 | 256.0 | 14/14 | 0.972 | 0.179 | 0 | |
| 28 | 7 | 256.0 | 28/28 | 0.962 | 0.039 | 0 | ||
| 4 | 1 | 158.0 | 0/4 | 0.951 | 1 | |||
| 8 | 2 | 133.5 | 0/8 | 0.967 | 5 | |||
| Llama-3-8B-Instruct | 28 | 7 | 256.0 | 28/28 | 0.962 | 0.094 | 0 | |
| Qwen2.5-7B-Instruct | Llama-3-8B-Instruct | |||
|---|---|---|---|---|
| Method | worst case | after divergence | worst case | after divergence |
| Uniform sampling | 1.000 | 1.004 | 1.000 | 1.008 |
| BalanceKV | 1.000 | 1.005 | 1.000 | 1.005 |
| Halving, re-centred subsample | 1.000 | 1.010 | 1.000 | 1.001 |
| Heavy hitters (oracle) | 1.121 | 1.071 | 1.086 | 1.035 |
| fitted slope of against , and its range over seeds | ||||
|---|---|---|---|---|
| Keys | Method | |||
| Sphere, | Uniform sampling | 0.54 [0.40, 0.60] | 0.81 [0.76, 0.93] | 0.57 [0.40, 0.72] |
| BalanceKV | 0.48 [0.37, 0.59] | 0.97 † [0.79, 1.19] | 0.68 [0.44, 1.00] | |
| Kernel halving | 0.42 [0.33, 0.53] | 0.90 [0.83, 1.07] | 0.58 [0.48, 0.81] | |
| Halving, re-centred subsample | 0.64 [0.44, 0.84] | 1.08 [0.91, 1.14] | 0.98 [0.72, 1.15] | |
| Halving | 0.58 [0.32, 0.86] | 1.10 [0.98, 1.26] | 1.03 [0.82, 1.22] | |
| worst-case error at a coreset of 1024 of 65536 pairs | ||||
| Method | ||||
| Uniform sampling | 0.031 | 0.040 | 0.058 | 0.074 |
| BalanceKV | 0.025 | 0.034 | 0.051 | 0.069 |
| Kernel halving | 0.024 | 0.035 | 0.053 | 0.068 |
| Halving | 0.011 | 0.018 | 0.026 | 0.038 |
| Halving, re-centred subsample | 0.011 | 0.016 | 0.024 | 0.038 |
Coreset Selection
Coreset selection chooses compact subsets that preserve a dataset’s learning, evaluation, or optimization value while reducing cost.
See all 59 papers