Abstract
Autonomous mobile app interaction has become increasingly important with the growing complexity of mobile applications. Developing intelligent agents that can effectively navigate and interact with mobile apps remains a significant challenge. In this paper, we propose an Explainable Behavior Cloning LLM Agent (EBC-LLMAgent), a novel approach that combines large language models (LLMs) with behavior cloning by learning demonstrations to create intelligent and explainable agents for autonomous mobile app interaction. EBC-LLMAgent consists of three core modules: Demonstration Encoding, Code Generation, and UI Mapping, which work synergistically to capture user demonstrations, generate executable codes, and establish accurate correspondence between code and UI elements. We introduce the Behavior Cloning Chain Fusion technique to enhance the generalization capabilities of the agent. Extensive experiments on five popular mobile applications from diverse domains demonstrate the superior performance of EBC-LLMAgent, achieving high success rates in task completion, efficient generalization to unseen scenarios, and the generation of meaningful explanations.
Introduction
Mobile applications are the primary interface for digital services, yet automating interactions within them is fraught with difficulty. Traditional Robotic Process Automation (RPA) relies on rigid rules that fail when UI layouts change. Conversely, pure Large Language Model (LLM) agents often struggle with long-horizon tasks and lack the transparency required for high-stakes interactions. This research introduces EBC-LLMAgent, a framework that leverages behavior cloning to translate human demonstrations into robust, explainable Python code.
The EBC-LLMAgent Framework
The core innovation of EBC-LLMAgent is its transition from simple next-step action prediction to full program synthesis. The framework is composed of four primary modules:
- Demonstration Encoding: Captures user actions and UI metadata. It utilizes Visual Question Answering (VQA) models to describe UI elements that lack semantic labels in the underlying code.
- Code Generation: Translates demonstrations into parameterized Python code. This allows the agent to handle logic like loops and conditionals, which are essential for complex tasks.
- UI Mapping: Ensures the synthesized code correctly interacts with the live UI by matching elements through a combination of text IDs and visual features.
- Behavior Cloning Chain Fusion: A technique that enables the agent to fuse knowledge from different demonstrations to solve novel tasks.
Experimental Evaluation
The agent was tested on 30 tasks across five major applications: Starbucks, McDonald’s, Booking.com, YouTube, and WhatsApp. These tasks included complex, multi-step operations such as ordering customized beverages and booking flights.
Results and Discussion
EBC-LLMAgent significantly outperformed state-of-the-art baselines like AppAgent and GPT-4V. In complex apps like McDonald’s and Starbucks, where baselines often failed due to the high number of steps (9+), EBC-LLMAgent achieved success rates of 91.7% and 92.4%, respectively.
Key findings include:
- Robustness through Code: By using code as an intermediate representation, the agent avoids the "hallucinations" common in pure LLM agents.
- Explainability: The generated code and accompanying LLM-generated reasoning provide a clear audit trail for every action taken.
- Generalization: The agent demonstrated a strong ability to generalize, maintaining over 93% success in "Cross-Type" experiments where it had to apply logic learned from one item to a different but related one.
Conclusion
EBC-LLMAgent provides a scalable and transparent solution for mobile app automation. While challenges remain regarding out-of-distribution scenarios and privacy, the use of explainable behavior cloning marks a significant advancement in the development of reliable autonomous agents. Future work will focus on scaling the system to broader app ecosystems and enhancing active learning capabilities.
Summary updated