acceptodds
Published as a conference paper at NeurIPS 2026

When Does Fine-Tuning Extract Stored Knowledge? A Relation-Covering Theory for One-Layer Transformers

Ruichen Xu, Kexin Chen

Abstract

Large language models may encounter factual knowledge during pre-training yet fail to reliably use that knowledge after fine-tuning. We study this gap in a stylized one-layer self-attention + MLP transformer trained by next-token prediction and subsequently fine-tuned on question-answering data. We first prove that, under suitable regularity conditions, the model reaches near-optimal pre-training loss while learning structured attention patterns. We further show that fine-tuning turns the Q&A prompt format into a trigger for pre-trained relation features, enabling the model to extract facts not revisited during fine-tuning. Our analysis reveals a relation-covering characterization for knowledge extraction: fine-tuning need not revisit every stored fact, but it must cover enough latent relation-template directions through which facts were encoded during pre-training. We prove that extraction improves with pre-training multiplicity and fine-tuning coverage, but becomes harder as the relation-template universe grows. Conversely, insufficient coverage yields a failure regime in which facts can be stored but not extracted, providing a stylized mechanism for hallucination. Our analysis covers both full and low-rank fine-tuning, and experiments on synthetic data and PopQA-based GPT-2/Llama models support the predicted trends.

Keywords:
Sydney, Main Track

Reviews

Among:
Shape:
123456this paper, Bottom 4%
Figure 1. Mean review rating of the reviewed papers at NeurIPS 2026. This paper averages 3.67 over 3 reviews, above 4% of the others.
Reviewer_eieYOpenReview ↗
Rating
4
Clarity
3
Confidence
4
Originality
4
Quality
3
Significance
3
Read review
Summary

The paper studies when fine-tuning enables a transformer to extract factual knowledge learned during pre-training. In a simplified one-layer transformer, the authors show that fine-tuning can generalize to unseen Q&A facts when the fine-tuning data covers enough relation-template directions learned during pre-training. The theory predicts better extraction with more pre-training multiplicity and fine-tuning data, but worse extraction as the relation-template universe grows. The paper also extends the analysis to low-rank fine-tuning and supports the predictions with synthetic and PopQA-based experiments using GPT-2 and Llama-3.2.

Strengths and weaknesses

Strengths. The paper is well motivated, and the main story is clear. Sufficient coverage of relation templates across pre-training and fine-tuning can allow the model to learn a unified representation of the relation, which in turn enables generalization to facts not revisited during fine-tuning. I also find the joint analysis of pre-training and fine-tuning dynamics to be a novel and interesting contribution. It provides a meaningful extension of prior theoretical studies on transformers, which often focus on only one training phase or one architectural component.

Weaknesses. The paper’s setup is somewhat complicated, and the presentation would benefit from a clearer visual illustration of the data-generation process and the pre-training/fine-tuning pipeline.

My main concern is with the relation-covering claim. As I understand the setup, the task is essentially single-topic factual recall, where different “relations” correspond to different phrasings of the same relation, such as “was born in,” “comes from,” and “is a native of.” In this setting, there appears to be a clear shortcut: the model could solve the task by simply memorizing the subject-to-answer mapping s↦as \mapsto a in the MLP layer. Although the authors mention that their next-token prediction construction is designed to avoid direct memorization, I did not find a theoretical or empirical argument showing that the model is not using this shortcut. For example, the claim that knowledge extraction becomes easier when more relation templates are seen during pre-training could alternatively be explained by the fact that larger KK simply provides more training examples for learning s↦as \mapsto a.

A useful diagnostic would be to evaluate whether the model can predict aa from [o,s][o,s] after pre-training, or to consider a genuinely multi-relation setup where the same subject has different answers under different relations, e.g., (Alice,born in)↦California(\text{Alice}, \text{born in}) \mapsto \text{California}, (Alice,speaks)↦English(\text{Alice}, \text{speaks}) \mapsto \text{English}, and (Alice,likes)↦piano(\text{Alice}, \text{likes}) \mapsto \text{piano}. In such a setting, the subject alone would be insufficient, making it easier to distinguish relation-based extraction from subject-answer memorization.

A related issue concerns Table 1, where the authors argue that extraction improves when relevant facts are better represented during pre-training. However, this comparison appears to conflate relation diversity with the number of training examples: frequent facts are seen with multiple relation templates, while rare facts are seen only once. A fairer comparison would control for the number of pre-training examples, for instance by comparing NN diverse relation templates against NN repetitions of the same relation template for rare facts. This experiment would help clarify whether the improvement comes from relation coverage rather than simply from seeing more examples.

Questions
  1. Could the authors provide more evidence that the model is not simply memorizing the mapping s↦as \mapsto a? For example, after pre-training, can the model predict aa from [o,s][o,s] without the relation token? It would also be helpful to test a multi-relation setting where the same subject has different answers for different relations, such as (Alice,born in)↦California(\text{Alice}, \text{born in}) \mapsto \text{California} and (Alice,speaks)↦English(\text{Alice}, \text{speaks}) \mapsto \text{English}.

  2. Could the authors separate the effect of relation diversity from the number of training examples? In the current setup, frequent facts have both more relation templates and more pre-training examples. A useful control would compare NN different relation templates with NN repetitions of the same relation template.

  3. Could the authors also discuss related theoretical work on out-of-context reasoning in transformers, such as [1]? This work also studies the training dynamics of transformers on a factual recall task.

[1] Huang et al. Generalization or hallucination? Understanding out-of-context reasoning in transformers. Advances in Neural Information Processing Systems, 38:139807–139855, 2026.

Limitations

Yes

Paper formatting concerns

N/A

Final justification

My concerns have been resolved by the authors' new experiments.

Reviewer_TXyPOpenReview ↗
Rating
3
Clarity
2
Confidence
4
Originality
3
Quality
2
Significance
3
Read review
Summary

The paper studies how fine-tuning may lead to generalizing behavior that extracts knowledge from pre-training, by studying training dynamics on a one-layer transformer in a controlled setting involving factual data and various possible "relation templates". Each (subject, attribute) pair appear in pre-training with various relations, and the authors show that fine-tuning is able to "cover" those relations into the prompt-related parameters (even though those relations do not appear in fine-tuning) so that the model is able to re-use its pre-training knowledge. The authors illustrate the role of various problem parameters theoretically and empirically, such as number of relation templates, "multiplicities" K (facts may re-appear multiple times with various relations), and number of facts.

Strengths and weaknesses

The paper studies the important question of how fine-tuning can cheaply enable new mechanisms that leverage pre-training knowledge. The theory appears to be solid and precise, and the writing is generally clear.

However, the story and presentation currently feel a bit confusing and lacks clarity, and I encourage the authors to improve these points:

  • the use of the terminology "relation" in the data setup feels a bit confusing: in typical factual recall scenarios, different relations map a given subject to different attributes, while here it looks like the relations are independent of the subject/attribute pairs, which is confusing. It looks like the relations here are just random distractors that we'd like the model to ignore for better generalization after fine-tuning -- there is probably a better way to frame the story to highlight this?
  • the mechanisms are poorly explained: after reading the main text + appendix A, I am still a bit confused about the mechanisms that allow / prevent generalization. I encourage you to explain this more clearly in the next version, perhaps by providing some mechanistic insights into what the MLP is doing and how it can achieve good performance on subjects not seen during fine-tuning. My understanding is that it learns to map (s, r) -> a (where a is the attribute of s) for basically any relation r, so that fine-tuning somehow needs to map the p vector into an arbitrary or average relation (via the W matrix in the MLP), in order for the MLP to be re-purposed appropriately -- does this seem reasonable?

Additionally, note that there are a couple of recent papers studying a similar question of how fine-tuning extracts pre-training knowledge: here and here.

Typo: L30 - "transformer generalize" -> "transformer to generalize"?

Questions

see weaknesses

Limitations

yes

Paper formatting concerns

n/a

Reviewer_q3dfOpenReview ↗
Rating
4
Clarity
3
Confidence
4
Originality
3
Quality
3
Significance
3
Read review
Summary

The paper studies when fine-tuning enables a pre-trained transformer to extract factual knowledge acquired during pre-training. The authors analyze a simplified one-layer transformer trained by next-token prediction and subsequently fine-tuned on question-answering data. The key contribution is a relation-covering characterization: fine-tuning need not revisit every stored fact, but must cover enough latent relation-template directions through which facts were encoded. Mathematical guarantees are provided for this intuition, success and failure regimes are identified, and the theory is supported with synthetic and PopQA-based experiments using GPT-2 and Llama-3.2-1B.

