用大模型协作拆分混杂代码提交,区分显式与隐式依赖关系。
LLM-Driven Collaborative Model for Untangling Commits via Explicit and Implicit Dependency Reasoning
- 设计多智能体系统,分别处理代码的显式与隐式依赖。
- 在C#和Java数据集上分别提升44%和82%准确率。
- 适合需要高质量代码审查的开发团队或自动化工具研究者。
原子提交(即每次只修改一个开发关注点)是软件开发的最佳实践,但实践中开发者常产生混杂提交,混合无关变更,增加代码审查与维护难度。现有去缠绕方法(基于规则、特征或图结构)通常依赖浅层信号,难以区分显式依赖(如控制/数据流)与隐式依赖(如语义或概念关联)。本文提出ColaUntangle,一种基于大语言模型(LLM)的协同咨询框架,同时建模代码变更间的显式与隐式依赖。该框架采用多智能体架构:一个智能体专注显式依赖,另一个处理隐式依赖,再由评审智能体通过迭代协商整合观点。为捕捉结构与上下文信息,构建显式与隐式上下文,使智能体能进行符号与语义双重推理。在两个常用数据集(1,612个C#和14,000个Java混杂提交)上评估,结果表明ColaUntangle超越最佳基线,在C#数据集上提升44%,在Java数据集上提升82%。这证明了基于大模型的协同框架在自动化提交去缠绕任务中的巨大潜力。
原文摘要 · Abstract (English)
Atomic commits, which address a single development concern, are a best practice in software development. In practice, however, developers often produce tangled commits that mix unrelated changes, complicating code review and maintenance. Prior untangling approaches (rule-based, feature-based, or graph-based) have made progress but typically rely on shallow signals and struggle to distinguish explicit dependencies (e.g., control/data flow) from implicit ones (e.g., semantic or conceptual relationships). In this paper, we propose ColaUntangle, a new collaborative consultation framework for commit untangling that models both explicit and implicit dependencies among code changes. ColaUntangle integrates Large Language Model (LLM)-driven agents in a multi-agent architecture: one agent specializes in explicit dependencies, another in implicit ones, and a reviewer agent synthesizes their perspectives through iterative consultation. To capture structural and contextual information, we construct Explicit and Implicit Contexts, enabling agents to reason over code relationships with both symbolic and semantic depth. We evaluate ColaUntangle on two widely-used datasets (1,612 C# and 14k Java tangled commits). Experimental results show that ColaUntangle outperforms the best-performing baseline, achieving an improvement of 44% on the C# dataset and 82% on the Java dataset. These findings highlight the potential of LLM-based collaborative frameworks for advancing automated commit untangling tasks.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。