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

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Li, Jiliang, Zhang, Yifan, Karas, Zachary, McMillan, Collin, Leach, Kevin, Huang, Yu
Formato: Preprint
Publicado: 2024
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866913238730407936
author Li, Jiliang
Zhang, Yifan
Karas, Zachary
McMillan, Collin
Leach, Kevin
Huang, Yu
author_facet Li, Jiliang
Zhang, Yifan
Karas, Zachary
McMillan, Collin
Leach, Kevin
Huang, Yu
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2402_14182
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Do Machines and Humans Focus on Similar Code? Exploring Explainability of Large Language Models in Code Summarization
Li, Jiliang
Zhang, Yifan
Karas, Zachary
McMillan, Collin
Leach, Kevin
Huang, Yu
Software Engineering
Artificial Intelligence
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.
title Do Machines and Humans Focus on Similar Code? Exploring Explainability of Large Language Models in Code Summarization
topic Software Engineering
Artificial Intelligence
url https://arxiv.org/abs/2402.14182