Research map / Architectures and efficiency / Attention and transformers
Why Larger Language Models Do In-context Learning Differently?
Read the paperCheck your idea against 108,967 papers
AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.
Theoretically analyzes why larger transformers are more sensitive to noise in in-context learning, via closed-form optimal solutions for rank-constrained linear self-attention (regression) and multi-head two-layer transformers (sparse parity), and checks the trend with Llama 2 experiments on five NLP classification tasks.
Problem
Explaining why larger LLMs are more sensitive to noisy in-context examples than smaller ones, a behavior difference across model scales in in-context learning that existing theory does not explain.
Approach
Model scale is measured by attention rank (linear regression) or number of attention heads (parity). Closed-form optimal solutions show smaller models keep only the most important hidden feature directions, while larger models also cover less important and noisy features, so larger models are more distracted by label and input noise at inference.
Key results
- Smaller models (Llama 2-13b) stay flat under increasing label flips and rarely fall below random, while larger models (Llama 2-70b) are increasingly affected by flipped labels, with the effect stronger for base models than chat models.
- Ablation with GSM-IC irrelevant sentences: Llama 2-13b attends mainly to the relevant input, while Llama 2-70b attends to both relevant and irrelevant sentences.
- Theory: the rank-r optimal solution keeps only the top-r eigen-directions; the parity analysis gives a noise-energy ratio of (nu1+1)/(nu2+1) between small and large models.
Measured effects reported in the paper
| What was changed | Where | Measured | Effect |
|---|---|---|---|
| increase model rank from r to r' | optimal rank-r linear self-attention transformer · linear regression ICL, evaluation task uses only the top r features | evaluation loss: {1\over M} \left(\|\mathbf{s} \|_\mathbf{D}^2 + \sigma^2\right) \left(\sum_{i = {r}+1}^{{r'}} \left({N \lambda_i \over { | Hurt |
| increase model rank while evaluation tasks contain residual useful features | optimal rank-r linear self-attention transformer · linear regression ICL with label or input noise | evaluation loss | Mixed |
| increase model head number to cover more features | two-layer multiple-head transformer · sparse parity classification ICL | noise influence: {\nu_1+1 \over \nu_2+1} | Hurt |
| increase Llama model size | Llama chat models · five binary classification NLP tasks, 16-shot ICL with flipped labels | accuracy | Hurt |
| increase Llama model size | Llama base models · five binary classification NLP tasks, 16-shot ICL with flipped labels | accuracy | Hurt |
| use a larger model | Llama model families · five binary classification NLP tasks with 0% label flips | accuracy | Helped |
| concatenate an irrelevant GSM-IC sentence to an SST-2 input-label pair (ablation) | Llama 2-13b and Llama 2-70b · SST-2 attention analysis, 100 evaluation prompts | attention correlation magnitude | Mixed |
Surprising findings
- Instruction-tuned (chat) models show the robustness gap less strongly than base models, and the authors note this is consistent with instruction tuning impairing ICL.
- Larger models override pretraining label biases in-context more readily, which makes them more harmed by noisy demonstration labels.
Limitations
- Theory covers only stylized settings (one-layer linear self-attention for regression; two-layer multi-head reduced attention for parity) and does not extend easily to real multi-layer transformers.
- Optimization trajectory is not studied.
- Experiments use simple binary classification datasets, a gap from practical LLM usage.
Experimental setup
Datasets: GLUE Subj GSM-IC
Benchmarks: SST-2 GLUE Subj
Metrics: accuracy attention norm magnitude
Builds on: linear self-attention learning to learn in-context (Ahn et al. / Zhang et al.) sparse parity learning Larger language models do in-context learning differently (Wei et al. 2023)
Closest papers by meaning
- Position: Do pretrained Transformers Learn In-Context by Gradient Descent? (ICML 2024 · similarity 0.90)
- Dual Operating Modes of In-Context Learning (ICML 2024 · similarity 0.90)
- In-Context Language Learning: Architectures and Algorithms (ICML 2024 · similarity 0.89)
- Is attention required for ICL? Exploring the Relationship Between Model Architecture and In-Context Learning Ability (ICLR 2024 · similarity 0.89)
- How Do Nonlinear Transformers Learn and Generalize in In-Context Learning? (ICML 2024 · similarity 0.89)
- Beyond task performance: evaluating and reducing the flaws of large multimodal models with in-context-learning (ICLR 2024 · similarity 0.89)
Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.
