Dynamic Stability of LLM-Generated Code
Prateek Rajput, Abdoul Aziz Bonkoungou, Yewei Song, Abdoul Kader Kabore, Iyiola E. Olatunji, Jacques Klein, Tegewende Bissyande

TL;DR
This paper introduces a framework with new metrics to evaluate the behavioral and performance stability of LLM-generated code, revealing a trade-off between correctness and stability in current models.
Contribution
It proposes SCTD, DCTD, and BEF metrics to measure code diversity and stability, highlighting the instability among correct solutions and the impact of sampling temperature.
Findings
State-of-the-art LLMs show significant algorithmic variance.
Increasing sampling temperature improves correctness but reduces stability.
Current evaluation overlooks behavioral diversity among correct solutions.
Abstract
Current evaluations of LLMs for code generation emphasize functional correctness, overlooking the fact that functionally correct solutions can differ significantly in algorithmic complexity. For instance, an versus sorting algorithm may yield similar output but incur vastly different performance costs in production. This discrepancy reveals a critical limitation in current evaluation methods: they fail to capture the behavioral and performance diversity among correct solutions. To address this, we introduce a principled framework for evaluating the dynamic stability of generated code. We propose two metrics derived from opcode distributions: Static Canonical Trace Divergence (SCTD), which captures algorithmic structure diversity across generated solutions, and Dynamic Canonical Trace Divergence (DCTD), which quantifies runtime behavioral variance. Their ratio,…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Advanced Data Storage Technologies · Software Testing and Debugging Techniques
