Follow-up Attention: An Empirical Study of Developer and Neural Model Code Exploration
Not on the map. Why?
Abstract (arXiv)
Recent neural models of code, such as OpenAI Codex and AlphaCode, have demonstrated remarkable proficiency at code generation due to the underlying attention mechanism. However, it often remains unclear how the models actually process code, and to what extent their reasoning and the way their attention mechanism scans the code matches the patterns of developers. A poor understanding of the model reasoning process limits the way in which current neural models are leveraged today, so far mostly for their raw prediction. To fill this gap, this work studies how the processed attention signal of three open large language models - CodeGen, InCoder and GPT-J - agrees with how developers look at and explore code when each answers the same sensemaking questions about code. Furthermore, we contribute an open-source eye-tracking dataset comprising 92 manually-labeled sessions from 25 developers engaged in sensemaking tasks. We empirically evaluate five heuristics that do not use the attention and ten attention-based post-processing approaches of the attention signal of CodeGen against our ground truth of developers exploring code, including the novel concept of follow-up attention which exhibits the highest agreement between model and human attention. Our follow-up attention method can predict the next line a developer will look at with 47% accuracy. This outperforms the baseline prediction accuracy of 42.3%, which uses the session history of other developers to recommend the next line. These results demonstrate the potential of leveraging the attention signal of pre-trained models for effective code exploration.
Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). Builds on 32 of its 74 references that are in the map. First posted on arXiv 11 Oct 2022.
Builds on
32 of 74 references.
References · 32
- 2017Attention Is All You Needcited by 60,361
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,548
- 2015Neural Machine Translation of Rare Words with Subword Unitscited by 2,918
- 2022Competition-Level Code Generation with AlphaCodecited by 1,462
- 2019Attention is not Explanationcited by 929
- 2015Pointer Networkscited by 895
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 885
- 2020Quantifying Attention Flow in Transformerscited by 775
- 2020Transformer Interpretability Beyond Attention Visualizationcited by 627
- 2021Prompt Programming for Large Language Models: Beyond the Few-Shot Paradigmcited by 606
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 498
20 more
- 2017A Structured Self-attentive Sentence Embeddingcited by 318
- 2019Analyzing the Structure of Attention in a Transformer Language Modelcited by 243
- 2017Learning to Represent Programs with Graphscited by 220
- 2020Deep Learning based Vulnerability Detection: Are We There Yet?cited by 144
- 2020A Transformer-based Approach for Source Code Summarizationcited by 133
- 2022Few-shot training LLMs for project-specific code-summarizationcited by 129
- 2019On Identifiability in Transformerscited by 116
- 2022Repository-Level Prompt Generation for Large Language Models of Codecited by 106
- 2022Less Training, More Repairing Please: Revisiting Automated Program Repair via Zero-shot Learningcited by 76
- 2019Attention Interpretability Across NLP Taskscited by 71
- 2018DeepBugs: A Learning Approach to Name-based Bug Detectioncited by 65
- 2022What Do They Capture? -- A Structural Analysis of Pre-Trained Language Models for Source Codecited by 50
- 2022Code Generation Tools (Almost) for Free? A Study of Few-Shot, Pre-Trained Language Models on Codecited by 39
- 2021Automatic Program Repair with OpenAI's Codex: Evaluating QuixBugscited by 25
- 2021Understanding Neural Code Intelligence Through Program Simplificationcited by 22
- 2020Staying True to Your Word: (How) Can Attention Become Explanation?cited by 18
- 2022What does Transformer learn about source code?cited by 9
- 2019Neural Bug Finding: A Study of Opportunities and Challengescited by 6
- 2021gazel: Supporting Source Code Edits in Eye-Tracking Studiescited by 2
- 202240 Years of Designing Code Comprehension Experiments: A Systematic Mapping Studycited by 1
Built on by
Citing papers per year: 2023: 2; 2024: 1; 2025: 1; 2026: 1.
5 papers.
- 2024Do Machines and Humans Focus on Similar Code? Exploring Explainability of Large Language Models in Code Summarizationcited by 16
- 2025Mechanistic Interpretability of Code Correctness in LLMs via Sparse Autoencoderscited by 5
- 2023Do Language Models Learn Semantics of Code? A Case Study in Vulnerability Detectioncited by 4
- 2023INSPECT: Intrinsic and Systematic Probing Evaluation for Code Transformerscited by 2
- 2026How Do LLMs Read Bug Reports? An Empirical Study of Attention in LLMs for Automated Program Repaircited by 0
- 2026How Do LLMs Read Bug Reports? An Empirical Study of Attention in LLMs for Automated Program Repair28 Jul 2026
- 2025Mechanistic Interpretability of Code Correctness in LLMs via Sparse Autoencoders3 Oct 2025
- 2024Do Machines and Humans Focus on Similar Code? Exploring Explainability of Large Language Models in Code Summarization22 Feb 2024
- 2023INSPECT: Intrinsic and Systematic Probing Evaluation for Code Transformers8 Dec 2023
- 2023Do Language Models Learn Semantics of Code? A Case Study in Vulnerability Detection7 Nov 2023
Similar, not cited
Close in wording, no citation either way
- 2026Automated Attention Pattern Discovery at Scale in Large Language Models
- 2023Code Prompting: a Neural Symbolic Method for Complex Reasoning in Large Language Models
- 2026What, Where, and How: Disentangling the Roles of Task, Language, and Model in Code Model Representations
- 2019Toward Imitating Visual Attention of Experts in Software Development Tasks ↗
- 2026Latent Programming Horizons in Coding Agents
- 2025An Empirical Study of Reasoning Steps in Thinking Code LLMs
- 2024A new approach for encoding code and assisting code understanding
- 2025SWE-IF: Aligning Code Evaluation with Human Preference