AI
AI system uses adversarial feedback to automate Android app migration to HarmonyOS
Researchers introduce an entropy-minimizing multi-agent framework that guides code generation to migrate entire repositories across mobile platforms with 74.7% migration quality.
Large language models show promise at code generation tasks, but applying them to migrate entire software repositories—moving complex applications from one platform to another—remains challenging. A new framework tackles this problem by treating repository migration as an optimization challenge guided by adversarial feedback.
The Challenge of Repository-Scale Migration#
Migrating a complete application codebase requires more than generating correct individual code snippets. The system must maintain consistency across thousands of files, handle platform-specific APIs and behaviors, and ensure the final result actually runs. Traditional LLM-based approaches struggle because they lose sight of the bigger picture during long-horizon translation tasks, often producing code that's syntactically correct but functionally incomplete.
How the Framework Works#
Researchers propose Entropy-based Code Adversarial Translation (ECAT), a two-agent system modeled after adversarial machine learning. A discriminator evaluates migration quality by measuring what researchers call "Code Entropy"—essentially how far the migrated code remains from a working HarmonyOS application. This discriminator then generates feedback signals (text gradients) that tell the generator exactly what changes to make and what skills are needed to execute them.
The generator iteratively refines the repository, accepting only updates that lower Code Entropy. Over repeated cycles, this back-and-forth drives the codebase from a template toward a complete, functional application. High-quality migration paths are then captured in a self-evolving memory tree, allowing the knowledge to transfer across different repositories.
Testing at Scale#
The team introduced A2H-RepoBench, the first benchmark specifically designed for Android-to-HarmonyOS migration, featuring real applications ranging from tens of thousands to hundreds of thousands of lines of code. Evaluated using node alignment metrics and an agent-based functional judge, ECAT achieved 74.7% overall migration quality and outperformed existing agent-based methods across codebases of varying size.
Why It Matters#
This approach demonstrates how structured adversarial feedback can keep LLM-based agents aligned with long-term objectives during complex, multi-step tasks. The framework's ability to distill successful migrations into reusable knowledge could accelerate future platform migration projects beyond Android-to-HarmonyOS conversion.