Strengths and weaknesses

Strengths:

  1. Clean theoretical explanation for why fine-tuning helps extract knowledge already acquired during pre-training. The relation-covering idea is intuitive: fine-tuning need not revisit every fact but must cover enough relation patterns
  2. Provides mathematical guarantees for a previously known intuition, particularly the roles of pre-training multiplicity (K), fine-tuning coverage (βN_f), and relation-template size (|R|)
  3. The one-layer transformer setting is a reasonable starting point for jointly analyzing attention, MLP storage, and fine-tuning dynamics
  4. Synthetic and PopQA-based experiments support the predicted trends
  5. Well thought out and technically interesting paper

Weaknesses

  1. Equation 2 uses X directly as the value representation with no learned value matrix (W_V); this simplification needs justification
  2. The addition of the last token embedding X[-1] resembles a residual connection but its role and impact on the analysis are not explained
  3. No positional encoding is used; since next-token prediction depends heavily on position, the implications of this omission should be discussed
  4. The fixed block-diagonal W_2 is a strong simplification; it is unclear whether the mechanism holds with a learned or dense W_2
  5. The mutual orthogonality assumption on token embeddings (o, d, s_j, r_i, a_j) is unrealistic for natural language; it is also unclear when trained, how orthogonality is enforced
  6. The connection to instruction fine-tuning is underdeveloped; while not required for the core theoretical contribution, experiments on instruction-tuning datasets in the final version would broaden the paper's relevance and appeal to a wider audience
  7. An analysis of how safety fine-tuning suppresses harmful pre-trained content through the lens of relation coverage would be a welcome addition to the final version, though the current theoretical contribution stands independently without it
Questions

Please see above.

Limitations

Yes, in brief in conclusions section.

Paper formatting concerns

No issues.

1 comment

Thank you for the valuable comments. We address each point below and will revise the manuscript accordingly.

Comment 1: Value projection in Equation (2) and Fixed second MLP layer

Equation 2 uses XX directly as the value representation with no learned value matrix WVW_V; this simplification needs justification.

The fixed block-diagonal W2\mathbf{W}_2 is a strong simplification; it is unclear whether the mechanism holds with a learned or dense W2\mathbf{W}_2.

Response. Thank you for raising these questions. The assumptions WV=I\mathbf{W}_V=\mathbf{I} and fixed block-diagonal W2\mathbf{W}_2 serve the same analytical purpose: They make the training-dynamics analysis tractable while preserving the knowledge-extraction behavior observed in standard Transformers.

Consistent qualitative trend. We train a standard one-layer Transformer end to end, with a learned value projection and a learned dense MLP second-layer projection. We fix K=3K=3, N=100N=100, and vary the relation-template universe size ∣R∣|\mathcal{R}|. The results are shown below.

R\mathcal{R}PT training lossHeld-out extraction accuracy
200.1046100.00%
400.116095.00%
600.122583.75%
800.119267.50%
1000.130450.00%
1200.113861.25%
1500.119343.75%

Despite finite-sample fluctuations, the standard one-layer Transformer exhibits the same overall qualitative dependence predicted by the theory: held-out extraction becomes more difficult as ∣R∣|\mathcal{R}| increases. Meanwhile, the pre-training loss remains in a similar range across the settings, suggesting that the decline in extraction accuracy is not simply caused by failure to fit the pre-training data.

These results indicate that the observed relation-coverage trend persists after replacing both the identity value map and the fixed block-diagonal second MLP layer with learned dense projections.

Analytical tractability. Specifically, if W2\mathbf{W}_2 is learned, the MLP becomes the nonlinear two-factor model $\mathbf{W}_2 \sigma\left(\mathbf{W}_1\mathbf{x}_a\right).$

If WV\mathbf{W}_V is learned, even with fixed W2\mathbf{W}_2, the model contains the coupled parameterization $\mathbf{W}_2 \sigma\left( \mathbf{W}_1 \left( \mathbf{W}_V\mathbf{X}\boldsymbol{\alpha} + \mathbf{X}[-1] \right) \right),$ where the dynamics of W1\mathbf{W}_1 and WV\mathbf{W}_V interact through the ReLU gates. Relaxing either assumption therefore introduces a nonlinear two-factor subproblem, while relaxing both introduces an even more strongly coupled system.

