Abstract
The evaluation of neural code summarization currently lacks standardization, leading to inconsistent metrics and hidden dataset biases. This paper systematically investigates how choices in BLEU variants, preprocessing steps, and dataset splitting can swing performance scores by over 20%. The authors identify a significant bug in the NLTK library that inflated scores and propose a standardized evaluation toolbox to ensure fair comparisons in the field.
Introduction
Automatic code summarization—generating natural language descriptions for code snippets—has seen a surge in deep learning approaches. However, the field currently operates in a "Wild West" of inconsistent evaluation protocols. Researchers often claim "state-of-the-art" results without specifying which BLEU variant they used or how they preprocessed their data. This paper addresses three major inconsistencies: metric ambiguity, preprocessing variations, and dataset flaws such as code duplication and data leakage.
Methodology
The authors conducted a systematic study involving five representative models (RNN-based, Transformer-based, and retrieval-augmented) across six BLEU variants and 16 preprocessing combinations. They utilized three major benchmarks—TL-CodeSum (TLC), CodeSearchNet (CSN), and Funcom (FCM)—and created controlled variants to isolate the effects of corpus size and data splitting methods.
Crucially, the study included a human evaluation where five annotators scored 300 summaries to determine which automated metric best aligns with human perception. During this process, the authors identified and fixed a significant bug in the popular NLTK library's BLEU implementation that was inflating scores by as much as 700% for short sentences.
Analysis of Evaluation Pitfalls
Metric Ambiguity and the NLTK Bug
BLEU is not a single number; its value depends heavily on the smoothing method and calculation level (sentence vs. corpus). The authors found that depending on the variant, a model's score could jump from 12.14 to 40.18. The discovery of the NLTK bug (in versions 3.2.2 to 3.5.x) highlighted how implementation details can lead to misleading rankings. The buggy implementation of "smoothing method 4" incorrectly inflated precision for short sequences.
Preprocessing and Data Leakage
Of all preprocessing steps, identifier splitting (e.g., converting camelCase to subtokens) is the most critical, reducing "Out of Vocabulary" (OOV) issues and boosting performance by up to 25%. Conversely, the study found that data leakage is a pervasive issue. Splitting datasets randomly by method allows models to "cheat" by seeing similar code from the same project during training and testing. Splitting by project provides a more realistic measure of a model's ability to generalize to unseen codebases.
Key Results
- Human Correlation: BLEU-DC (Sentence-level BLEU with the fixed smoothing method 4) was identified as the metric most highly correlated with human judgment.
- Ranking Inconsistency: Model rankings are highly sensitive to dataset choice. For instance, retrieval models like Rencos dominate on duplicated datasets but are outperformed by Transformers on cleaner data.
- Toolbox Release: To standardize future research, the authors released a Code Summarization Toolbox containing fixed implementations of metrics and preprocessing steps.
Conclusion
This study demonstrates that current evaluation practices in code summarization can be highly misleading. By standardizing metrics and being mindful of dataset biases, the community can ensure more robust and fair comparisons of model performance. Future work should expand these findings to other programming languages beyond Java and explore metrics that move beyond simple n-gram overlap.
Summary updated