Reproduce “Fine-Tuning Dynamics of In-Context Factual Recall in Transformers” on OpenResearch
Turn your favorite coding agents into research agents that review literature, develop hypotheses, and run experiments.
Universal app for Apple silicon and Intel. Requires macOS 11 or later.
About this paper
Ruomin Huang, Eshaan Nichani, Jason D. Lee, Rong Ge
The paper studies in-context factual recall, where examples identify a relation but the query answer comes from model memory. A one-layer, single-head transformer learns to predict the relation before retrieving the answer, using pairwise attention across subject–answer examples. Under specified assumptions, final-answer accuracy reaches at least 0.99; experiments report often-high relation accuracy with 8 fine-tuning sequences in a constructed setting.
Key insights
- Fine-tuning for IC-recall involves a two-stage dynamic: initial convergence to a saddle point, followed by escape via perturbation, which activates a specific attention mechanism.
- A "pairwise attention pattern" emerges, where attention weights are equal within each in-context (subject, answer) pair but differ between pairs, enabling the model to distinguish correct from confusing relations.
- Transformers can learn to leverage their parametric factual knowledge for IC-recall with high accuracy using a polylogarithmic number of fine-tuning samples relative to the size of the stored knowledge base.
Summary by alphaXiv.
Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.