mlsanityData to 14 Oct 2026

Transformers generalize differently from information stored in context vs in weights

arXiv 2210.05675 ↗First posted 11 Oct 2022cs.CL cs.AI cs.LGcited by 49

Not on the map. Why?

Abstract (arXiv)

Transformer models can use two fundamentally different kinds of information: information stored in weights during training, and information provided ``in-context'' at inference time. In this work, we show that transformers exhibit different inductive biases in how they represent and generalize from the information in these two sources. In particular, we characterize whether they generalize via parsimonious rules (rule-based generalization) or via direct comparison with observed examples (exemplar-based generalization). This is of important practical consequence, as it informs whether to encode information in weights or in context, depending on how we want models to use that information. In transformers trained on controlled stimuli, we find that generalization from weights is more rule-based whereas generalization from context is largely exemplar-based. In contrast, we find that in transformers pre-trained on natural language, in-context learning is significantly rule-based, with larger models showing more rule-basedness. We hypothesise that rule-based generalization from in-context information might be an emergent consequence of large-scale training on language, which has sparse rule-like structure. Using controlled stimuli, we verify that transformers pretrained on data containing sparse rule-like structure exhibit more rule-based generalization.

Key facts. Cited by 49 papers in the map (data through 14 Oct 2026). Builds on 12 of its 16 references that are in the map. First posted on arXiv 11 Oct 2022.

Builds on

12 of 16 references.

References · 12

  1. 2017Attention Is All You Needcited by 60,361
  2. 2020Language Models are Few-Shot Learnerscited by 32,419
  3. 2021Prefix-Tuning: Optimizing Continuous Prompts for Generationcited by 3,915
  4. 2021The Power of Scale for Parameter-Efficient Prompt Tuningcited by 3,795
  5. 2022Training Compute-Optimal Large Language Modelscited by 3,019
  6. 2019Invariant Risk Minimizationcited by 1,854
  7. 2018ImageNet-trained CNNs are biased towards texture; increasing shape bias improves accuracy and robustnesscited by 1,432
  8. 2019Does Learning Require Memorization? A Short Tale about a Long Tailcited by 460
  9. 2022Data Distributional Properties Drive Emergent In-Context Learning in Transformerscited by 309
  10. 2022Black-Box Tuning for Language-Model-as-a-Servicecited by 256
  11. 2019When redundancy is useful: A Bayesian approach to 'overinformative' referring expressionscited by 21
  12. 2021Distinguishing rule- and exemplar-based generalization in learning systemscited by 12

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2022: 4; 2023: 16; 2024: 12; 2025: 8; 2026: 9.

49 papers.

Sort:

By area:

  1. 2022Transformers learn in-context by gradient descentcited by 732
  2. 2023Generating Images with Multimodal Language Modelscited by 260
  3. 2024Many-Shot In-Context Learningcited by 206
  4. 2023Large Language Models as General Pattern Machinescited by 197
  5. 2023Uncovering mesa-optimization algorithms in Transformerscited by 100
  6. 2023In-Context Learning through the Bayesian Prismcited by 83
  7. 2022Rethinking the Role of Scale for In-Context Learning: An Interpretability-based Case Study at 66 Billion Scalecited by 64
  8. 2023In-Context Learning Learns Label Relationships but Is Not Conventional Learningcited by 51
  9. 2023Measuring Inductive Biases of In-Context Learning with Underspecified Demonstrationscited by 49
  10. 2024VisualWebArena: Evaluating Multimodal Agents on Realistic Visual Web Taskscited by 47
  11. 2022HyperTuning: Toward Adapting Large Language Models without Back-propagationcited by 46
  12. 2023Distilling and Retrieving Generalizable Knowledge for Robot Manipulation via Language Correctionscited by 45
37 more
  1. 2025On the generalization of language models from in-context learning and finetuning: a controlled studycited by 40
  2. 2023Generalization to New Sequential Decision Making Tasks with In-Context Learningcited by 39
  3. 2024The broader spectrum of in-context learningcited by 35
  4. 2024On the Out-Of-Distribution Generalization of Multimodal Large Language Modelscited by 30
  5. 2025Belief Dynamics Reveal the Dual Nature of In-Context Learning and Activation Steeringcited by 29
  6. 2023A Closer Look at In-Context Learning under Distribution Shiftscited by 25
  7. 2023In-context Learning Generalizes, But Not Always Robustly: The Case of Syntaxcited by 22
  8. 2023Passive learning of active causal strategies in agents and language modelscited by 21
  9. 2024When does compositional structure yield compositional generalization? A kernel theorycited by 20
  10. 2024LLM Task Interference: An Initial Study on the Impact of Task-Switch in Conversational Historycited by 19
  11. 2024Toward Understanding In-context vs. In-weight Learningcited by 19
  12. 2024Dual Process Learning: Controlling Use of In-Context vs. In-Weights Strategies with Weight Forgettingcited by 15
  13. 2025Latent learning: episodic memory complements parametric learning by enabling flexible reuse of experiencescited by 15
  14. 2023Conceptual structure coheres in human cognition but not in large language modelscited by 14
  15. 2024A Survey to Recent Progress Towards Understanding In-Context Learningcited by 14
  16. 2025Is Random Attention Sufficient for Sequence Modeling? Disentangling Trainable Components in the Transformercited by 12
  17. 2023Ambiguity-Aware In-Context Learning with Large Language Modelscited by 11
  18. 2023Breaking through the learning plateaus of in-context learning in Transformercited by 8
  19. 2024Can foundation models actively gather information in interactive environments to test hypotheses?cited by 8
  20. 2023The Cost of Down-Scaling Language Models: Fact Recall Deteriorates before In-Context Learningcited by 7
  21. 2026Learning Next Action Predictors from Human-Computer Interactioncited by 7
  22. 2025Understanding Prompt Tuning and In-Context Learning via Meta-Learningcited by 6
  23. 2026Generative AI collective behavior needs an interactionist paradigmcited by 6
  24. 2024Quantifying artificial intelligence through algorithmic generalizationcited by 5
  25. 2022The KITMUS Test: Evaluating Knowledge Integration from Multiple Sources in Natural Language Understanding Systemscited by 4
  26. 2025Towards Large-Scale In-Context Reinforcement Learning by Meta-Training in Randomized Worldscited by 4
  27. 2024Multi-modal Generation via Cross-Modal In-Context Learningcited by 2
  28. 2026Input Pathways Shape Few-Shot, Not Zero-Shot, Binding in Tiny Transformers: A Fully-Enumerable Studycited by 2
  29. 2023Accelerating Neural Self-Improvement via Bootstrappingcited by 1
  30. 2025Relational reasoning and inductive bias in transformers and large language modelscited by 1
  31. 2026To See the Unseen: on the Generalization Ability of Transformers in Symbolic Reasoningcited by 1
  32. 2026Information Abundance Paradox: Long-Context Training Undermines Parametric Knowledgecited by 1
  33. 2025From Text to Trajectories: GPT-2 as an ODE Solver via In-Contextcited by 0
  34. 2026How Context Attribution Handles What the Model Already Knowscited by 0
  35. 2026Does Episodic Memory Help Close the Lexical Frequency Gap in Sensitivity to Syntactic Contrasts? A Test Using Retrieval-Augmented Language Modelscited by 0
  36. 2026Generalized Context in Cross Attention for Transfer Learning of Disjoint Tabular Datacited by 0
  37. 2026LLMs Learn Better In-Context from Rules than from Examplescited by 0