LLMs Process Lists With General Filter Heads
Not on the map. Why?
Abstract (arXiv)
We investigate the mechanisms underlying a range of list-processing tasks in LLMs, and we find that LLMs have learned to encode a compact, causal representation of a general filtering operation that mirrors the generic "filter" function of functional programming. Using causal mediation analysis on a diverse set of list-processing tasks, we find that a small number of attention heads, which we dub filter heads, encode a compact representation of the filtering predicate in their query states at certain tokens. We demonstrate that this predicate representation is general and portable: it can be extracted and reapplied to execute the same filtering operation on different collections, presented in different formats, languages, or even in tasks. However, we also identify situations where transformer LMs can exploit a different strategy for filtering: eagerly evaluating if an item satisfies the predicate and storing this intermediate result as a flag directly in the item representations. Our results reveal that transformer LMs can develop human-interpretable implementations of abstract computational operations that generalize in ways that are surprisingly similar to strategies used in traditional functional programming patterns.
Key facts. Cited by 7 papers in the map (data through 7 Oct 2026). Builds on 32 of its 49 references that are in the map. First posted on arXiv 30 Oct 2025.
Builds on
32 of 49 references.
References · 32
- 2017Attention Is All You Needcited by 59,932
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,160
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
- 2022Locating and Editing Factual Associations in GPTcited by 2,609
- 2019HuggingFace's Transformers: State-of-the-art Natural Language Processingcited by 2,201
- 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,130
- 2019Attention is not Explanationcited by 916
- 2024Gemma: Open Models Based on Gemini Research and Technologycited by 889
- 2023Progress measures for grokking via mechanistic interpretabilitycited by 822
- 2023Dissecting Recall of Factual Associations in Auto-Regressive Language Modelscited by 512
- 2023Towards Best Practices of Activation Patching in Language Models: Metrics and Methodscited by 328
20 more
- 2023Function Vectors in Large Language Modelscited by 292
- 2023How does GPT-2 compute greater-than?: Interpreting mathematical abilities in a pre-trained language modelcited by 199
- 2023The Clock and the Pizza: Two Stories in Mechanistic Explanation of Neural Networkscited by 153
- 2023Does Circuit Analysis Interpretability Scale? Evidence from Multiple Choice Capabilities in Chinchillacited by 145
- 2023The Hydra Effect: Emergent Self-repair in Language Model Computationscited by 145
- 2024Round and Round We Go! What makes Rotary Positional Encodings useful?cited by 111
- 2023Circuit Component Reuse Across Tasks in Transformer Language Modelscited by 105
- 2023How do Language Models Bind Entities in Context?cited by 102
- 2020Are Neural Nets Modular? Inspecting Functional Modularity Through Differentiable Weight Maskscited by 97
- 2025Language Models Use Trigonometry to Do Additioncited by 68
- 2020How do Decisions Emerge across Layers in Neural Models? Interpretation with Differentiable Maskingcited by 63
- 2024Separating Tongue from Thought: Activation Patching Reveals Language-Agnostic Concept Representations in Transformerscited by 42
- 2024Talking Heads: Understanding Inter-layer Communication in Transformer Language Modelscited by 39
- 2025Language Models use Lookbacks to Track Beliefscited by 36
- 2024Locating and Editing Factual Associations in Mambacited by 35
- 2024Answer, Assemble, Ace: Understanding How LMs Answer Multiple Choice Questionscited by 35
- 2023Discovering Variable Binding Circuitry with Desideratacited by 32
- 2025Emergent Symbolic Mechanisms Support Abstract Reasoning in Large Language Modelscited by 31
- 2025The Dual-Route Model of Inductioncited by 22
- 2023In-Context Probing: Toward Building Robust Classifiers via Probing Large Language Modelscited by 3
Built on by
Citing papers per year: 2026: 7.
7 papers.
- 2026The Story is Not the Science: Execution-Grounded Evaluation of Mechanistic Interpretability Researchcited by 6
- 2026Decomposing Query-Key Feature Interactions Using Contrastive Covariancescited by 3
- 2026Invariant Learning Dynamics of Transformers in Inductive Reasoning Taskscited by 1
- 2026Test, then Route: How Language Models Execute In-Context Conditional Rules Across Models and Languagescited by 1
- 2026Inference Time Causal Probing in LLMscited by 0
- 2026Using OCR Heads to Verbalize Image Semanticscited by 0
- 2026The Key Handoff: Retrieval in Hybrid Language Modelscited by 0
- 2026The Key Handoff: Retrieval in Hybrid Language Models26 Sep 2026
- 2026Using OCR Heads to Verbalize Image Semantics16 Sep 2026
- 2026Test, then Route: How Language Models Execute In-Context Conditional Rules Across Models and Languages4 Aug 2026
- 2026Invariant Learning Dynamics of Transformers in Inductive Reasoning Tasks13 Jul 2026
- 2026Inference Time Causal Probing in LLMs8 May 2026
- 2026The Story is Not the Science: Execution-Grounded Evaluation of Mechanistic Interpretability Research5 Feb 2026
- 2026Decomposing Query-Key Feature Interactions Using Contrastive Covariances4 Feb 2026