Do Machines and Humans Focus on Similar Code? Exploring Explainability of Large Language Models in Code Summarization
Not on the map. Why?
Abstract (arXiv)
Recent language models have demonstrated proficiency in summarizing source code. However, as in many other domains of machine learning, language models of code lack sufficient explainability. Informally, we lack a formulaic or intuitive understanding of what and how models learn from code. Explainability of language models can be partially provided if, as the models learn to produce higher-quality code summaries, they also align in deeming the same code parts important as those identified by human programmers. In this paper, we report negative results from our investigation of explainability of language models in code summarization through the lens of human comprehension. We measure human focus on code using eye-tracking metrics such as fixation counts and duration in code summarization tasks. To approximate language model focus, we employ a state-of-the-art model-agnostic, black-box, perturbation-based approach, SHAP (SHapley Additive exPlanations), to identify which code tokens influence that generation of summaries. Using these settings, we find no statistically significant relationship between language models' focus and human programmers' attention. Furthermore, alignment between model and human foci in this setting does not seem to dictate the quality of the LLM-generated summaries. Our study highlights an inability to align human focus with SHAP-based model focus measures. This result calls for future investigation of multiple open questions for explainable language models for code summarization and software engineering tasks in general, including the training mechanisms of language models for code, whether there is an alignment between human and model attention on code, whether human attention can improve the development of language models, and what other model focus measures are appropriate for improving explainability.
Key facts. Cited by 16 papers in the map (data through 7 Oct 2026). Builds on 17 of its 33 references that are in the map. First posted on arXiv 22 Feb 2024.
Builds on
17 of 33 references.
References · 17
- 2017Attention Is All You Needcited by 59,932
- 2017A Unified Approach to Interpreting Model Predictionscited by 6,488
- 2017Axiomatic Attribution for Deep Networkscited by 3,350
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2017Learning Important Features Through Propagating Activation Differencescited by 1,454
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
- 2023StarCoder: may the source be with you!cited by 790
- 2022A Systematic Evaluation of Large Language Models of Codecited by 360
- 2019Attention in Natural Language Processingcited by 100
- 2019Recommendations for Datasets for Source Code Summarizationcited by 46
- 2020Improving Natural Language Processing Tasks with Human Gaze-Guided Neural Attentioncited by 45
- 2016Improving sentence compression by learning to predict gazecited by 24
5 more
- 2022Diet Code Is Healthy: Simplifying Programs for Pre-trained Models of Codecited by 24
- 2022What does Transformer learn about source code?cited by 9
- 2023Modeling Programmer Attention as Scanpath Predictioncited by 7
- 2022Follow-up Attention: An Empirical Study of Developer and Neural Model Code Explorationcited by 5
- 2023Where to Look When Repairing Code? Comparing the Attention of Neural Models and Developerscited by 2
Built on by
Citing papers per year: 2024: 2; 2025: 9; 2026: 5.
16 papers.
Sort:
By area:
- 2024Bugs in Large Language Models Generated Code: An Empirical Studycited by 59
- 2024Beyond Functional Correctness: Investigating Coding Style Inconsistencies in Large Language Modelscited by 15
- 2025Large Language Models (LLMs) for Source Code Analysis: applications, models and datasetscited by 15
- 2025On LLMs' Internal Representation of Code Correctnesscited by 5
- 2025EyeMulator: Improving Code Language Models by Mimicking Human Visual Attentioncited by 4
- 2025Detecting Malicious Source Code in PyPI Packages with LLMs: Does RAG Come in Handy?cited by 3
- 2026ShortCoder: Knowledge-Augmented Syntax Optimization for Token-Efficient Code Generationcited by 3
- 2025Optimizing Code Runtime Performance through Context-Aware Retrieval-Augmented Generationcited by 1
- 2025CONSTRUCTA: Automating Commercial Construction Schedules in Fabrication Facilities with Large Language Modelscited by 1
- 2026SynthFix: Adaptive Neuro-Symbolic Code Vulnerability Repaircited by 1
- 2025Enhancing Code LLM Training with Programmer Attentioncited by 0
- 2025PLEX: Perturbation-free Local Explanations for LLM-Based Text Classificationcited by 0
4 more
- 2025Toward Explaining Large Language Models in Software Engineering Taskscited by 0
- 2026EyeLayer: Integrating Human Attention Patterns into LLM-Based Code Summarizationcited by 0
- 2026Summarization is Not Dead Yetcited by 0
- 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
- 2026Summarization is Not Dead Yet6 Jun 2026
- 2026SynthFix: Adaptive Neuro-Symbolic Code Vulnerability Repair19 Apr 2026
- 2026EyeLayer: Integrating Human Attention Patterns into LLM-Based Code Summarization25 Feb 2026
- 2026ShortCoder: Knowledge-Augmented Syntax Optimization for Token-Efficient Code Generation14 Jan 2026
- 2025Toward Explaining Large Language Models in Software Engineering Tasks23 Dec 2025
- 2025On LLMs' Internal Representation of Code Correctness8 Dec 2025
- 2025EyeMulator: Improving Code Language Models by Mimicking Human Visual Attention22 Aug 2025
- 2025PLEX: Perturbation-free Local Explanations for LLM-Based Text Classification12 Jul 2025
- 2025Detecting Malicious Source Code in PyPI Packages with LLMs: Does RAG Come in Handy?18 Apr 2025
- 2025Large Language Models (LLMs) for Source Code Analysis: applications, models and datasets21 Mar 2025
- 2025Enhancing Code LLM Training with Programmer Attention19 Mar 2025
4 more
- 2025CONSTRUCTA: Automating Commercial Construction Schedules in Fabrication Facilities with Large Language Models17 Feb 2025
- 2025Optimizing Code Runtime Performance through Context-Aware Retrieval-Augmented Generation28 Jan 2025
- 2024Beyond Functional Correctness: Investigating Coding Style Inconsistencies in Large Language Models29 Jun 2024
- 2024Bugs in Large Language Models Generated Code: An Empirical Study13 Mar 2024
- 2024Bugs in Large Language Models Generated Code: An Empirical Studycited by 59
- 2024Beyond Functional Correctness: Investigating Coding Style Inconsistencies in Large Language Modelscited by 15
- 2025Large Language Models (LLMs) for Source Code Analysis: applications, models and datasetscited by 15
- 2025On LLMs' Internal Representation of Code Correctnesscited by 5
- 2025EyeMulator: Improving Code Language Models by Mimicking Human Visual Attentioncited by 4
- 2025CONSTRUCTA: Automating Commercial Construction Schedules in Fabrication Facilities with Large Language Modelscited by 1
- 2026SynthFix: Adaptive Neuro-Symbolic Code Vulnerability Repaircited by 1
- 2025Enhancing Code LLM Training with Programmer Attentioncited by 0
- 2025PLEX: Perturbation-free Local Explanations for LLM-Based Text Classificationcited by 0
- 2025Toward Explaining Large Language Models in Software Engineering Taskscited by 0
- 2026EyeLayer: Integrating Human Attention Patterns into LLM-Based Code Summarizationcited by 0
- 2026Summarization is Not Dead Yetcited by 0
12 most cited of 13 All 13 (JSON)
- 2026How Do LLMs Read Bug Reports? An Empirical Study of Attention in LLMs for Automated Program Repair28 Jul 2026
- 2026Summarization is Not Dead Yet6 Jun 2026
- 2026SynthFix: Adaptive Neuro-Symbolic Code Vulnerability Repair19 Apr 2026
- 2026EyeLayer: Integrating Human Attention Patterns into LLM-Based Code Summarization25 Feb 2026
- 2025Toward Explaining Large Language Models in Software Engineering Tasks23 Dec 2025
- 2025On LLMs' Internal Representation of Code Correctness8 Dec 2025
- 2025EyeMulator: Improving Code Language Models by Mimicking Human Visual Attention22 Aug 2025
- 2025PLEX: Perturbation-free Local Explanations for LLM-Based Text Classification12 Jul 2025
- 2025Large Language Models (LLMs) for Source Code Analysis: applications, models and datasets21 Mar 2025
- 2025Enhancing Code LLM Training with Programmer Attention19 Mar 2025
- 2025CONSTRUCTA: Automating Commercial Construction Schedules in Fabrication Facilities with Large Language Models17 Feb 2025
- 2024Beyond Functional Correctness: Investigating Coding Style Inconsistencies in Large Language Models29 Jun 2024
12 newest of 13 All 13 (JSON)