Abstract
Large language models have demonstrated great potential to assist programmers in generating code. For such human-AI pair programming scenarios, we empirically demonstrate that while generated code is most often evaluated in terms of their functional correctness (i.e., whether generations pass available unit tests), correctness does not fully capture (e.g., may underestimate) the productivity gains these models may provide. Through a user study with N = 49 experienced programmers, we show that while correctness captures high-value generations, programmers still rate code that fails unit tests as valuable if it reduces the overall effort needed to complete a coding task. Finally, we propose a hybrid metric that combines functional correctness and syntactic similarity and show that it achieves a 14% stronger correlation with value and can therefore better represent real-world gains when evaluating and comparing models.
Introduction
The evaluation of Large Language Models (LLMs) for code generation has primarily relied on functional correctness, typically quantified by the pass@k metric. Under this paradigm, a code suggestion is deemed successful only if it passes all associated unit tests. However, this binary evaluation fails to account for the nuances of human-AI pair programming. In a real-world IDE setting, a developer may derive significant value from a "near-miss" suggestion—one that requires minimal editing to become functional—even if it technically fails a test suite. This paper investigates the gap between automated metrics and human-perceived value.
Methodology
To investigate this misalignment, a user study was conducted with 49 professional programmers. Participants evaluated code snippets generated by five different models (variants of Codex and CodeGen) based on the HumanEval dataset. Each snippet was rated on three 5-point Likert scales:
- Accuracy: Functional equivalence to the ground truth.
- Value: Utility as a starting point for the task.
- Effort: The perceived work required to correct the code.
The study employed stratified sampling to include "disagreement" cases—snippets with high syntactic similarity to the solution that nonetheless failed unit tests. To better align offline evaluation with human judgment, the authors proposed a hybrid metric:
COMBINED = min(1.0, PASS + EDIT-SIM)
where PASS is the binary test result and EDIT-SIM is the character-level edit similarity to the reference solution.
Key Insights
The study revealed several critical insights into how developers interact with AI suggestions:
- Effort as the Primary Driver of Value: The strongest correlation observed was between perceived effort and value (r = 0.94). Developers value suggestions that minimize their manual workload, regardless of initial correctness.
- The Utility of "Failures": Approximately 42% of code generations that failed unit tests were still rated as valuable by experts. Binary metrics like
pass@keffectively ignore nearly half of the useful output produced by these models. - Precision vs. Recall: While functional correctness is a high-precision indicator of value (97% of passing snippets are high-value), it has low recall. It provides no signal for "near-miss" cases, which Figure 1 illustrates: a missing
abs()call causes a test failure but requires trivial effort to fix.
Results and Metric Alignment
The proposed COMBINED metric significantly outperformed traditional benchmarks in predicting human judgment. As shown in Figure 3, the COMBINED metric achieved a 0.70 correlation with human-perceived value, a 14% improvement over the 0.61 correlation of the standard PASS metric.
Furthermore, while pass@k is effective for ranking model intelligence, it consistently underestimates the practical utility of models that produce "fixable" code. Syntactic similarity, often dismissed in natural language tasks, serves as a robust proxy for developer effort in a coding context.
Discussion and Limitations
While these findings suggest a need for more nuanced evaluation, several limitations remain. The HumanEval dataset consists of self-contained functions; in complex software systems, "near-misses" may be harder to debug, potentially increasing the "review burden" on the developer. Future work should explore more sophisticated effort-based metrics, such as those utilizing Abstract Syntax Tree (AST) differences, and evaluate these metrics in larger-scale engineering environments.
Conclusion
Current benchmarks for AI code generation are overly pessimistic. By incorporating syntactic similarity into evaluation metrics, researchers can better capture the real-world productivity gains provided by AI-pair programmers, acknowledging that a "fixable" error is far more valuable than a total hallucination.
Summary updated