paperbot · PL 论文追踪

全部论文 待读 收藏

P2 A Causal Perspective on Measuring, Explaining and Mitigating Smells in LLM-Generated Code

从因果视角度量、解释与缓解 LLM 生成代码中的代码异味
ICSE Proceedings of the 2026 IEEE/ACM 48th International Conference on Software Engineering2026匹配度 3/10 · 论文关注 LLM 生成代码的代码异味与因果分析,属于 LLM+代码质量交叉,但未涉及静态分析/形式化验证、浮点程序分析或贝叶斯程序分析,也不是将 LLM 作为工具用于 PL 任务,与画像核心方向匹配有限。引用 5 inbox
Alejandro Velasco, Daniel Rodriguez-Cardenas, Dipin Khati, David N. Palacio, Lutfar Rahman Alif, Denys Poshyvanyk
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:以倾向性异味分数为工具做因果分析,揭示提示设计与模型架构如何影响 LLM 生成代码的代码异味,并提出缓解策略。

论文关注大语言模型生成代码的结构质量:LLM 常复制不良编码实践,产生妨碍可读性、可维护性与设计完整性的代码异味,而已有研究多聚焦检测或修复,缺乏对异味何时、如何产生的机制性理解。作者以倾向性异味分数(Propensity Smelly Score, PSC)这一估计特定异味类型生成概率的概率度量为工具,先验证其作为结构质量信号的稳健性,再将其作为因果分析工具,考察生成策略、模型规模、模型架构与提示表述如何塑造生成代码的结构性质。结果显示,提示设计与架构选择对异味倾向起决定性作用,并据此提出可降低异味发生的实际缓解策略。用户研究进一步表明 PSC 能帮助开发者解释模型行为并评估代码质量,为把质量感知评估纳入 LLM 的评测与部署奠定基础。

问题
LLM 生成的代码常带有代码异味,影响可读性、可维护性与设计完整性,但人们尚不清楚这些异味如何以及何时在生成过程中出现。
方法
基于倾向性异味分数(PSC)这一概率度量,先验证其稳健性,再将其作为因果分析工具,探究生成策略、模型规模、架构与提示表述对异味倾向的影响,并据此设计缓解策略。
评估
通过因果分析揭示各因素对异味倾向的作用,提出并验证可减少异味发生的缓解策略,并开展用户研究评估 PSC 对开发者理解模型行为与判断代码质量的帮助。
原文摘要(Abstract)

Recent advances in large language models (LLMs) have accelerated their adoption in software engineering contexts. However, concerns persist about the structural quality of the code they produce. In particular, LLMs often replicate poor coding practices, introducing code smells (i.e., patterns that hinder readability, maintainability, or design integrity). Although prior research has examined the detection or repair of smells, we still lack a clear understanding of how and when these issues emerge in generated code. This paper addresses this gap by systematically measuring, explaining and mitigating smell propensity in LLM-generated code. We build on the Propensity Smelly Score (PSC), a probabilistic metric that estimates the likelihood of generating particular smell types, and establish its robustness as a signal of structural quality. Using PSC as an instrument for causal analysis, we identify how generation strategy, model size, model architecture and prompt formulation shape the structural properties of generated code. Our findings show that prompt design and architectural choices play a decisive role in smell propensity and motivate practical mitigation strategies that reduce its occurrence. A user study further demonstrates that PSC helps developers interpret model behavior and assess code quality, providing evidence that smell propensity signals can support human judgement. Taken together, our work lays the groundwork for integrating quality-aware assessments into the evaluation and deployment of LLMs for code.

链接与引用

DOI 原文 · arXiv · DBLP

BibTeX
@inproceedings{abs-2511-15817,
  title = {A Causal Perspective on Measuring, Explaining and Mitigating Smells in LLM-Generated Code},
  author = {Alejandro Velasco and Daniel Rodriguez-Cardenas and Dipin Khati and David N. Palacio and Lutfar Rahman Alif and Denys Poshyvanyk},
  booktitle = {ICSE},
  year = {2026},
  doi = {10.1145/3744916.3773164}
}