Research map / Large language models / Language, safety and interpretability
Heads up! Large Language Models Can Perform Tasks Without Your Instruction via Selective Attention Head Masking
Read the paperCheck your idea against 108,967 papers
AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.
Shows that learning a binary attention-head mask over a frozen LLM, with no instructions, can make the model perform tasks like translation and simple NLP tasks, and that the selected heads form interdependent "functional pathways".
Problem
How modules inside LLMs combine to produce distinct task functionalities, and whether task behavior can be elicited without explicit instructions by selecting attention heads.
Approach
Freeze the model and learn a 0/1 attention-head mask via a Gumbel-sigmoid relaxation on task data without instructions; masking out unselected heads makes the model exhibit the task behavior, and the selected heads act as an interdependent functional pathway. Scaling down unselected heads (alpha) can further improve performance.
Key results
- On Llama-3.1-8B-Instruct, the learned mask (removing 15-20% of heads) gives en-zh PPL 1.017 vs 1.091 with explicit instruction and 2.643 for the original model.
- On simple tasks, Llama-3.1-8B-Instruct accuracy on sentiment rises from 0.01 (original) to 0.86 with mask, vs 0.59 with instruction.
- Scaling unselected heads by alpha on IWSLT2017 raises BLEU for en-zh from 0.322 (instructed) to 0.349 (scaled mask).
Measured effects reported in the paper
| What was changed | Where | Measured | Effect |
|---|---|---|---|
| Apply a learned en-zh attention head mask instead of using the unmasked model | Llama3.1-8B-Instruct · XNLI en-zh | PPL: 2.643 -> 1.017 | Helped |
| Replace the learned mask with a random equal-size mask (ablation) | Llama3.1-8B-Instruct · XNLI en-zh | PPL: 1.017 -> 2.909 | Hurt |
| Apply a learned en-zh attention head mask instead of using the unmasked model | Llama3.1-8B · XNLI en-zh | PPL: 2.308 -> 1.158 | Helped |
| Apply a learned en-zh attention head mask instead of explicit translation instructions | Llama3.1-8B-Instruct · XNLI en-zh | ROUGE-L: 0.539 -> 0.589 | Helped |
| Apply task-specific attention head masks without instructions | Llama3.1-8B-Instruct · sentiment, antonym, capitalize first letter, product-company, conll2003 location, fruit v animal | accuracy: 0.01 -> 0.86; 0.12 -> 0.76; 0.15 -> 1.00; 0.06 -> 0.83; 0.00 -> 0.92; 0.00 -> 0.98 | Helped |
| Scale outputs of heads outside the task pathway (ablation) | Llama3.1-8B-Instruct · IWSLT2017 en-zh | BLEU: 0.322 -> 0.347 -> 0.349 | Helped |
| Apply the learned attention mask to the MoE model | Phi-3.5-MoE-Instruct · XNLI translation tasks | ROUGE-L: en->zh: 0.448 -> 0.400; zh->en: 0.519 -> 0.558; en->fr: 0.650 -> 0.361; en->es: 0.674 -> 0.568; en->de: 0.628 -> 0.481; | Hurt |
Surprising findings
- Masking attention heads alone, with no instruction and no parameter change, can switch a model to translation or task behavior.
- Removing unselected heads, or scaling them down, can improve task performance beyond the instructed model.
Limitations
- Small models (e.g., Qwen2.5-0.5B-Instruct) often fail to trigger the target functionality cleanly.
- MoE model (Phi-3.5-MoE) masking triggers behavior switch but does not improve generative metrics.
- Masks are learned per task and require task training data.
Experimental setup
Datasets: Todd et al. (2024) simple tasks (35 datasets) XNLI parallel corpus (en, zh, fr, es, de, ru, ar) IWSLT2017
Benchmarks: XNLI translation (PPL, ROUGE-L) Todd et al. simple tasks (accuracy) IWSLT2017 (BLEU)
Metrics: perplexity ROUGE-L accuracy BLEU Jaccard similarity cosine similarity
Baselines: w/ instruction random mask original model without instruction
Builds on: Gumbel-softmax trick Todd et al. function vectors / task datasets Fang et al. 2024 mask learning
Closest papers by meaning
- Cognitive Mirrors: Exploring the Diverse Functional Roles of Attention Heads in LLM Reasoning (NeurIPS 2025 · similarity 0.88)
- Unveiling and Harnessing Hidden Attention Sinks: Enhancing Large Language Models without Training through Attention Calibration (ICML 2024 · similarity 0.88)
- Who Reasons in the Large Language Models? (NeurIPS 2025 · similarity 0.88)
- Selective Attention Improves Transformer (ICLR 2025 · similarity 0.87)
- LLM Circuit Analyses Are Consistent Across Training and Scale (NeurIPS 2024 · similarity 0.87)
- Focus On This, Not That! Steering LLMs with Adaptive Feature Specification (ICML 2025 · similarity 0.87)
Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.
