For years, the progress of automated code documentation has been measured by a flawed yardstick. When a model generates a summary for a piece of code, researchers typically use metrics like BLEU or ROUGE—tools borrowed from machine translation that count how many words or phrases overlap with a human-written "gold standard" reference.
However, as Ensheng Shi and colleagues pointed out in Neural Code Summarization: How Far Are We?, these metrics are notoriously inconsistent. A slight change in code pre-processing can swing scores by 25%, and more importantly, these scores often fail to correlate with what human developers actually find useful. The research community is now shifting toward semantic evaluation, using Large Language Models (LLMs) themselves to judge the quality, logic, and utility of code explanations.
The Failure of Lexical Overlap
The fundamental problem with traditional metrics is that they prioritize surface-level syntax over functional meaning. In programming, there are infinite ways to describe the same logic. A generated summary might say "increments the iterator," while the reference says "adds one to the counter." A metric like BLEU would penalize this as a mismatch, despite the two phrases being semantically identical in a coding context.
This gap is particularly acute in specialized domains. In MALSIGHT: Exploring Malicious Source Code and Benign Pseudocode for Iterative Binary Malware Summarization, Haolang Lu argues that for malware analysis, functional correctness is paramount. If a model fails to identify a "buffer overflow" but matches every other word in a description, it has failed its primary task, yet lexical metrics might still grant it a high score.
Furthermore, Benjamin Tan noted in Pop Quiz! Can a Large Language Model Help With Reverse Engineering? that evaluating explanations for "mystery code" (stripped of names and comments) requires a deep grasp of semantics that simple keyword matching cannot capture.
LLM-as-a-Judge: Bridging the Gap
To solve this, researchers are deploying LLMs as "expert judges." The intuition is that while generating a perfect summary is hard, a sufficiently large model can recognize a good one by reasoning about the relationship between the source code and the natural language description.
A landmark example of this is the CODERPE framework developed by Yang Wu in Can Large Language Models Serve as Evaluators for Code Summarization?. Instead of looking for word overlap, CODERPE prompts an LLM to role-play as a code reviewer or system analyst. This approach achieved an 81.59% correlation with human judgment, far surpassing traditional metrics. Crucially, this method can work even without a "gold standard" reference, evaluating the summary directly against the code itself.
Similarly, Qunhong Zeng demonstrated in Evaluating Generated Commit Messages with Large Language Models that GPT-4, when guided by Chain-of-Thought prompting, can evaluate the quality of commit messages with near-human proficiency. This provides a scalable way to assess documentation that was previously only possible through expensive manual review.
The Challenge of Logic and Multilingualism
The shift toward semantic evaluation also addresses the "black box" nature of code logic. As Linzheng Chai explains in McEval: Massively Multilingual Code Evaluation, code lacks the objective, execution-based verification that we use for unit tests when we are evaluating explanations. You can run code to see if it works, but you cannot "run" a summary to see if it is true.
Weisong Sun confirmed in Source Code Summarization in the Era of Large Language Models that GPT-4 is currently the most reliable automated evaluator for these logical nuances. Interestingly, Sun’s work also found that while large models are better judges, smaller specialized models like CodeLlama-7B are sometimes better at explaining the "why" behind the code, further highlighting the need for evaluators that can distinguish between surface-level description and deep intent.
By moving away from counting words and toward assessing meaning, this research direction allows the field to finally reward models that understand what code does, rather than just models that mimic how humans talk about it.