TL;DR
AutoDroid-V2 reimagines mobile UI automation by shifting from slow, cloud-dependent "step-wise" interaction to on-device code generation. By automatically compiling comprehensive app documentation, it enables small language models (SLMs) to generate complete, multi-step execution scripts locally, drastically reducing latency and token costs while improving task success rates and user privacy.
What Problem Does This Paper Address?
Most state-of-the-art mobile GUI agents operate in a "step-wise" manner: for every single action (like clicking a button or scrolling), the agent captures the screen state, sends it to a massive cloud-based Large Language Model (LLM) like GPT-4o, and waits for the next step.
This approach has three major flaws:
- Privacy Risks: Sending personal screenshots and interaction logs to third-party cloud servers exposes sensitive user data.
- High Cost & Latency: Querying a cloud model at every single step consumes massive network bandwidth and introduces significant lag, ruining the user experience.
- On-Device Incompatibility: Small Language Models (SLMs) that can run locally on a phone lack the advanced reasoning and reflection capabilities required to handle step-by-step dynamic decision-making.
AutoDroid-V2 addresses this gap by asking a clever question: Can we reframe mobile UI automation as a code generation problem to better leverage the unique strengths of on-device SLMs?
Methods
Instead of deciding actions one step at a time, AutoDroid-V2 generates a single, multi-step Python script to complete an entire task upfront.
The framework operates in two main stages:
1. UI-Centric App Documentation (Offline)
To write code for an app, the model needs an API document. AutoDroid-V2 automatically builds this by analyzing random app exploration histories.
- Functionality-aware Grouping: It merges similar user interfaces into abstract GUI states based on layout and functionality.
- Element Abstraction: It compresses thousands of raw UI elements into clean, abstract elements (static, dynamic, or element lists).
- Dependency Profiling: It builds an Element Transition Graph (ETG) to record forward and backward dependencies, mapping out how interacting with one element opens up another.
2. Document-Guided Code Generation & Customization
Using the generated app documentation, AutoDroid-V2 synthesizes a large-scale dataset of simulated user tasks and corresponding Python scripts using a domain-specific language (DSL).
- Quality Control: Scripts are validated in a real environment. If a script fails, a code status detector feeds the error back to fix it. A tree-based search with an LLM reward model ensures the code actually matches the user's intent.
- Fine-Tuning: The high-quality synthetic dataset is used to fine-tune an on-device SLM (like Llama-3.1-8B).
At runtime, the user provides a natural language task. The local SLM references a highly compressed version of the app document (containing just element names to save context length) and outputs a complete script. An on-device interpreter executes it, utilizing the backward dependencies to self-correct if a UI element fails to appear.
Datasets
The authors evaluated AutoDroid-V2 on two real-world execution benchmarks:
- DroidTask: Features 158 high-level tasks across 13 popular mobile apps.
- AitW (Android in the Wild) Subset: 68 tasks from the 'google apps' and 'general' subsets, evaluated within the executable LlamaTouch environment.
Key Insights and Ideas
- Leveraging SLM Coding Strengths: While SLMs struggle with abstract reasoning, they are remarkably good at code generation because they are heavily pre-trained on massive public code repositories. Reframing UI actions as code plays directly to their strengths.
- App as a Finite State Machine: Mobile apps have predetermined structures. If an agent has access to a complete "map" (the app document), it doesn't need to see the screen at every step to know what to do next.
- Deterministic Execution over Hallucination: Shifting the responsibility of tracking task completion from an LLM to a code interpreter eliminates common failure modes like infinite loops or repetitive actions.
Key Results
AutoDroid-V2 was deployed locally on a OnePlus ACE 2 Pro (Snapdragon 8 Gen 2) and a MacBook Pro (M2 Pro).
- Higher Accuracy: On DroidTask, AutoDroid-V2 achieved a 54.4% average task accuracy, outperforming the best step-wise baseline (AutoDroid) by 10.5% and VLM baselines by over 50%.
- Massive Speedups: On the Snapdragon processor, the average inference latency per task plummeted from 669.2 seconds (baseline) to just 46.3 seconds—a 93.1% reduction in latency.
- Token Efficiency: It reduced runtime input token consumption by 43.5× and output token consumption by 5.8×, largely thanks to aggressive prompt compression and KV caching of the static app document.
Limitations and Future Work
- Structured Text Reliance: AutoDroid-V2 relies on text-based XPaths to identify elements. It struggles with apps that lack structured text representations, such as Unity-based mobile games or certain web-hybrid apps. The authors suggest integrating Vision-Language Models (VLMs) in the future to reconstruct UI hierarchies visually.
- Highly Dynamic UIs: For interfaces that change unpredictably in real-time (like web search engines or recommendation feeds), planning a script entirely in advance is difficult. Future iterations aim to seamlessly blend step-wise reasoning with script-based execution to handle these dynamic edge cases efficiently.
Summary updated