Scaling Attention Head Analysis via Gradient-Based Attribution in Context-Aware Machine Translation
cs.CL, cs.AI
Submitted: 2026-09-23
Updated: 2026-09-23
Code: https://github.com/mjpost/sacrebleu
License: http://creativecommons.org/licenses/by/4.0/
The gist: In this paper, we introduce a gradient-based head attribution strategy where the Token-level Max-Margin loss is backpropagated to the attention maps.
Terminology
Abstract
In this paper, we introduce a gradient-based head attribution strategy where the Token-level Max-Margin loss is backpropagated to the attention maps. This framework enables a large-scale causal analysis of attention heads, making it suitable for LLMs. We evaluate our method on the task of disambiguation in Context-aware Machine Translation, where we analyze 50 phenomena across 4 models and 4 language directions. We empirically show the alignment of our method with the effects of increasing the attention scores of token-to-token relations on three models and two language directions, ensuring the robustness of our method. Our analysis reveals the presence of the "general-purpose" attention heads that improve the model's performance when attending to different relations. We find that the average attention a head assigns to a relation does not necessarily relate to the model's performance, which suggests that the models developed redundancies during training in terms of the head functions.
Sources
- Identifying and Controlling Important Neurons in Neural Machine Translation
- Does Neural Machine Translation Benefit from Larger Context?
- A baseline revisited: Pushing the limits of multi-segment models for context-aware translation
- In-context Learning and Induction Heads
- Escaping the sentence-level paradigm in machine translation
- Qwen2.5 Technical Report
- EuroLLM-22B: Technical Report
- Gemma 3 Technical Report
- Adapting Large Language Models for Document-Level Machine Translation
- Qwen2 Technical Report
Related papers
- Exploring Solution Divergence and Its Effect on Large Language Model Problem Solving
- Ishigaki-IDS-Bench: A Benchmark for Generating Information Delivery Specification from BIM Information Requirements
- Subliminal Steering: Stronger Encoding of Hidden Signals
- MedStruct-S: A Benchmark for Key Discovery, Key-Conditioned QA and Semi-Structured Extraction from OCR Clinical Reports
- The End of Transformers? On Challenging Attention and the Rise of Sub-Quadratic Architectures
- Untangling the Mechanisms of Misleading Context in Medical Question Answering