paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Enhancing LLMs with Staged Grouping and Dehallucination for Header File Decomposition

使用分阶段分组与去幻觉增强 LLM 以进行头文件分解
ASE 2025 40th IEEE/ACM International Conference on Automated Software Engineering (ASE)2025匹配度 4/10 · 论文将静态分析/相似度信息用于约束和纠正 LLM,以完成头文件分解重构,属于 LLM 辅助代码维护,与用户关注的 LLM 和静态分析交叉有边缘联系;但其核心任务是头文件重构,而非 ML/Agentic 程序分析、形式化验证、浮点程序分析或贝叶斯程序分析。引用 0 inbox
Yue Wang, Jiaxuan Sun, Yanzhen Zou, Bing Xie
crossref: 2026-09-12

AI 速览

一句话:提出 HFDecomposer,用两阶段分组与去幻觉增强 LLM,实现大型头文件的准确可靠分解。

巨型头文件被大量源文件包含,给代码理解与维护带来挑战。现有方法依赖代码相似度度量分解头文件,却难以准确捕捉代码的功能本质;直接用 LLM 又受长文件 token 约束、幻觉导致的不完整或虚假输出,以及违反架构原则、引发编译失败的循环依赖所限。本文提出 HFDecomposer:采用两阶段分组,先用传统相似度度量把强相关代码实体分组,再将组摘要交给 LLM 做高层语义聚合;并通过静态分析抽取事实知识增强提示,检测输出错误,重分配遗漏实体、消解循环依赖以去幻觉。在真实头文件分解重构上评估,该方法克服了纯 LLM 方法的局限,比传统最先进方法提升 11%,结果更准确可靠。

问题
巨型头文件因体量庞大且被广泛包含而难以理解维护,现有相似度度量无法准确刻画其功能本质,而直接使用 LLM 又受 token 限制、幻觉与循环依赖的制约。
方法
提出 HFDecomposer:先用传统相似度度量对强相关代码实体做两阶段分组,再将组摘要交给 LLM 进行高层语义聚合;同时用静态分析事实增强提示,检测并修正遗漏实体与循环依赖以减少幻觉。
评估
在真实世界的头文件分解重构任务上进行评估,结果表明该方法优于纯 LLM 方法,并比传统最先进方法提升 11%,生成更准确可靠的分解结果。
原文摘要(Abstract)

God Header Files, large header files included by numerous other code files, present significant challenges for code comprehension and maintenance. Existing approaches leverage various code similarity metrics to decompose them, but these metrics do not always capture the code’s functional essence accurately. Large Language Models (LLMs), with their advanced capabilities in code understanding and generation, offer a promising alternative for producing more effective refactorings. However, LLMs face three critical limitations that hinder practical application: they struggle with lengthy header files due to token constraints, suffer from hallucination by generating incomplete or spurious results, and produce cyclic dependencies that violate architectural principles and cause compilation failures. To address these challenges, we propose HFDecomposer, a hybrid approach that enhances LLMs with staged grouping and dehallucination techniques to effectively decompose header files. Our approach introduces a two-stage grouping framework for lengthy header files: it first groups strongly related code entities using traditional similarity metrics, then feeds group summaries to the LLM for higher-level semantic aggregation. To mitigate LLM hallucinations, we enhance prompts with factual knowledge extracted from static analysis, detect errors in LLM output, and make necessary corrections by reassigning missing entities and resolving cyclic dependencies. Our evaluation on real-world header file decomposition refactorings demonstrates that our method effectively overcomes the limitations of purely LLM-based techniques and outperforms the traditional state-of-the-art approach by 11%, delivering more accurate and reliable decomposition results. Our approach enables LLMs to handle lengthy header files efficiently, significantly reduces hallucinations, and ensures the reliability and practicality of the final decomposition.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot9541,
  title = {Enhancing LLMs with Staged Grouping and Dehallucination for Header File Decomposition},
  author = {Yue Wang and Jiaxuan Sun and Yanzhen Zou and Bing Xie},
  booktitle = {ASE},
  year = {2025},
  doi = {10.1109/ase63991.2025.00037}
}