Data-scarce Behavior Editing of Language Models

Joykirat Singh, Subhabrata Dutta, Tanmoy Chakraborty2025

TL;DR

This paper introduces TaRot, a novel method for editing the behavior of large language models (LLMs) without requiring extensive task-specific data or manual intervention. TaRot achieves this by learning to rotate internal representations within attention heads, effectively fine-tuning the model's behavior in a data-efficient and generalizable manner.

What Problem Does This Paper Address?

Large Language Models (LLMs) are incredibly powerful, but they often learn spurious associations from their vast pretraining data. This can lead to undesirable behaviors like hallucination, harmful text generation, and brittle performance on specific tasks. While fine-tuning can help, it's often data-inefficient and can lead to catastrophic forgetting of pre-trained abilities. Existing methods for intervening in LLM behavior, like mechanistic interpretability approaches, require intensive manual effort to pinpoint specific neural components and design interventions. This paper aims to address the challenge of efficiently and effectively editing LLM behavior to improve task performance and reduce undesirable outputs, without the need for extensive labeled data or deep dives into specific neural circuits.

Methods

The core of TaRot lies in its novel intervention technique: Task-aware Rotation of token-association (TaRot). The authors hypothesize that attention heads in Transformers act like mini-language models, memorizing token associations. TaRot intervenes by learning learnable rotation matrices that are applied to the outputs of attention heads. These rotations are optimized using Bayesian optimization on a small set of labeled examples (6-20 per task). This approach aims to align the internal representations of attention heads with desired task-specific behaviors, effectively "editing" the model's learned associations without destroying its existing capabilities. The optimization process is designed to be data-efficient and computationally less demanding than traditional fine-tuning.

Datasets

The paper uses several datasets for evaluation across different tasks:

  • Classification Tasks:
    • AG News
    • Entailed Polarity
    • Navigate
    • Winowhy
  • Natural Language Generation (NLG) Tasks:
    • Imdb Positive Review
    • Detoxify

The authors do not introduce new datasets but leverage existing benchmarks to evaluate TaRot's performance.

Key Insights and Ideas

  • Attention Heads as Mini-LMs: The paper builds on the idea that individual attention heads can be viewed as specialized components that memorize specific token associations, acting like miniature language models.
  • Rotation as a Gentle Edit: Instead of directly ablating or scaling components, TaRot uses rotations to subtly adjust the direction of internal representations. This is hypothesized to be a more robust way to edit behavior without causing catastrophic forgetting or performance drops.
  • Data Efficiency is Key: The success of TaRot hinges on its ability to achieve significant improvements with very few labeled examples, making it practical for scenarios where large labeled datasets are unavailable.
  • Generalizability of Interventions: TaRot aims to provide interventions that are generalizable across different LLMs and tasks, reducing the need for task-specific localization of neural circuits.
  • Bayesian Optimization for Robustness: Using Bayesian optimization for learning the rotation parameters helps find optimal configurations even with limited data and can lead to more robust performance compared to methods that might be sensitive to prompt variations.

Key Results

TaRot consistently demonstrated improved performance across various LLMs and tasks.

  • Classification Tasks: TaRot achieved average improvements of 15.6% (zero-shot) and 14% (few-shot) across models and tasks. It consistently ranked as the best or second-best method.
  • NLG Tasks: TaRot outperformed base models and rescaling approaches on IMDb sentiment classification and toxicity detection tasks, showing improved fluency and task alignment.
  • Robustness to Prompts: TaRot showed significantly less performance degradation across different prompt variations compared to the base model, indicating enhanced reliability and robustness.
  • Data Efficiency: The method requires only 6-20 supervised examples per task, making it highly data-efficient.

Limitations and Future Work

  • Domain Adaptation: TaRot is designed for scenarios where generalization ability is suppressed by noisy memorization. It is limited and not directly applicable for domain adaptation.
  • Proprietary Models: The technique is not applicable to proprietary models where internal access is restricted.
  • Potential for Misuse: Similar to other intervention techniques, TaRot could potentially be used to bypass alignment tuning and reinforce undesired behaviors. The authors suggest developing detection mechanisms and regularization strategies to mitigate this.
  • Larger Models: While TaRot shows promise, its effectiveness might be harder to optimize in very large models due to the increased dimensionality of the rotation space.
  • Theoretical Framework: Future work could involve developing a formal theoretical framework to directly compare rotation-based interventions with rescaling.

Summary updated

BibTeX
@misc{singh2025data,
  author = {Joykirat Singh and Subhabrata Dutta and Tanmoy Chakraborty},
  title = {{Data-scarce Behavior Editing of Language Models}},
  year = {2025},
  doi = {10.18653/v1/2025.findings-emnlp.514},
}
Figure