Skip to main content
QUICK REVIEW

[Paper Review] Fine-Tuning Enhances Existing Mechanisms: A Case Study on Entity Tracking

N. Prakash, Tamar Rott Shaham|arXiv (Cornell University)|Feb 22, 2024
Data Stream Mining TechniquesComputer Science3 citations
TL;DR

This paper investigates how fine-tuning enhances language models' entity tracking ability by analyzing the mechanistic underpinnings in Llama-7B and its fine-tuned variants. Using path-patching, Desiderata-based Component Masking (DCM), and a novel cross-model activation patching method (CMAP), the study reveals that fine-tuning preserves the same core circuit for entity tracking—primarily by improving positional attention to entities—rather than introducing new mechanisms, with the fine-tuned model’s performance gains traced to enhanced handling of positional information.

ABSTRACT

Fine-tuning on generalized tasks such as instruction following, code generation, and mathematics has been shown to enhance language models' performance on a range of tasks. Nevertheless, explanations of how such fine-tuning influences the internal computations in these models remain elusive. We study how fine-tuning affects the internal mechanisms implemented in language models. As a case study, we explore the property of entity tracking, a crucial facet of language comprehension, where models fine-tuned on mathematics have substantial performance gains. We identify the mechanism that enables entity tracking and show that (i) in both the original model and its fine-tuned versions primarily the same circuit implements entity tracking. In fact, the entity tracking circuit of the original model on the fine-tuned versions performs better than the full original model. (ii) The circuits of all the models implement roughly the same functionality: Entity tracking is performed by tracking the position of the correct entity in both the original model and its fine-tuned versions. (iii) Performance boost in the fine-tuned models is primarily attributed to its improved ability to handle the augmented positional information. To uncover these findings, we employ: Patch Patching, DCM, which automatically detects model components responsible for specific semantics, and CMAP, a new approach for patching activations across models to reveal improved mechanisms. Our findings suggest that fine-tuning enhances, rather than fundamentally alters, the mechanistic operation of the model.

Motivation & Objective

  • To understand how fine-tuning on generalized tasks like mathematics enhances specific reasoning capabilities such as entity tracking.
  • To determine whether fine-tuned models implement fundamentally different internal mechanisms for entity tracking compared to the original model.
  • To identify whether performance gains stem from new circuits or improved operation of existing ones.
  • To localize the specific sub-mechanism responsible for performance gains using cross-model activation patching.

Proposed method

  • Path-patching is used to isolate and test the causal contribution of a sparse set of 72 attention heads to entity tracking in both base and fine-tuned models.
  • Desiderata-based Component Masking (DCM) automatically identifies model components responsible for specific semantic subtasks by defining task pairs with controlled semantic alternations.
  • A new method, Cross-Model Activation Patching (CMAP), enables activation transfer between models to localize performance improvements in specific components.
  • The study uses a set of 11 positional desiderata with controlled alternations in entity names and target boxes to probe the model’s reasoning about object positions.
  • The analysis focuses on attention heads and their roles in transporting positional information about entities across the context.
  • Performance is evaluated by measuring how well patched circuits restore entity tracking accuracy in zero-shot settings.

Experimental results

Research questions

  • RQ1Does the entity-tracking circuit in the fine-tuned model differ fundamentally from that in the base model?
  • RQ2Do the same attention heads and circuit structure perform entity tracking in both the base and fine-tuned models?
  • RQ3How does the mechanism of entity tracking—specifically, the role of attention heads—remain consistent across models?
  • RQ4What specific sub-mechanism within the circuit is improved by fine-tuning, and where does the performance gain originate?
  • RQ5Can performance gains be localized to enhanced positional representation or attention to entity locations?

Key findings

  • The same sparse circuit of 72 attention heads, organized in four groups, performs entity tracking in both the base Llama-7B and its fine-tuned variants.
  • The isolated entity-tracking circuit from the fine-tuned model restores at least 88% of the full fine-tuned model’s performance, indicating the circuit’s core functionality is preserved.
  • Entity tracking is achieved not by tracking entity names or properties, but by tracking the position of the queried entity in the context, with multiple head groups collaborating on this task.
  • Fine-tuning does not alter the mechanism; the same functional role and circuit structure are maintained across both LoRA and full fine-tuning.
  • Performance gains are primarily due to improved handling of positional information, enabling better attention to the correct entity’s location.
  • Cross-model activation patching (CMAP) confirms that transferring the entity-tracking circuit’s activations from the fine-tuned model to the base model enhances performance, localizing the improvement to enhanced positional representation.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.