mlsanityData to 7 Oct 2026

Do Machines and Humans Focus on Similar Code? Exploring Explainability of Large Language Models in Code Summarization

arXiv 2402.14182 ↗First posted 22 Feb 2024cs.SE cs.AIcited by 16

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

  1. 2017Attention Is All You Needcited by 59,932
  2. 2017A Unified Approach to Interpreting Model Predictionscited by 6,488
  3. 2017Axiomatic Attribution for Deep Networkscited by 3,350
  4. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  5. 2017Learning Important Features Through Propagating Activation Differencescited by 1,454
  6. 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
  7. 2023StarCoder: may the source be with you!cited by 790
  8. 2022A Systematic Evaluation of Large Language Models of Codecited by 360
  9. 2019Attention in Natural Language Processingcited by 100
  10. 2019Recommendations for Datasets for Source Code Summarizationcited by 46
  11. 2020Improving Natural Language Processing Tasks with Human Gaze-Guided Neural Attentioncited by 45
  12. 2016Improving sentence compression by learning to predict gazecited by 24
5 more
  1. 2022Diet Code Is Healthy: Simplifying Programs for Pre-trained Models of Codecited by 24
  2. 2022What does Transformer learn about source code?cited by 9
  3. 2023Modeling Programmer Attention as Scanpath Predictioncited by 7
  4. 2022Follow-up Attention: An Empirical Study of Developer and Neural Model Code Explorationcited by 5
  5. 2023Where to Look When Repairing Code? Comparing the Attention of Neural Models and Developerscited by 2

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 2; 2025: 9; 2026: 5.

16 papers.

Sort:

By area: