KG-RAG: Enhancing GUI Agent Decision-Making via Knowledge Graph-Driven Retrieval-Augmented Generation

Ziyi Guan, Jason Chun Lok Li, Zhijian Hou, Pingping Zhang, Donglai Xu, Yuzhi Zhao, Mengyang Wu, Jinpeng Chen, Thanh-Toan Nguyen, Pengfei Xian, Wenao Ma, Shengchao Qin, Graziano Chesi, Ngai Wong

Abstract

Despite recent progress, Graphic User Interface (GUI) agents powered by Large Language Models (LLMs) struggle with complex mobile tasks due to limited app-specific knowledge. While UI Transition Graphs (UTGs) offer structured navigation representations, they are underutilized due to poor extraction and inefficient integration. We introduce KG-RAG, a Knowledge Graph-driven Retrieval-Augmented Generation framework that transforms fragmented UTGs into structured vector databases for efficient real-time retrieval. By leveraging an intent-guided LLM search method, KG-RAG generates actionable navigation paths, enhancing agent decision-making. Experiments across diverse mobile apps show that KG-RAG outperforms existing methods, achieving a 75.8% success rate (8.9% improvement over AutoDroid), 84.6% decision accuracy (8.1% improvement), and reducing average task steps from 4.5 to 4.1. Additionally, we present KG-Android-Bench and KG-Harmony-Bench, two benchmarks tailored to the Chinese mobile ecosystem for future research. Finally, KG-RAG transfers to web/desktop (+40% SR on Weibo-web; +20% on QQ Music-desktop), and a UTG cost ablation shows accuracy saturates at ~4h per complex app, enabling practical deployment trade-offs.

Introduction

Large Language Model (LLM) agents are increasingly capable of interacting with smartphone interfaces, but they often stumble when faced with "deep" navigation. For example, finding a "Privacy Policy" might require clicking through multiple obscure sub-menus—a task that is difficult for an agent to "guess" correctly on the first try without wasting time on trial-and-error. As shown in Figure 1, agents without structured knowledge often fail by selecting incorrect sub-menus, whereas KG-RAG provides a clear "map" to success.

Comparison of agent navigation trajectories without and with KG-RAG for a privacy policy retrieval task.

While UI Transition Graphs (UTGs) provide flowcharts of an app's screens, they are often fragmented or too noisy to be fed directly into an LLM's context window. KG-RAG addresses this by turning messy, low-quality graphs into actionable, high-level knowledge that an agent can retrieve during a live session.

The KG-RAG Framework

KG-RAG operates in two distinct phases: offline knowledge base construction and online retrieval-augmented execution.

The KG-RAG framework overview, illustrating the offline knowledge base construction and online retrieval-augmented execution.

1. Offline: Building the Knowledge Base

  • UTG Extraction: The system uses the xTester framework to crawl apps, identifying UI components and potential interaction nodes.
  • Intent-Guided LLM Search: A Vision-Language Model (VLM) analyzes screens to infer plausible user intents (e.g., "Check my balance"). An LLM then decomposes these intents into intermediate milestones.
  • Trajectory Scoring: The system performs a Breadth-First Search (BFS) through the UTG, using an LLM to score potential paths based on their likelihood of reaching the defined milestones.
  • Vector Database: The highest-scoring paths are summarized into "Intent-Trajectory" pairs and stored in a structured vector database as high-dimensional embeddings.

2. Online: Retrieval-Augmented Execution

When a user issues a command, the agent queries the vector database for the most similar pre-computed intent. It retrieves the associated proven navigation path, which serves as a guide for the agent to execute the task efficiently. This approach makes the agent robust to errors in the original UTG by treating the graph as a source for retrieval rather than a real-time navigation map.

Experimental Evaluation

KG-RAG was evaluated across three major benchmarks:

  • DroidTask (EN): 162 tasks across 12 English Android apps.
  • KG-Android-Bench (CN): A new benchmark featuring 300 tasks across 30 popular Chinese apps (e.g., WeChat, Taobao).
  • KG-Harmony-Bench (CN): A new cross-platform benchmark with 150 tasks for Huawei’s HarmonyOS ecosystem.

Key Results

  • Performance: On DroidTask, KG-RAG achieved a 75.8% success rate, an 8.9% improvement over AutoDroid. The average steps per task dropped from 4.5 to 4.1.
  • Versatility: KG-RAG is a plug-and-play module. Integrating it into existing agents like MobileAgent-v2 and UI-TARS yielded immediate performance gains without retraining.
  • Zero-Shot Transfer: A database built from mobile apps successfully aided agents on web and desktop versions of the same apps, increasing success rates by up to 40% on platforms like Weibo-web.
  • Efficiency: Performance gains saturate after approximately 4 hours of offline app exploration, providing a clear cost-benefit target for deployment.

Discussion and Conclusion

KG-RAG demonstrates that structured retrieval of navigation trajectories significantly enhances GUI agent reliability. While the current system relies on offline UTG extraction—which may become obsolete if app layouts change significantly—it provides a robust framework for complex navigation. Future work will focus on more advanced automatic testing to reduce exploration time and extending the framework to PC software environments.

Summary updated

BibTeX
@inproceedings{guan2025kg,
  author = {Ziyi Guan and Jason Chun Lok Li and Zhijian Hou and Pingping Zhang and Donglai Xu and Yuzhi Zhao and Mengyang Wu and Jinpeng Chen and Thanh-Toan Nguyen and Pengfei Xian and Wenao Ma and Shengchao Qin and Graziano Chesi and Ngai Wong},
  title = {{KG-RAG: Enhancing GUI Agent Decision-Making via Knowledge Graph-Driven Retrieval-Augmented Generation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2025},
  url = {https://openreview.net/forum?id=fWNnjYj6dp},
}
Figure