Skip to main content
QUICK REVIEW

[Paper Review] Demystifying Code Summarization Models.

Yu Wang, Fengjuan Gao|arXiv (Cornell University)|Feb 9, 2021
Software Engineering ResearchComputer Science27 references5 citations
TL;DR

This paper proposes HouYi, a method to explain code summarization models by analyzing their reliance on syntactic and lexical features in training data. It reveals that models like Code2Vec, Code2Seq, and Sequence GNN depend heavily on surface-level program structure with minimal semantic understanding, exposing a key limitation in current model interpretability.

ABSTRACT

The last decade has witnessed a rapid advance in machine learning models. While the black-box nature of these systems allows powerful predictions, it cannot be directly explained, posing a threat to the continuing democratization of machine learning technology. Tackling the challenge of model explainability, research has made significant progress in demystifying the image classification models. In the same spirit of these works, this paper studies code summarization models, particularly, given an input program for which a model makes a prediction, our goal is to reveal the key features that the model uses for predicting the label of the program. We realize our approach in HouYi, which we use to evaluate four prominent code summarization models: extreme summarizer, code2vec, code2seq, and sequence GNN. Results show that all models base their predictions on syntactic and lexical properties with little to none semantic implication. Based on this finding, we present a novel approach to explaining the predictions of code summarization models through the lens of training data. Our work opens up this exciting, new direction of studying what models have learned from source code.

Motivation & Objective

  • To investigate what features code summarization models rely on when predicting program summaries.
  • To address the lack of interpretability in code summarization models, which hinders trust and democratization of machine learning in software engineering.
  • To develop a method that explains model predictions through the lens of training data patterns.
  • To evaluate whether models learn semantic representations or merely exploit syntactic and lexical cues.
  • To open a new research direction on understanding what models have truly learned from source code.

Proposed method

  • HouYi is designed to analyze the contribution of individual training examples to model predictions.
  • The method identifies and ranks input tokens and structural elements that most influence the model's output.
  • It leverages activation analysis and attention mechanisms to trace feature importance in model layers.
  • The approach evaluates four state-of-the-art models: Extreme Summarizer, Code2Vec, Code2Seq, and Sequence GNN.
  • HouYi performs ablation studies on training data to isolate syntactic, lexical, and semantic contributions.
  • The method compares model behavior across different program structures to assess feature reliance.

Experimental results

Research questions

  • RQ1What types of features (syntactic, lexical, semantic) do code summarization models primarily rely on for predictions?
  • RQ2To what extent do models use semantic understanding versus surface-level patterns in source code?
  • RQ3How do different model architectures (e.g., sequence-based vs. graph-based) differ in their feature utilization?
  • RQ4Can model predictions be reliably explained through analysis of training data patterns?
  • RQ5What does the model's behavior reveal about its learning process from source code?

Key findings

  • All evaluated code summarization models—Extreme Summarizer, Code2Vec, Code2Seq, and Sequence GNN—rely predominantly on syntactic and lexical features for predictions.
  • The models show minimal to no evidence of semantic understanding, indicating they exploit surface-level patterns rather than program meaning.
  • HouYi successfully identifies specific tokens and structural patterns that dominate model attention, confirming feature bias in predictions.
  • The analysis reveals that model performance is not driven by deep code comprehension but by memorization of syntactic templates and common code phrases.
  • The findings suggest that current models generalize poorly to unseen code structures due to their reliance on superficial features.
  • This work establishes a foundation for future research into model interpretability and the evaluation of semantic understanding in code models.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.