[Paper Review] In-Context Learning with Many Demonstration Examples
This paper introduces EvaLM, a long-range language model based on an efficient transformer architecture that supports up to 256k context length through circular position embedding and incremental encoding. It enables high-performance in-context learning with many demonstration examples, achieving 4.1% higher average accuracy than comparable models, with minimal computational overhead due to efficient inference and extrapolation techniques.
Large pre-training language models (PLMs) have shown promising in-context learning abilities. However, due to the backbone transformer architecture, existing PLMs are bottlenecked by the memory and computational cost when scaling up to a large context size, leaving instruction tuning and in-context learning of many demonstration examples, as well as long-range language modeling under-explored. In this study, we propose a long-range language model EVALM based on an efficient transformer mechanism. EVALM is trained with 8k tokens per batch line and can test up to 256k-lengthed contexts with extrapolation, 128 times to the limit of existing PLMs (e.g. GPT3). Based on EVALM, we scale up the size of examples efficiently in both instruction tuning and in-context learning to explore the boundary of the benefits from more annotated data. Experimental results on a diverse set of tasks show that EVALM achieves 4.1% higher accuracy on average, and the average length of achieving the best accuracy score over tasks is around 12k. We find that in-context learning can achieve higher performance with more demonstrations under many-shot instruction tuning (8k), and further extending the length of instructions (16k) can further improve the upper bound of scaling in-context learning.
Motivation & Objective
- To address the computational and memory bottleneck in long-context in-context learning (ICL) due to standard transformer architectures.
- To explore the performance limits of in-context learning when scaling up the number of demonstration examples.
- To enable efficient and extrapolatable long-context modeling for instruction tuning and ICL using a lightweight, scalable language model.
- To investigate whether increasing shot count and instruction length improves ICL performance in long-context settings.
Proposed method
- EvaLM is pre-trained using an efficient transformer mechanism (EVA) with modifications to support extrapolation of position embeddings.
- Circular position embedding is introduced to enable generalization to longer context lengths beyond the training sequence.
- Incremental encoding is employed to cache and reuse encoded representations of demonstrations, reducing redundant computation during inference.
- The model is fine-tuned with many-shot instruction tuning (MSIT) using up to 8k-shot demonstrations to enhance in-context learning performance.
- Experiments are conducted across 10 diverse NLP tasks with varying prompting strategies to evaluate scalability and effectiveness.
- Efficiency is measured via training FLOPs and inference time, comparing EvaLM to OPT and other baselines.

Experimental results
Research questions
- RQ1Can in-context learning performance be significantly improved by scaling up the number of demonstration examples beyond few-shot settings?
- RQ2How does increasing instruction length affect the performance gain from many-shot instruction tuning in long-context scenarios?
- RQ3To what extent can efficient attention mechanisms and extrapolation techniques enable long-context modeling in pre-trained language models?
- RQ4What is the computational cost of scaling up in-context learning with many-shot demonstrations, and can it be made efficient?
Key findings
- EvaLM achieves 4.1% higher average accuracy across 10 diverse NLP tasks compared to comparable models like OPT, when using many-shot instruction tuning.
- The average input length required to achieve peak accuracy across tasks is approximately 12k tokens, indicating that performance gains emerge at scale.
- Many-shot instruction tuning significantly improves in-context learning performance, especially when combined with longer instructions (up to 16k tokens), showing a more pronounced effect.
- With incremental encoding and caching, the computational overhead of scaling up from few-shot to many-shot ICL is minimal, making it practical for long-context inference.
- EvaLM successfully extrapolates to 256k-length contexts using circular position embeddings, achieving 128× longer context than existing models like GPT-3 (2048 tokens).
- The model demonstrates that performance gains from increasing shot count are not infinite, suggesting a saturation point beyond which marginal improvements diminish.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.