Compile the Table: Query-Calibrated Operator Compression for Tabular In-Context Learning
Abstract
Tabular in-context learning (ICL) has emerged as a training-free and accurate paradigm for tabular prediction, but current approaches to compressing its in-context examples face an accuracy-throughput tradeoff: fixed subsets can sacrifice accuracy, while query-specific retrieval limits cache reuse and batching across queries, reducing throughput. We propose QCOC (Query-Calibrated Operator Compression), which exploits the exchangeability and repeated use of in-context examples by compiling their full KV cache once into compact memory shared across subsequent queries. Instead of retaining raw examples, QCOC clusters their states into joint-KV prototypes, preserves per-cluster multiplicities and the original example count, and calibrates prototype values against attention query vectors produced by the in-context examples through an anchored closed-form solution. Prototype compression drives the speedup, while value fitting helps preserve accuracy. On 64 held-out OpenML-CC18 datasets, QCOC achieves the highest mean accuracy among the compared compression and retrieval methods at both retained counts. Across 12 configurations on seven long tables, it ranks first among compressed methods in ten and averages 0.23 percentage points below full context. Compressing 8,192 in-context examples to 512 memory slots yields a 10.5x cache compression ratio; excluding one-time compilation, in a single-core CPU online-serving comparison over 1,000 queries, QCOC is up to 508x faster than dynamic retrieval baselines and 1.98x faster than full-context inference. These results show that QCOC enables compact-memory reuse and efficient inference across queries while retaining accuracy close to full context.
Figures & tables
| Method | ||
|---|---|---|
| Global row selection | ||
| Random | 0.6819 | 0.7404 |
| Input K-means | 0.7321 | 0.7925 |
| LUCoS | 0.7348 | 0.7922 |
| Dynamic row selection | ||
| MICP | 0.7905 | 0.8137 |
| Method | 16 | 32 | 64 | 64 | 128 | 256 | 128 | 256 | 512 | 256 | 512 | 1,024 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Global row selection | ||||||||||||
| Random | .6003 | .6276 | .6763 | .6716 | .7120 | .7254 | .6854 | .7421 | .7494 | .7319 | .7487 | .7596 |
| Input K-means | .6656 | .6846 | .7370 | .7153 | .7440 | .7573 | .7389 | .7610 | .7759 | .7399 | .7793 | .7871 |
| LUCoS | .6463 | .6721 | .7323 | .7067 | .7266 | .7696 | .7374 | .7626 | .7773 | .7656 | .7670 | .7900 |
| Dynamic row selection | ||||||||||||
Appendix figures & tables18 assets
Supplementary material from the paper’s appendix.
Appendix
| Method | ||
|---|---|---|
| Random | ||
| Input K-means | ||
| LUCoS | ||
| MICP | ||
| CRUMB | ||
| KATE |
| Method | ||
|---|---|---|
| Global row selection | ||
| Input K-means | .7306 | .7919 |
| K-Medoids (Euclidean) | .7475 | .8009 |
| K-Medoids (cosine) | .7413 | .7919 |
| LUCoS (Euclidean) | .7278 | .7922 |
| LUCoS (cosine) | .7306 | .7934 |
| Method | Acc. | Passes | Slots | Acc. | Passes | Slots |
| Dynamic row selection | ||||||
| MICP | .7941 | 12.38 | 396 | .8181 | 6.81 | 436 |
| Centroid-nearest batching | .8069 | 20 | 640 | .8313 | 20 | 1280 |
| Voronoi-uniform batching | .8069 | 20 | 640 | .8369 | 20 | 1280 |
| CRUMB | .8175 | 20 | 640 | .8378 | 20 | 1280 |
| Method | Accuracy | Prob. MAE | Attention MSE | QCOC gain [95% CI] |
|---|---|---|---|---|
| Global row selection | ||||
| Input K-means | .7306 | — | — | +.1184 [.0922,.1462] |
| Dynamic row selection | ||||
| KATE | .8200 | — | — | +.0291 [.0137,.0444] |
| KV compression | ||||
| Key centroids | .7800 | .10079 | .008627 | +.0691 [.0350,.1112] |
| Inputs | Use original | Cluster-count weight | Value fit | Acc. | Prob. MAE | Attention MSE |
|---|---|---|---|---|---|---|
| Key only | .7581 | .1329 | .008627 | |||
| Key only | ✓ | .7800 | .1008 | .008627 | ||
| Key only | ✓ | .7922 | .1023 | .003293 | ||
| Key only | ✓ | ✓ | .8259 | .0507 | .003293 | |
| Key only | ✓ | ✓ | ✓ | .8469 | .0210 | .001641 |
| Joint KV | .7428 | .1752 | .010907 |
| Method | Accuracy | Prob. MAE | Attention-output MSE | accuracy |
|---|---|---|---|---|
| Class-balanced random | .6922 | — | — | +.1528 [.1234,.1841] |
| Input K-means | .7184 | — | — | +.1266 [.0937,.1613] |
| LUCoS (Euclidean) | .7244 | — | — | +.1206 [.0897,.1525] |
| LUCoS (cosine) | .7366 | — | — | +.1084 [.0784,.1406] |
| MICP | .7966 | — | — | +.0484 [.0312,.0659] |
| CRUMB | .8263 | — | — | +.0187 [.0066,.0312] |
| Budget | Method | Norm. RMSE | |
|---|---|---|---|
| 32 | Full context | .4582 | .7398 |
| KATE | .5261 | .6728 | |
| Weighted joint-KV | .5796 | .6204 | |
| QCOC | .5127 | .6864 | |
| 64 | Full context | .4582 | .7398 |
| KATE | .4946 | .7074 |
| Dataset | Full | Input K-means | MICP | CRUMB | KATE | Weighted KV | QCOC |
|---|---|---|---|---|---|---|---|
| adult | .871 | .841 | .850 | .863 | .859 | .865 | .870 |
| bank-marketing | .758 | .740 | .748 | .739 | .737 | .763 | .754 |
| connect-4 | .810 | .734 | .779 | .770 | .793 | .762 | .807 |
| electricity | .878 | .880 | .854 | .869 | .883 | .880 | .871 |
| jungle chess | .878 | .809 | .868 | .885 | .884 | .868 | .879 |
| nomao | .968 | .943 | .954 | .960 | .971 | .959 | .971 |
| Benchmark | Full | MICP | CRUMB | KATE | Weighted KV | QCOC | Cache reduction |
|---|---|---|---|---|---|---|---|
| CC18-Long (7 datasets) | .8077 | .7930 | .7976 | .8019 | .7979 | .8081 | 10.53 |
| SUSY | .8067 | .7930 | .7890 | .7893 | .7953 | .8077 | 12.09 |
| HIGGS | .7167 | .6803 | .6853 | .7007 | .7090 | .7110 | 10.94 |
| Covertype | .8580 | .8130 | .8157 | .8530 | .7707 | .8153 | 9.03 |
| Accuracy | Gap to Full | Agreement | Cache compression | |
|---|---|---|---|---|
| 256 | .8056 | .9626 | 15.50 | |
| 512 | .8081 | .9751 | 10.53 | |
| 1,024 | .8069 | .9780 | 6.42 |
| Method | 16 | 32 | 64 | 64 | 128 | 256 | 128 | 256 | 512 | 256 | 512 | 1,024 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Global row selection | ||||||||||||
| Random | 1.83 | 2.05 | 2.14 | 2.18 | 2.36 | 2.69 | 2.38 | 2.76 | 3.57 | 2.76 | 3.51 | 5.21 |
| Input K-means | 2.06 | 2.15 | 2.21 | 2.27 | 2.42 | 2.75 | 2.44 | 2.73 | 3.50 | 2.82 | 3.59 | 4.92 |
| LUCoS | 1.96 | 2.05 | 2.18 | 2.15 | 2.42 | 2.78 | 2.42 | 2.68 | 3.42 | 2.77 | 3.59 | 4.94 |
| Dynamic row selection | ||||||||||||
| Method | ||||
|---|---|---|---|---|
| QCOC | 1.86 | 21.01 | 74.36 | 283.40 |
| Dataset | Split | Full | QCOC | KATE | Weighted KV | CRUMB | MICP |
|---|---|---|---|---|---|---|---|
| SUSY | 1 | .797 | .797 | .773 | .774 | .779 | .780 |
| 2 | .813 | .813 | .797 | .812 | .788 | .795 | |
| 3 | .810 | .813 | .798 | .800 | .800 | .804 | |
| Mean | .8067 | .8077 | .7893 | .7953 | .7890 | .7930 | |
| Covertype | 1 | .855 | .821 | .854 | .782 | .823 | .815 |
| 2 | .885 | .835 | .873 | .788 | .835 | .827 |
| Accuracy | Gap to Full | Agreement | ||
|---|---|---|---|---|
| 512 | .8153 | pt | .8973 | .511 |
| 1,024 | .8317 | pt | .9357 | .467 |