Entropy-based Code Adversarial Translation for Real-world Repository Migration
2026-08-10 • Artificial Intelligence
Artificial IntelligenceSoftware Engineering
AI summaryⓘ
The authors present ECAT, a new method to help convert Android app code into HarmonyOS code automatically. They use two AI agents working together: one creates code changes and the other checks how well the changes reduce a measure called Code Entropy, which reflects migration quality. By iteratively improving the code and only accepting changes that lower entropy, their system gradually produces better HarmonyOS versions of apps. They also created a benchmark called A2H-RepoBench to test this process on large real-world apps, showing their method works better than existing ones.
Large Language Models (LLMs)Automated program repairRepository migrationAndroid-to-HarmonyOS migrationGenerator-discriminator architectureCode EntropyAdversarial learningBenchmark datasetsAgent-based evaluationSoftware engineering automation
Authors
Yushun Tang, Yisen Cao, Zhicheng Chen, Lin Peng, Junkang Mao, Fengyi Song, Yantao Jia
Abstract
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.