小示例的投资回报率:在令牌预算约束下优化上下文学习
摘要
该论文研究在固定 token 预算下,少而长的示例与多而短的示例哪种对上下文学习更有效,实验表明较短的示范通常是提示空间的最优利用方式。
arXiv:2611.24971v1 Announce Type: new
Abstract: In-context learning (ICL) improves large language model performance at inference time without updating model parameters. However, these gains are not free: in practical deployments, longer prompts directly increase inference cost and latency. Under a fixed token budget, prompt construction therefore becomes a resource-allocation problem. While prior work has often focused on how many examples to include in ICL, we study the complementary question of whether the available budget is better spent on a few long demonstrations or on a larger number of shorter ones. We study this aspect in question answering (QA), by organizing candidate demonstrations into length-based bins and constructing prompts from examples within the same length range under fixed budgets. Experiments on two QA benchmarks (\textit{Beat the AI} and \textit{Natural Questions}), using six instruction-tuned LLMs, show that shorter demonstrations are generally the most effective use of prompt space. This effect is especially strong on \textit{Beat the AI}, and remains visible on NQ, although gains are smaller and saturate earlier in the long-context setting. An additional natural language inference experiment on ANLI R3 finds that one of the two shorter bins performs best for five of six models, although longer demonstrations remain competitive. Overall, our results highlight demonstration granularity as an important factor in prompt design.
查看缓存全文
缓存时间: 2026/11/20 09:03
# The ROI of Small Examples: Optimizing In-Context Learning Under Token Budgets
Source: [https://arxiv.org/html/2611.24971](https://arxiv.org/html/2611.24971)
Anxo PerezAffiliation:IRLab, CITICAffiliation:Universidade da CoruñaAffiliation:A Coruña, SpainEmail:[anxo\.pvila@udc\.es](mailto:)Jorge GabínAffiliation:IRLab, CITICAffiliation:Universidade da CoruñaAffiliation:A Coruña, SpainEmail:[jorge\.gabin@udc\.es](mailto:)Javier ParaparAffiliation:IRLab, CITICAffiliation:Universidade da CoruñaAffiliation:A Coruña, SpainEmail:[javier\.parapar@udc\.es](mailto:)
###### Abstract
In\-context learning \(ICL\) improves large language model performance at inference time without updating model parameters\. However, these gains are not free: in practical deployments, longer prompts directly increase inference cost and latency\. Under a fixed token budget, prompt construction therefore becomes a resource\-allocation problem\. While prior work has often focused on how many examples to include in ICL, we study the complementary question of whether the available budget is better spent on a few long demonstrations or on a larger number of shorter ones\. We study this aspect in question answering \(QA\), by organizing candidate demonstrations into length\-based bins and constructing prompts from examples within the same length range under fixed budgets\. Experiments on two QA benchmarks \(Beat the AIandNatural Questions\), using six instruction\-tuned LLMs, show that shorter demonstrations are generally the most effective use of prompt space\. This effect is especially strong onBeat the AI, and remains visible on NQ, although gains are smaller and saturate earlier in the long\-context setting\. An additional natural language inference experiment on ANLI R3 finds that one of the two shorter bins performs best for five of six models, although longer demonstrations remain competitive\. Overall, our results highlight demonstration granularity as an important factor in prompt design\.
## 1Introduction and Related Work
In\-context learning \(ICL\) has become an attractive way to adapt LLMs to downstream tasks without updating model parameters[Brown et al\. \(2020\)](https://arxiv.org/html/2611.24971#bib.bib6)\. By conditioning the model on a set of demonstrations, ICL can improve performance at inference time in tasks such as Question Answering \(QA\)[Li et al\. \(2023\)](https://arxiv.org/html/2611.24971#bib.bib11)\. However, every additional demonstration increases prompt length, which in practical deployments directly affects inference cost and latency\. As a result, many real\-world applications must operate under fixed token budgets\. This constraint turns prompt construction into a resource allocation problem\. Given a limited number of tokens, should a practitioner include a few long demonstrations, or allocate the same budget to a larger number of shorter ones?
This trade\-off is especially relevant in QA, where demonstration length is often driven by the amount of supporting context included with each example\. A longer demonstration may expose the model to richer evidence and more complete question–answer mappings, but it also consumes budget that could otherwise be spent on additional examples\. Conversely, shorter demonstrations may provide less contextual detail individually, yet allow the model to observe a broader range of answer patterns within the same prompt\. As a result, prompt construction under budget constraints is not simply a matter of adding more demonstrations, but of deciding how to distribute limited context space between*depth*per example and*breadth*across examples\.
Prior work has shown that ICL performance depends strongly on prompt construction[Lu et al\. \(2022\)](https://arxiv.org/html/2611.24971#bib.bib7);[Zhao et al\. \(2024\)](https://arxiv.org/html/2611.24971#bib.bib1)\. Some studies have explored how to select better demonstrations, including retrieval\-based and budget\-aware strategies that dynamically decide which examples to include or how many to use under context constraints\([Xu et al\., 2023](https://arxiv.org/html/2611.24971#bib.bib3);[Purohit et al\., 2025](https://arxiv.org/html/2611.24971#bib.bib4);[Zhou et al\., 2023](https://arxiv.org/html/2611.24971#bib.bib2)\)\. Other work shows that demonstration organization also matters: example ordering can significantly affect ICL performance, and long\-context studies suggest that additional context is not always exploited effectively, especially when relevant information appears in less favorable positions\([Zou et al\., 2025](https://arxiv.org/html/2611.24971#bib.bib9);[Liu et al\., 2023](https://arxiv.org/html/2611.24971#bib.bib8);[Bertsch et al\., 2025](https://arxiv.org/html/2611.24971#bib.bib10)\)\. Despite these advances, much less is known about the direct trade\-off between*demonstration length*and*demonstration count*under a fixed prompt budget\. In particular, it remains unclear whether the same token budget is better spent on many concise demonstrations or on fewer but longer ones\.
In this paper, we group candidate demonstrations into length\-based bins and compare prompting strategies under controlled token budgets, varying the number and size of examples within a shared budget ceiling\. Our main study covers two QA benchmarks:Beat the AI[Bartolo et al\. \(2020\)](https://arxiv.org/html/2611.24971#bib.bib5), which provides a challenging adversarial setting, and a subset of Natural Questions \(NQ\), which offers a complementary QA benchmark with much longer contexts\. To test whether the effect generalizes across architectures and scales, we evaluate six instruction\-tuned LLMs spanning three model families and two sizes per family\. We further explore its applicability beyond extractive QA through an additional experiment on ANLI R3, a natural language inference benchmark[Nie et al\. \(2020\)](https://arxiv.org/html/2611.24971#bib.bib14)\.
Our results show that, under a fixed token budget, shorter demonstrations are generally the most effective use of prompt space in the QA settings studied\. This effect is especially strong onBeat the AI, where the shortest bin yields the best results across all evaluated models\. In NQ, the gains are smaller and saturate earlier in the long\-context setting\. On ANLI R3, one of the two shorter bins yields the best observed result for five of six models, while longer demonstrations remain competitive, indicating that the preferred allocation depends on the task and model\. These findings provide practical guidance for budget\-constrained ICL and highlight demonstration granularity as an important and underexplored dimension of prompt design111:[https://github\.com/IRLab\-UDC/roi\-small\-samples\-in\-icl](https://github.com/IRLab-UDC/roi-small-samples-in-icl)\.
## 2Methodology
We study prompt construction for QA\-oriented ICL under a fixed token budget\. Our goal is to compare two competing uses of the same budget: allocating it to a smaller number of longer demonstrations, or to a larger number of shorter ones\. We address this setup as a controlled token\-allocation problem in which prompts are matched by total token length while the average size of the demonstrations varies\.
Let a prompt be defined asP=\(I,D,t\)P=\(I,D,t\), whereIIis the task instruction,D=\{d1,…,dn\}D=\\\{d\_\{1\},\\dots,d\_\{n\}\\\}is a set of in\-context demonstrations from the training set, andt=\(xq,cq\)t=\(x\_\{q\},c\_\{q\}\)is the test instance consisting of a questionxqx\_\{q\}and its associated contextcqc\_\{q\}\. Each demonstrationdi=\(xi,ci,yi\)d\_\{i\}=\(x\_\{i\},c\_\{i\},y\_\{i\}\)is represented as a full multi\-turn example containing a question, context, and answer\. Its length, denotedL\(di\)L\(d\_\{i\}\), is the total tokenized length of the complete formatted demonstration\. The total prompt length is therefore
L\(P\)=L\(I\)\+L\(t\)\+∑i=1nL\(di\),L\(P\)=L\(I\)\+L\(t\)\+\\sum\_\{i=1\}^\{n\}L\(d\_\{i\}\),and must satisfy the budget constraintL\(P\)≤TL\(P\)\\leq T, whereTTis the maximum token budget for the full prompt\.
We partition the pool of candidate demonstrations into length\-based bins using the Freedman\-\-Diaconis rule222Full set of bins obtained for all datasets, with the corresponding token\-length histograms, is provided in Appendix[B](https://arxiv.org/html/2611.24971#A2)\., which yields data\-driven ranges of similarly sized examples\. ForBeat the AI, this results in four bins:B1=\[48,84\]B\_\{1\}=\[48,84\],B2=\[195,231\]B\_\{2\}=\[195,231\],B3=\[342,377\]B\_\{3\}=\[342,377\], andB4=\[452,487\]B\_\{4\}=\[452,487\]\. The same procedure is applied independently to the Natural Questions subset, yielding four larger bins:B1=\[570,1434\]B\_\{1\}=\[570,1434\],B2=\[2300,3163\]B\_\{2\}=\[2300,3163\],B3=\[4029,4892\]B\_\{3\}=\[4029,4892\], andB4=\[6622,7486\]B\_\{4\}=\[6622,7486\]\.
For each budget levelTTand each length binBjB\_\{j\}, we construct prompts using only demonstrations sampled at random fromBjB\_\{j\}, so that all examples in a prompt come from the same length range\. Starting from an empty prompt, we iteratively add demonstrations until including another one would exceedTT\. Because shorter bins contain more compact examples, they typically allow more demonstrations to fit within the same budget, whereas longer bins result in fewer included examples\. The budget is applied to the entire prompt, including the task instruction, all demonstrations, and the final test instance\. Since the content distribution across bins is comparable and the sampled examples do not differ substantially in difficulty, this setup isolates the trade\-off of interest: whether, under the same token expenditure, LLMs benefit more from broader example coverage or from richer individual demonstrations\.
## 3Experiments
\(a\)Gemma 4B\(b\)Gemma 27B\(c\)Phi 4B\(d\)Phi 14B\(e\)Qwen 4B\(f\)Qwen 30B
Figure 1:Average F1 onBeat the AIas a function of prompt budget for the six evaluated LLMs\. Each curve corresponds to a length bin, and random baseline samples demonstrations from the full pool without bin constraints\.We evaluate our approach on two QA benchmarks\. The first isBeat the AI[Bartolo et al\. \(2020\)](https://arxiv.org/html/2611.24971#bib.bib5), an adversarial reading comprehension benchmark, where questions were collected to deliberately challenge existing QA systems\. The second is a subset of Natural Questions \(NQ\)[Kwiatkowski et al\. \(2019\)](https://arxiv.org/html/2611.24971#bib.bib16), included to assess whether the observed trends extend beyond the adversarial setting\. For NQ, we restrict the candidate training pool to examples shorter than 7,500 tokens for computational feasibility, and evaluate on a subset of 500 test queries\.
We experiment with six instruction\-tuned LLMs from three families and two model sizes per family: Qwen 3 \(4B and 30B\), Phi \(Phi\-4\-mini and Phi\-4\), and Gemma 3 \(4B and 27B\)\. For each model, we compare zero\-shot prompting against in\-context prompting under fixed token budgets, using prompts built from a single length bin at a time333Full prompt format is shown in Appendix[A](https://arxiv.org/html/2611.24971#A1)\.\. We also include a random\-selection baseline that samples demonstrations from the full pool\. Prompt ordering is kept fixed across settings, and each configuration is repeated over five independent random runs, with results reported as average F1\.
### 3\.1Results on Beat the AI
ForBeat the AI, Figure[1](https://arxiv.org/html/2611.24971#S3.F1)compares the behavior of the six models across token budgets, together with the random\-selection baseline\. A consistent pattern emerges across all model families and sizes: prompts built from the shortest demonstrations \(Bin 1\) achieve the strongest performance, while longer bins generally underperform as the budget increases\. Table[1](https://arxiv.org/html/2611.24971#S3.T1)summarizes the best F1 for each Bin and also shows the corresponding number of demonstrations under a budget of 4,000 tokens\. In all six models, the best\-performing configuration comes from selecting ICL examples from Bin 1, yielding substantial gains over zero\-shot prompting\. For instance, Qwen 30B improves by 20\.36% \(from 56\.38 to 67\.86 withk=51k=51total demonstrations\), and Gemma 4B improves by 56\.20% \(from 38\.38 to 59\.95 withk=41k=41\)\. In contrast, the best configurations from Bins 2–4 are consistently lower, showing that spending the same budget on fewer, longer demonstrations is less effective than allocating it to more concise examples\. The random baseline further strengthens this conclusion\. Although random selection improves over zero\-shot prompting, its performance tends to track medium\-length behavior, remaining below the best Bin 1 configurations in every case\. This suggests that the gains of Bin 1 are not simply due to using more demonstrations in an arbitrary way, but to deliberately allocating the prompt budget to shorter examples\. Overall, the results onBeat the AIshow that using a larger number of shorter demonstrations is a more effective strategy than relying on fewer longer ones\.
Table 1:Best average F1 and its number of demonstrations \(kk\) for each length bin under a prompt budget of 4,000 tokens onBeat the AI\. ZS means zero\-shot results\.
### 3\.2Results on Natural Questions
Table 2:Best average F1 and its number of demonstrations \(kk\) for each length bin under a prompt budget of 30,000 tokens on NQ\. ZS represents zero\-shot strategy, and the Random column shows the best average result across five random runs until the token budget is filled\.We next evaluate the same prompting strategies on a subset of NQ, using a larger prompt budget of 30,000 tokens to reflect the substantially longer contexts in this dataset\. Since this setting requires prompts well beyond 16k tokens, we do not include the Phi models in NQ, as Phi\-4\-mini maximum context length is below the required budget\.
Table[2](https://arxiv.org/html/2611.24971#S3.T2)shows that the pattern on NQ is more nuanced than onBeat the AI\. Bin 1 yields the best overall result for three of the four evaluated models\. The only exception is Gemma 4B, where Bin 2 performs best \(66\.66 with only one example demonstration,k=1k=1\), although the gap with Bin 1 is small\. Thus, shorter demonstrations remain highly competitive, but the preference for Bin 1 is less uniform in this long\-context setting\.
Figure[2](https://arxiv.org/html/2611.24971#S3.F2)complements these results by showing performance across prompt budgets\. Increasing the budget does not consistently improve F1: Gemma 4B generally deteriorates as prompts grow longer, while the other models exhibit plateaus or fluctuations\. Bin 1 remains competitive across much of the budget range, particularly for the Qwen models, although its advantage is not uniform\.
All models improve over ZS prompting, but the margins between the best bin configurations are narrower than inBeat the AI, and the best configurations are often reached with small values ofkk\. The random baseline supports this picture: for all four models, its best result remains below the strongest bin\-based configuration and is achieved with only a small number of demonstrations, further indicating that filling the available budget does not necessarily yield the best performance\.
\(a\)Gemma 4B\(b\)Gemma 27B\(c\)Qwen 4B\(d\)Qwen 30B
Figure 2:Average F1 onNQas a function of prompt budget for the four models under different length bins\. Each curve corresponds to a length bin, and random baseline samples demonstrations from the full pool\.
### 3\.3Discussion of QA Results
Taken together, the results show that the benefit of shorter demonstrations is robust, but not equally strong across QA settings\. OnBeat the AI, the effect is clear and consistent: the shortest bin yields the best results for all evaluated models, often by a substantial margin\. This indicates that, when demonstrations are relatively compact, allocating a fixed token budget to more examples is a particularly effective strategy\.
On NQ, the same preference for shorter demonstrations remains, but the pattern is weaker and less uniform\. The differences between bins are smaller, and the best configurations are often reached with relatively small values ofkk\. Because NQ relies on full Wikipedia articles, even the shortest demonstrations already consume substantial context space, so adding examples quickly produces longer prompts\. From an attention perspective, this creates two related problems\. First, the model’s finite attention must be distributed over many more tokens, so each additional demonstration receives less effective focus\. Second, longer prompts make it harder for the model to recover relevant information, especially when useful evidence is placed in the middle of the sequence\. As a result, increasingkkdoes not necessarily improve performance: the potential benefit of extra demonstrations is offset by weaker attention and more difficult evidence retrieval\. This interpretation is consistent with prior work on long\-context limitations, including the “lost in the middle” phenomenon[Liu et al\. \(2023\)](https://arxiv.org/html/2611.24971#bib.bib8);[Zou et al\. \(2025\)](https://arxiv.org/html/2611.24971#bib.bib9);[Gabín et al\. \(2026\)](https://arxiv.org/html/2611.24971#bib.bib15)\.
### 3\.4Cross\-Task Experiment on ANLI R3
To explore whether the patterns observed in extractive QA extend to another task, we conduct an additional experiment on natural language inference \(NLI\), using the third round of the Adversarial NLI benchmark \(ANLI R3\)[Nie et al\. \(2020\)](https://arxiv.org/html/2611.24971#bib.bib14)\. This task requires classifying the relation between a premise and a hypothesis as entailment, contradiction, or neutral\. We evaluate the same six models using four demonstration\-length bins and report macro\-F1\. Table[3](https://arxiv.org/html/2611.24971#S3.T3)presents the best observed configuration within each bin under a full\-prompt token budget of 4,000 tokens\.
Table 3:Best observed macro\-F1 and number of demonstrations \(kk, in parentheses\) per length bin on ANLI R3\. Bold marks the best bin score per model\.The two shorter bins yield the highest observed macro\-F1 for five of the six models\. Bin 1 performs best for Phi\-4 and Gemma 4B, while Bin 2 leads for both Qwen models and Gemma 27B\. Phi\-4\-mini achieves its best result with a single Bin 4 demonstration\. Longer demonstrations also remain competitive: for Phi\-4 and Gemma 27B, the best Bin 4 score is within one macro\-F1 point of the overall best configuration\. Across models, the winning configurations improve over zero\-shot prompting by 2\.35–6\.84 macro\-F1 points, with demonstration counts ranging fromk=1k=1tok=55k=55\.
These results show that the preferred allocation of the token budget depends on the task and model\. Compared with the consistent Bin 1 advantage onBeat the AI, ANLI favors a broader range of demonstration lengths and counts\. Its bins also exhibit less separation in token length than those used in the QA experiments, providing a complementary setting in which longer demonstrations remain competitive\. Investigating how the range of available demonstration lengths interacts with task demands is a promising direction for future work\.
## 4Conclusions
We studied the trade\-off between demonstration length and demonstration count in QA\-oriented ICL under fixed token budgets\. Across both QA datasets, shorter demonstrations are generally the most reliable use of prompt space\. This effect is especially strong onBeat the AI, while on NQ it remains visible but weaker, as long contexts quickly consume the budget\. An additional experiment on ANLI R3 extends the analysis beyond extractive QA: the two shorter bins provide the best observed configurations for five of six models, although longer demonstrations remain competitive\. Overall, our findings highlight demonstration granularity as an important factor in prompt design and suggest that shorter demonstrations are usually a better investment under token constraints, with the preferred length and count depending on the task and model\.
## 5Computational Resources
Experiments were conducted using private infrastructure, with a carbon efficiency of 0\.432 kgCO2eq/kWh\. A cumulative of 53 hours of computation was performed on hardware of type A100 SXM4 80 GB, generating an estimated 7\.5 kgCO2eq[Lacoste et al\. \(2019\)](https://arxiv.org/html/2611.24971#bib.bib13)\.
## Acknowledgment
This work was supported by grant PID2022\-137061OB\-C21 and PID2025\-167749OB\-C22, funded by MICIU/AEI/10\.13039/501100011033 and ERDF/EU; and the Consellería de Cultura, Educación, Formación Profesional e Universidades through accreditations ED431G 2023/01 and ED431C 2025/49\. CITIC, a CIGUS Network member accredited for excellence within the Galician University System, receives support from the Department of Education, Science, Universities, and Vocational Training of the Xunta de Galicia and is co\-financed by the EU through the FEDER Galicia 2021–2027 operational programme \(Ref\. ED431G 2023/01\)\.
## Limitations
This study has several limitations\. First, it focuses primarily on QA\-oriented in\-context learning, with an additional experiment on natural language inference using ANLI R3\. Although this extends the evaluation beyond QA, the findings may not generalize directly to other tasks\. Second, although we evaluate multiple LLM families and model sizes, the experiments are still limited to a finite set of instruction\-tuned models\. Finally, our setup uses prompts built from a single length bin at a time and random sampling within each bin, which enables comparisons across demonstration lengths but does not cover mixed\-bin strategies or relevance\-based selection\.
## Ethical use of AI\-assisted tools
AI\-assisted tools were used solely to support manuscript review and language editing\. All suggestions were critically reviewed and revised by the authors, who retained full control over the manuscript and its scientific content\.
## References
- M\. Bartolo, A\. Roberts, J\. Welbl, S\. Riedel, and P\. StenetorpBeat the ai: investigating adversarial human annotation for reading comprehension\.Transactions of the Association for Computational Linguistics8,pp\. 662–678\.Cited by:[§1](https://arxiv.org/html/2611.24971#S1.p4.1),[§3](https://arxiv.org/html/2611.24971#S3.p1.1)\.
- Bertschet al\.\(2025\)A\. Bertsch, M\. Ivgi, E\. Xiao, U\. Alon, J\. Berant, M\. R\. Gormley, and G\. NeubigIn\-context learning with long\-context models: an in\-depth exploration\.InProceedings of the 2025 Conference of the Nations of the Americas Chapter of the Association for Computational Linguistics: Human Language Technologies \(Volume 1: Long Papers\),pp\. 12119–12149\.Cited by:[§1](https://arxiv.org/html/2611.24971#S1.p3.1)\.
- Brownet al\.\(2020\)T\. Brown, B\. Mann, N\. Ryder, M\. Subbiah, J\. D\. Kaplan, P\. Dhariwal, A\. Neelakantan, P\. Shyam, G\. Sastry, A\. Askell,et al\.Language models are few\-shot learners\.Advances in neural information processing systems33,pp\. 1877–1901\.Cited by:[§1](https://arxiv.org/html/2611.24971#S1.p1.1)\.
- Freedman and Diaconis \(1981\)D\. Freedman and P\. DiaconisOn the histogram as a density estimator: l 2 theory\.Zeitschrift für Wahrscheinlichkeitstheorie und verwandte Gebiete57\(4\),pp\. 453–476\.Cited by:[Appendix B](https://arxiv.org/html/2611.24971#A2.p1.1)\.
- Gabínet al\.\(2026\)J\. Gabín, A\. Pérez, and J\. ParaparLost in the evidence? reproducing document position and context size effects in rag\.InProceedings of the 49th International ACM SIGIR Conference on Research and Development in Information Retrieval,SIGIR ’26,New York, NY, USA,pp\. 2901–2910\.External Links:ISBN 9798400725999,[Document](https://dx.doi.org/10.1145/3805712.3808569)Cited by:[§3\.3](https://arxiv.org/html/2611.24971#S3.SS3.p2.1)\.
- Kwiatkowskiet al\.\(2019\)T\. Kwiatkowski, J\. Palomaki, O\. Redfield, M\. Collins, A\. Parikh, C\. Alberti, D\. Epstein, I\. Polosukhin, J\. Devlin, K\. Lee, K\. Toutanova, L\. Jones, M\. Kelcey, M\. Chang, A\. M\. Dai, J\. Uszkoreit, Q\. Le, and S\. PetrovNatural questions: a benchmark for question answering research\.Transactions of the Association for Computational Linguistics7,pp\. 452–466\.External Links:[Link](https://aclanthology.org/Q19-1026/),[Document](https://dx.doi.org/10.1162/tacl%5Fa%5F00276)Cited by:[§3](https://arxiv.org/html/2611.24971#S3.p1.1)\.
- Lacosteet al\.\(2019\)A\. Lacoste, A\. Luccioni, V\. Schmidt, and T\. DandresQuantifying the carbon emissions of machine learning\.arXiv preprint arXiv:1910\.09700\.Cited by:[§5](https://arxiv.org/html/2611.24971#S5.p1.1)\.
- Liet al\.\(2023\)T\. Li, X\. Ma, A\. Zhuang, Y\. Gu, Y\. Su, and W\. ChenFew\-shot in\-context learning on knowledge base question answering\.InProceedings of the 61st Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\),A\. Rogers, J\. Boyd\-Graber, and N\. Okazaki \(Eds\.\),Toronto, Canada,pp\. 6966–6980\.External Links:[Link](https://aclanthology.org/2023.acl-long.385/),[Document](https://dx.doi.org/10.18653/v1/2023.acl-long.385)Cited by:[§1](https://arxiv.org/html/2611.24971#S1.p1.1)\.
- Liuet al\.\(2023\)N\. F\. Liu, K\. Lin, J\. Hewitt, A\. Paranjape, M\. Bevilacqua, F\. Petroni, and P\. LiangLost in the middle: how language models use long contexts, 2023\.URL https://arxiv\. org/abs/2307\.031722\.Cited by:[§1](https://arxiv.org/html/2611.24971#S1.p3.1),[§3\.3](https://arxiv.org/html/2611.24971#S3.SS3.p2.1)\.
- Luet al\.\(2022\)Y\. Lu, M\. Bartolo, A\. Moore, S\. Riedel, and P\. StenetorpFantastically ordered prompts and where to find them: overcoming few\-shot prompt order sensitivity\.InProceedings of the 60th Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\),pp\. 8086–8098\.Cited by:[§1](https://arxiv.org/html/2611.24971#S1.p3.1)\.
- Nieet al\.\(2020\)Y\. Nie, A\. Williams, E\. Dinan, M\. Bansal, J\. Weston, and D\. KielaAdversarial NLI: a new benchmark for natural language understanding\.InProceedings of the 58th Annual Meeting of the Association for Computational Linguistics,Online,pp\. 4885–4901\.External Links:[Document](https://dx.doi.org/10.18653/v1/2020.acl-main.441),[Link](https://aclanthology.org/2020.acl-main.441/)Cited by:[§1](https://arxiv.org/html/2611.24971#S1.p4.1),[§3\.4](https://arxiv.org/html/2611.24971#S3.SS4.p1.1)\.
- Purohitet al\.\(2025\)K\. Purohit, V\. V, S\. Bhattacharya, and A\. AnandSample efficient demonstration selection for in\-context learning\.InProceedings of Machine Learning Research,Vol\.267\.External Links:ISSN 26403498Cited by:[§1](https://arxiv.org/html/2611.24971#S1.p3.1)\.
- Xuet al\.\(2023\)B\. Xu, Q\. Wang, Z\. Mao, Y\. Lyu, Q\. She, and Y\. ZhangKNN prompting: beyond\-context learning with calibration\-free nearest neighbor inference\.In11th International Conference on Learning Representations, ICLR 2023,Cited by:[§1](https://arxiv.org/html/2611.24971#S1.p3.1)\.
- Zhaoet al\.\(2024\)F\. Zhao, T\. Pang, Z\. Wu, Z\. Ma, S\. Huang, and X\. DaiDynamic demonstrations controller for in\-context learning\.External Links:2310\.00385,[Link](https://arxiv.org/abs/2310.00385)Cited by:[§1](https://arxiv.org/html/2611.24971#S1.p3.1)\.
- Zhouet al\.\(2023\)W\. Zhou, Y\. E\. Jiang, R\. Cotterell, and M\. SachanEfficient prompting via dynamic in\-context learning\.External Links:2305\.11170,[Link](https://arxiv.org/abs/2305.11170)Cited by:[§1](https://arxiv.org/html/2611.24971#S1.p3.1)\.
- Zouet al\.\(2025\)K\. Zou, M\. Khalifa, and L\. WangOn many\-shot in\-context learning for long\-context evaluation\.InProceedings of the 63rd Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\),pp\. 25605–25639\.Cited by:[§1](https://arxiv.org/html/2611.24971#S1.p3.1),[§3\.3](https://arxiv.org/html/2611.24971#S3.SS3.p2.1)\.
## Appendix APrompt Format
### A\.1Question Answering
All QA experiments use the same task instruction and multi\-turn prompt format across datasets\. Each prompt begins with a single system instruction defining the extraction task\. The model is then given a sequence of in\-context demonstrations, where each demonstration contains a question, its associated context, and the expected answer in the required output format\. Finally, the test instance is appended using the same structure, without the gold answer\.
The common task instruction used in bothBeat the AIand Natural Questions is shown in Table[4](https://arxiv.org/html/2611.24971#A1.T4)\.
You are an information extraction system\.You must answer the QUESTION using ONLY the CONTEXT\.Task: \- If the CONTEXT contains an answer, extract it as a contiguous span copied verbatim from the CONTEXT\. \- If the CONTEXT does not contain enough information to answer, output NO\_ANSWER\.Rules: 1\) The extracted ANSWER must be an EXACT contiguous substring from CONTEXT \(verbatim, case\-sensitive\)\. 2\) Prefer the minimal span that answers the question precisely and unambiguously\. 3\) If no such span exists in CONTEXT, output exactly: NO\_ANSWER 4\) Output exactly one line with this format and nothing else: ANSWER: <answer span or NO\_ANSWER\>
Table 4:Common task instruction used across both QA datasets and models\.Each in\-context demonstration follows the same multi\-turn structure:
QUESTION: <question text\>CONTEXT: <context text\>ANSWER: <gold answer span or NO\_ANSWER\>
The final test instance is formatted identically, but without the gold answer:
QUESTION: <test question\>CONTEXT: <test context\>ANSWER:
This format ensures that all models receive the same extraction instruction and answer constraints, while varying only the number and length of the demonstrations included under each token budget\.
### A\.2Natural Language Inference
For ANLI R3, we use a classification instruction and a multi\-turn prompt format\. Each prompt begins with the system instruction shown in Table[5](https://arxiv.org/html/2611.24971#A1.T5)\. Each in\-context demonstration consists of a user message containing a premise, introduced asCONTEXT, and a hypothesis, followed by an assistant message containing the gold label\. The final test instance is appended as a user message with the same structure, without its gold label\.
You are a Natural Language Inference \(NLI\) classification system\.You must decide the logical relationship between a CONTEXT \(premise\) and a HYPOTHESIS\.Task: \- Read the CONTEXT and the HYPOTHESIS carefully\. \- Output exactly one label: \* Entailment \-\-\- the CONTEXT clearly supports / implies the HYPOTHESIS \* Neutral \-\-\- the CONTEXT neither supports nor contradicts the HYPOTHESIS \* Contradiction \-\-\- the CONTEXT clearly contradicts the HYPOTHESISRules: 1\) Output exactly one line with this format and nothing else: LABEL: <Entailment \| Neutral \| Contradiction\> 2\) Do not add any explanation or extra text\.
Table 5:System instruction used for ANLI R3 across all evaluated models\.Each demonstration is represented by the following pair of messages\.
User message:
CONTEXT: <premise text\>HYPOTHESIS: <hypothesis text\>
Assistant message:
LABEL: <gold label\>
The gold label is one ofEntailment,Neutral, orContradiction\. The final user message contains only the test premise and hypothesis:
CONTEXT: <test premise\>HYPOTHESIS: <test hypothesis\>
The model then generates the classification as an assistant response in the requiredLABEL: <label\>format\. The system instruction and message structure remain unchanged across models and demonstration\-length bins\.
## Appendix BLength\-Bin Construction and Selection
To construct the demonstration\-length bins used in our experiments, we first analyzed the token\-length distribution of the candidate training examples in each dataset using histogram partitions based on the Freedman–Diaconis rule[Freedman and Diaconis \(1981\)](https://arxiv.org/html/2611.24971#bib.bib12)\. We then defined four representative ranges for each dataset, aiming to balance two criteria: \(i\) sufficient numbers of examples in each range, and \(ii\) clear separation in token length between ranges\. The histogram partitions describe the underlying distributions, while the four experimental bins define the candidate pools used for demonstration sampling\.
### B\.1Beat the AI
For theBeat the AIsetting, the Freedman–Diaconis procedure produced 19 bins over 29,965 examples, spanning token lengths from 48 to 781\. As shown in Figure[3](https://arxiv.org/html/2611.24971#A2.F3), the resulting distribution is concentrated in the short and medium ranges, with progressively fewer examples in the longer bins\. Based on this distribution, we selected four bins for the experiments: \[48–84\], \[195–231\], \[342–377\], and \[452–487\]\. These bins provide a reasonable trade\-off between coverage and length separation\.
Figure 3:Token\-length distribution and Freedman–Diaconis bins for theBeat the AIcandidate examples\. The top plot shows the token\-length histogram, and the bottom plot shows the number of examples per histogram bin\.
### B\.2Natural Questions
For Natural Questions, we followed the same procedure on the subset of candidate examples shorter than 18,000 tokens, obtaining 20 smaller bins over 219,201 examples\. As shown in Figure[4](https://arxiv.org/html/2611.24971#A2.F4), the distribution is much broader than inBeat the AI, reflecting the substantially longer contexts in NQ\. From these bins, we selected four representative ranges for the experiments: \[512–1434\], \[2300–3163\], \[4029–4892\], and \[6622–7468\]\. Compared withBeat the AI, these bins are both larger and farther apart, which is consistent with the heavier contextual structure of NQ examples\.
Figure 4:Token\-length distribution and histogram bins for the NQ candidate examples\. The top plot shows the token\-length histogram, and the bottom plot shows the number of examples per histogram bin\.
### B\.3ANLI R3
For ANLI R3, Figure[5](https://arxiv.org/html/2611.24971#A2.F5)shows a 20\-bin histogram over 101,659 candidate examples, spanning token lengths from 45 to 411\. The distribution is concentrated around 82–118 tokens and exhibits a sparse tail toward longer examples\. The two most populated histogram intervals, \[82–99\] and \[100–118\], contain 27,785 and 25,487 examples, respectively, whereas examples longer than 209 tokens account for fewer than 1% of the candidate pool\.
Based on this distribution, we constructed four experimental bins:B1=\[0,63\]B\_\{1\}=\[0,63\],B2=\[100,118\]B\_\{2\}=\[100,118\],B3=\[155,173\]B\_\{3\}=\[155,173\], andB4=\[210,411\]B\_\{4\}=\[210,411\]\. The first three correspond to histogram bins 1, 4, and 7, containing 3,404, 25,487, and 5,214 examples, respectively\. Although the lower bound ofB1B\_\{1\}is set to zero, its observed examples span 45–63 tokens\. ForB4B\_\{4\}, we pooled histogram bins 10–20, including all examples from 210 tokens to the maximum observed length of 411 tokens, yielding 589 candidates\. Pooling these sparse intervals provides a larger candidate pool for the longest demonstrations while preserving clear length separation from the other experimental bins\.
Figure 5:Token\-length distribution of the ANLI R3 candidate examples, displayed using 20 histogram bins\. The top plot shows the token\-length histogram, and the bottom plot reports the number of examples and mean token length \(μ\\mu\) per histogram bin\. Experimental binsB1B\_\{1\},B2B\_\{2\}, andB3B\_\{3\}correspond to histogram bins 1, 4, and 7, respectively;B4B\_\{4\}combines histogram bins 10–20\.相似文章
更少的令牌,更多的自我教学:极端视觉令牌缩减的策略内自蒸馏
本文提出了LT-OPD,一个用于多模态大语言模型中极端视觉令牌缩减的策略内自蒸馏框架,在低令牌预算下显著提升性能,同时减少KV缓存使用和FLOPs。
不要过早停止长上下文持续预训练:一条经验缩放定律
该论文提出了一种经验性加法幂律,将长上下文持续预训练(LCCP)的收益与模型规模及短/长上下文token预算关联起来,并引入Constant-Last4协议实现稳定监控。实验表明LCCP的收益在评测范围内无明显饱和迹象,主张不应过早停止长上下文持续预训练。
选择、压缩、再投资:长视频多模态语言模型中视觉令牌分配的控制性研究
本文对长视频多模态语言模型的视觉令牌分配进行了控制性研究,发现帧选择显著提升准确性,而空间压缩在节省的令牌重新投资到更多帧时几乎是免费的,强调了统一比较框架的必要性。
记忆是有代价的:资源约束下学习记忆的价值
论文提出 TokenWorth,一个轻量级在线记忆框架,在严格的资源约束下学习哪些历史经验值得保留和重用,从而在提升终身智能体任务成功率的同时减少 token 消耗。
让每个 Token 都物尽其用:通过 KV 缓存淘汰提升长上下文性能
本文提出了一种基于学习的全局保留率 KV 缓存淘汰方法,通过选择性保留有用 Token 并减少注意力稀释来改善长上下文推理能力,同时显著降低内存占用。