mlsanityData to 7 Oct 2026

Trainable Transformer in Transformer

arXiv 2307.01189 ↗First posted 3 Jul 2023cs.CL cs.LGcited by 17

Not on the map. Why?

Abstract (arXiv)

Recent works attribute the capability of in-context learning (ICL) in large pre-trained language models to implicitly simulating and fine-tuning an internal model (e.g., linear or 2-layer MLP) during inference. However, such constructions require large memory overhead, which makes simulation of more sophisticated internal models intractable. In this work, we propose an efficient construction, Transformer in Transformer (in short, TinT), that allows a transformer to simulate and fine-tune complex models internally during inference (e.g., pre-trained language models). In particular, we introduce innovative approximation techniques that allow a TinT model with less than 2 billion parameters to simulate and fine-tune a 125 million parameter transformer model within a single forward pass. TinT accommodates many common transformer variants and its design ideas also improve the efficiency of past instantiations of simple models inside transformers. We conduct end-to-end experiments to validate the internal fine-tuning procedure of TinT on various language modeling and downstream tasks. For example, even with a limited one-step budget, we observe TinT for a OPT-125M model improves performance by 4-16% absolute on average compared to OPT-125M. These findings suggest that large pre-trained language models are capable of performing intricate subroutines. To facilitate further work, a modular and extensible codebase for TinT is included.

Key facts. Cited by 17 papers in the map (data through 7 Oct 2026). Builds on 60 of its 87 references that are in the map. First posted on arXiv 3 Jul 2023.

Builds on

60 of 87 references.

References · 60

  1. 2017Attention Is All You Needcited by 59,932
  2. 2020Language Models are Few-Shot Learnerscited by 32,199
  3. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
  4. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
  5. 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
  6. 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
  7. 2022OPT: Open Pre-trained Transformer Language Modelscited by 3,464
  8. 2016Gaussian Error Linear Units (GELUs)cited by 3,431
  9. 2016Pointer Sentinel Mixture Modelscited by 2,992
  10. 2022Emergent Abilities of Large Language Modelscited by 2,483
  11. 2015Character-level Convolutional Networks for Text Classificationcited by 2,293
  12. 2022BLOOM: A 176B-Parameter Open-Access Multilingual Language Modelcited by 1,968
38 more
  1. 2020GLU Variants Improve Transformercited by 1,724
  2. 2016Concrete Problems in AI Safetycited by 1,582
  3. 2018Group Normalizationcited by 1,514
  4. 2019Root Mean Square Layer Normalizationcited by 1,425
  5. 2021Improving language models by retrieving from trillions of tokenscited by 1,278
  6. 2020Leveraging Passage Retrieval with Generative Models for Open Domain Question Answeringcited by 1,203
  7. 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,130
  8. 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
  9. 2021A General Language Assistant as a Laboratory for Alignmentcited by 1,023
  10. 2022Atlas: Few-shot Learning with Retrieval Augmented Language Modelscited by 940
  11. 2022In-context Learning and Induction Headscited by 930
  12. 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 915
  13. 2022Few-Shot Parameter-Efficient Fine-Tuning is Better and Cheaper than In-Context Learningcited by 886
  14. 2023Progress measures for grokking via mechanistic interpretabilitycited by 822
  15. 2022Transformers learn in-context by gradient descentcited by 714
  16. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
  17. 2023Towards Automated Circuit Discovery for Mechanistic Interpretabilitycited by 700
  18. 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 671
  19. 2018Scalable agent alignment via reward modeling: a research directioncited by 438
  20. 2023Fine-Tuning Language Models with Just Forward Passescited by 337
  21. 2018Generating Wikipedia by Summarizing Long Sequencescited by 333
  22. 2023Trained Transformers Learn Linear Models In-Contextcited by 331
  23. 2022Data Distributional Properties Drive Emergent In-Context Learning in Transformerscited by 303
  24. 2022UL2: Unifying Language Learning Paradigmscited by 292
  25. 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 291
  26. 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 274
  27. 2022Transformers Learn Shortcuts to Automatacited by 260
  28. 2021Surface Form Competition: Why the Highest Probability Answer Isn't Always Rightcited by 256
  29. 2016Equilibrium Propagation: Bridging the Gap Between Energy-Based Models and Backpropagationcited by 251
  30. 2022Exploring Length Generalization in Large Language Modelscited by 204
  31. 2021Thinking Like Transformerscited by 182
  32. 2016Using Fast Weights to Attend to the Recent Pastcited by 161
  33. 2021Inductive Biases and Variable Creation in Self-Attention Mechanismscited by 144
  34. 2023A Toy Model of Universality: Reverse Engineering How Networks Learn Group Operationscited by 141
  35. 2019On the Turing Completeness of Modern Neural Network Architecturescited by 129
  36. 2023The Learnability of In-Context Learningcited by 126
  37. 2023What and How does In-Context Learning Learn? Bayesian Model Averaging, Parameterization, and Generalizationcited by 112
  38. 2021Self-Attention Networks Can Process Bounded Hierarchical Languagescited by 105

50 most cited of 60 All 60 (JSON)

Built on by

Cited by year

Citing papers per year: 2023: 10; 2024: 6; 2025: 1.

17 papers.

Sort:

By area:

  1. 2023In-Context Unlearning: Language Models as Few Shot Unlearnerscited by 214
  2. 2024Can Looped Transformers Learn to Implement Multi-step Gradient Descent for In-context Learning?cited by 60
  3. 2024Why Larger Language Models Do In-context Learning Differently?cited by 44
  4. 2023A Fast Optimization View: Reformulating Single Layer Attention in LLM Based on Tensor and SVM Trick, and Solving It in Matrix Multiplication Timecited by 30
  5. 2024The Fine-Grained Complexity of Gradient Computation for Training Large Language Modelscited by 30
  6. 2023How to Protect Copyright Data in Optimization of Large Language Models?cited by 26
  7. 2024Transformers Provably Learn Sparse Token Selection While Fully-Connected Nets Cannotcited by 21
  8. 2023Why Softmax Attention Outperforms Linear Attentioncited by 15
  9. 2023Unmasking Transformers: A Theoretical Approach to Data Recovery via Attention Weightscited by 11
  10. 2024On the Role of Depth and Looping for In-Context Learning with Task Diversitycited by 11
  11. 2023Local Convergence of Approximate Newton Method for Two Layer Nonlinear Regressioncited by 9
  12. 2023The Expressibility of Polynomial based Attention Schemecited by 7
5 more
  1. 2023Convergence of Two-Layer Regression with Nonlinear Unitscited by 6
  2. 2023A Theoretical Insight into Attack and Defense of Gradient Leakage in Transformercited by 6
  3. 2023One Pass Streaming Algorithm for Super Long Token Attention Approximation in Sublinear Spacecited by 6
  4. 2025Subquadratic Algorithms and Hardness for Attention with Any Temperaturecited by 4
  5. 2024Representing Rule-based Chatbots with Transformerscited by 1