Code-MUE: Measuring Code LLMs' Uncertainty through Execution-based Semantic Interaction Graphs
Summary
Code-MUE is a novel black-box framework designed to measure the uncertainty of Code Large Language Models (LLMs) by addressing the critical syntax-semantics gap in existing methods. Unlike approaches relying on textual similarity, Code-MUE grounds uncertainty in observable runtime behavior through execution-based Semantic Interaction Graphs. It quantifies global semantic diversity by calculating the Von Neumann entropy of the solution space. A large-scale empirical study involving eight state-of-the-art LLMs demonstrated Code-MUE's strong negative correlation with functional correctness, achieving a Spearman's correlation up to -0.98. This significantly outperforms lexical and embedding-based baselines, enabling robust risk detection and selective prediction in practical software engineering workflows.
Key takeaway
For Machine Learning Engineers deploying Code LLMs in critical software systems, you should integrate Code-MUE to quantify model uncertainty based on observable execution behavior, moving beyond superficial text metrics. This enables robust risk detection and selective prediction, significantly improving reliability and mitigating potential functional, security, or safety consequences stemming from LLM stochasticity.
Key insights
Code-MUE quantifies Code LLM uncertainty by analyzing the semantic diversity of execution-based outputs, bridging the syntax-semantics gap.
Principles
- Code uncertainty requires semantic, not just syntactic, evaluation.
- Execution-based analysis reveals true code behavior diversity.
- Von Neumann entropy quantifies solution space diversity.
Method
Code-MUE constructs Semantic Interaction Graphs from the runtime behavior of multiple LLM-generated code variants. It then calculates the Von Neumann entropy of this solution space to quantify global semantic diversity and, consequently, model uncertainty.
In practice
- Apply Code-MUE for robust risk detection.
- Implement selective prediction for Code LLMs.
- Evaluate LLM code outputs via runtime behavior.
Topics
- Code LLMs
- Uncertainty Quantification
- Semantic Analysis
- Execution-based Testing
- Software Engineering
- Large Language Models
Best for: AI Engineer, Research Scientist, AI Scientist, Machine Learning Engineer, Software Engineer
Related on AIssential
See Counsel's argued verdicts on the open AI decisions leaders are weighing →
Editorial summary, takeaway, and curation by AIssential. Original article published by Computation and Language.