Even substantially simpler two-factor matrix-factorization models generally require specialized objectives, initialization conditions, and structural assumptions for trajectory-level analyses. Fully characterizing the polynomial-horizon gradient-descent dynamics in our setting, which additionally contains attention, residual connections, ReLU activation, and cross-entropy loss, is beyond the scope of the current proof. We will make this analytical motivation and limitation explicit.

We will add this experiment and clarify that the architectural restrictions are required for the current proof, rather than for the empirical phenomenon itself.

Comment 2: Residual connection

The addition of the last token embedding X[−1]\mathbf{X}[-1] resembles a residual connection but its role and impact on the analysis are not explained.

Response. Thank you for pointing this out. The term X[−1]\mathbf X[-1] models the standard residual connection around the self-attention module and keeps our simplified architecture closer to a standard Transformer.

This residual term is not essential to the qualitative mechanism. Without it, the final token still reaches the MLP through attention with a weight bounded away from zero, as suggested by our balanced-attention results. We will clarify its role and impact on the analysis in the revised manuscript.

Comment 3: Positional encoding

No positional encoding is used; since next-token prediction depends heavily on position, the implications of this omission should be discussed.

Response. Thanks for the comment. Although we omit positional encodings, the model remains autoregressive because training uses a causal mask, and each prediction is computed only from the current and preceding tokens. We deliberately omit positional encodings to isolate the content-based mechanism. Because the synthetic sequences use a fixed format, absolute positional features could provide a shortcut for identifying token roles.. This setting therefore tests whether generalization follows from learned subject and relation features rather than absolute position.

Comment 4: The mutual orthogonality assumption

The mutual orthogonality assumption on token embeddings (o, d, s_j, r_i, a_j) is unrealistic for natural language; it is also unclear when trained, how orthogonality is enforced

Response. We thank the reviewer for raising this point. In our theoretical model, the token embeddings are fixed, non-trainable vectors chosen to satisfy the stated orthogonality condition. Training updates only the attention parameter Z\mathbf{Z} and the MLP parameter W\mathbf{W}, so the embedding geometry remains unchanged throughout optimization. Thus, orthogonality is part of the theoretical problem setup and is not enforced dynamically during training. Orthogonality is a widely adopted analytical idealization that separates the roles of the context, subject, relation, and answer features and removes cross-feature terms from the training-dynamics analysis.

Our experiments relax this condition: the additional synthetic experiment uses independently sampled Gaussian embeddings, while the GPT-2 and Llama experiments use standard learned representations and exhibit the same qualitative trends. The current theorem relies on exact orthogonality, and extending it to approximately orthogonal or incoherent embeddings is a natural future direction. We will clarify these points in the revised paper.

Comment 5: Instruction and safety fine-tuning

Response. We thank the reviewer for these suggestions. Our Q&A fine-tuning setting may be viewed as a stylized abstraction of one limited aspect of instruction fine-tuning, with the shared token pp representing a downstream instruction or response format. We do not intend the current model to capture instruction tuning in its full generality. Our analysis only studies how a single new format interacts with factual features acquired during pre-training. We will clarify this limited connection and discuss the additional ingredients needed to extend the framework to heterogeneous instructions and multi-task settings.

The relation-covering perspective suggests a natural hypothesis for safety fine-tuning: suppressing an undesirable pre-trained behavior may require the safety data to cover the prompt or feature directions through which that behavior is expressed. Insufficient coverage may leave the behavior accessible under unseen formulations. A formal treatment would require modeling refusal targets, competing safe and harmful outputs, and capability trade-offs, which are outside the current factual-extraction setting. We will add this connection as a clearly scoped direction for future work.

Comments on the paper

1 comment
Meta-review

This paper develops a theoretical framework for understanding when fine-tuning enables a transformer to extract factual knowledge acquired during pre-training. The reviewers generally found the problem important, and I find the relation-covering perspective novel and technically meaningful. During the discussion, the authors provided useful clarifications regarding the theoretical assumptions, the scope of the results, and the connection between the theory and experiments, which addressed many of the concerns raised in the reviews.

The theoretical setting remains stylized, and some assumptions and limitations should be stated more clearly in the final version. I also acknowledge the remaining concerns raised by the negative reviewer. However, after independently assessing the paper, my judgment is that these limitations do not outweigh the novelty and technical value of the main contribution. I therefore view the paper positively overall and recommend acceptance.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.