arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~

基于熵的代码对抗翻译用于真实仓库迁移

Entropy-based Code Adversarial Translation for Real-world Repository Migration

Yushun Tang, Yisen Cao, Zhicheng Chen, Lin Peng, Junkang Mao, Fengyi Song, Yantao Jia

arXiv 2608.09273首次发表:更新:

AI 中文总结

针对LLM迁移仓库难达可运行状态的问题,提出多智能体框架ECAT,引入A2H-RepoBench基准,迁移质量达74.7%且优于现有方法。

AI 中文摘要

大型语言模型(LLM)在代码生成和自动化程序修复方面展现出强大能力,但迁移整个仓库时很少能生成可运行的应用,因为长程翻译挑战了基于LLM的智能体维持仓库级迁移目标的能力。本研究提出基于熵的代码对抗翻译(ECAT),这是一种用于自动化Android到HarmonyOS仓库迁移的多智能体框架。ECAT将仓库迁移表述为通过生成器-判别器架构进行的对抗熵最小化,判别器使用名为代码熵的统一指标衡量迁移质量,并生成文本梯度,指定文件级生成指令和执行这些指令所需的技能。在这些优化信号的引导下,生成器迭代更新仓库,每次更新仅在降低代码熵时被接受。生成器与判别器的反复交互逐步将迁移从初始模板推向功能完整的HarmonyOS仓库。成功的低熵轨迹被进一步提炼为自进化记忆树,实现跨仓库的可迁移迁移知识。我们还引入A2H-RepoBench,这是首个用于Android到HarmonyOS仓库迁移的真实基准,涵盖数万到数十万行代码的应用。通过节点对齐和基于智能体的功能评判,ECAT实现了74.7%的整体迁移质量,且在不同规模的仓库上始终优于现有的基于智能体的方法。

英文摘要

LLMs have demonstrated strong capabilities in code generation and automated program repair, but migrating an entire repository rarely produces a runnable application because long-horizon translation challenges LLM-based agents' ability to maintain repository-level migration objectives. In this work, we propose Entropy-based Code Adversarial Translation (ECAT), a multi-agent framework for automated Android-to-HarmonyOS repository migration. ECAT formulates repository migration as adversarial entropy minimization through a generator-discriminator architecture. The discriminator measures migration quality using a unified metric called Code Entropy and produces text gradients that specify both file-level generation directives and the skills needed to execute them. Guided by these optimization signals, the generator iteratively updates the repository, and each update is accepted only if it reduces Code Entropy. Repeated generator--discriminator interactions progressively drive the migration from an initial template toward a functionally complete HarmonyOS repository. Successful low-entropy trajectories are further distilled into a self-evolving memory tree, enabling transferable migration knowledge across repositories. We also introduce A2H-RepoBench, the first real-world benchmark for Android-to-HarmonyOS repository migration, covering applications from tens of thousands to hundreds of thousands of lines of code. Evaluated by node alignment and an agent-based functional judge, ECAT achieves 74.7% overall migration quality and consistently outperforms existing agent-based methods across repositories of different scales.

论文原文

arXiv 摘要页 · PDF 原文 · HTML 原文

↑