News
- [2025-07-20] ๐๐๐ We have released the technical report of MagicGUI! Check it out here.
- [2025-07-20] ๐๐๐ We have open-sourced MagicGUI, an on-device GUI agent capable of operating Chinese & English apps and equipped with RFT-enhanced reasoning abilities.
Overview
MagicGUI is an open-source GUI agent model developed by Honor, built on Qwen2-VL with 7 billion parameters. It demonstrates outstanding capabilities in visual grounding, screen question answering, and action sequence planning and execution. MagicGUI enables multimodal perception, understanding, and automated execution of user tasks on mobile devices.
Data Collection Framework: Propose a scalable and modular framework for GUI data collection that efficiently gathers high-quality data on mobile devices.
Powerful Perception and Grounding Capabilities: Enhance the perception and grounding abilities on mobile device screens by integrating large-scale knowledge through tasks such as element referring, element grounding, and screen captioning.
Unified Action Space: Develop a comprehensive and unified action space for various mobile platforms, encompassing fundamental operations like Tap, Text Input, and Scroll, while also supporting more complex actions such as Wait, Drag, and Takeover.
Planning-Oriented Reasoning: Implement a planning-oriented reasoning mechanism to improve the stability of task execution and enhance the accuracy of action decisions in dynamic environments.
Two-Stage Training Paradigm: Strengthen core perception, localization, and navigation capabilities through Continued Pre-training (CPT), while enhancing model robustness and generalization via Reinforcement Fine-tuning (RFT).
Framework
The overall training framework of our MagicGUI contains two stages:
Stage I: Continue Pre-training (CPT), which involves training a foundational model on a large and diverse dataset followed by an annealing phase using a balanced and high-quality dataset.
Stage II: Reinforcement Fine-tuning (RFT), aimed at further enhancing the modelโs robustness and generalization capabilities.
Quick Start
Install dependencies
git clone https://github.com/MagicAgent-GUI
cd MagicGUI
conda create -n gui_agent python=3.11
conda activate gui_agent
pip install -r requirements.txt
Download the model
Download MagicGUI-RFT and MagicGUI-CPT.
Huggingface Inference
import torch
from utils.model import Qwen2VLChat
# 1. Load the model and tokenizer
model_path = "./models/RFT" # model path
model = Qwen2VLChat.from_pretrained(model_path, min_pixels=4*28*28, max_pixels=768*28*28)
model = model.to("cuda:0")
# 2. Build the input
instruction = """ไฝ ๆฏไธไธช่ฎญ็ปๆ็ด ็ๆๆบๆบ่ฝไฝ๏ผ่ฝๅคๅธฎๅฉ็จๆท่ฟ่กๅๆญฅๅฏผ่ชไปปๅกใๅทฒ็ฅๅฝๅๆบ่ฝๆๆบ็ๆชๅพ<image>๏ผๅ็จๆทๆไปค"ๆฅ็ไผๅไฟกๆฏ"่ฏท่พๅบๆญฃ็กฎ็ๅฝๆฐ่ฐ็จไปฅๅฎ็ฐ็จๆทๆไปคใ้คไบๅฝๆฐ่ฐ็จไนๅค๏ผไฝ ไธ่ฝ่พๅบไปปไฝๅ
ถไปๅ
ๅฎนใไฝ ๅฏไปฅ่ฐ็จไปฅไธๅฝๆฐๆฅๆงๅถๆบ่ฝๆๆบ๏ผ- UIๅบ็กๆไฝ๏ผ1. tap(x: float,y: float) ่ฏฅๅฝๆฐ็จไบๅจๆบ่ฝๆๆบๅฑๅนไธ็นๅป็นๅฎ็นใๅๆ x ๅ y ่กจ็คบๅพ
็นๅปๆงไปถ็ไธญๅฟไฝ็ฝฎใ2. scroll(x: float,y: float,direction: str) ่ฏฅๅฝๆฐ็จไบไป่ตทๅงๅๆ (x,y) ๅผๅงๅจๆบ่ฝๆๆบๅฑๅนไธๆปๅจๆไฝ๏ผๆนๅไธบๆๆๆปๅจ็ๆนๅใๅๆ x ๅ y ่กจ็คบๅฑๅนไธๅพ
ๆปๅจๆงไปถ็ไธญๅฟไฝ็ฝฎใๆนๅๅฏไปฅๆฏ "up"ใ"down"ใ"left" ๆ "right"ใ3. text(x: float,y: float,text_input: str) ่ฏฅๅฝๆฐ็จไบๅจๆบ่ฝๆๆบๅฑๅนไธ่พๅ
ฅๆๅฎ็textใๅๆ x ๅ y ่กจ็คบๅพ
็นๅปๆงไปถ็ไธญๅฟไฝ็ฝฎใ- ๆๆบๆ้ฎๆไฝ๏ผ4. navigate_back() ่ฏฅๅฝๆฐ็จไบ่ฟๅๆบ่ฝๆๆบ็ไธไธไธชๅฑๅนใ5. navigate_home() ่ฏฅๅฝๆฐ็จไบ่ฟๅๆๆบ็home screenๆๅ
ณ้ญๅฝๅๅบ็จใ- ๅ
ถไปๆไฝ๏ผ6. long_press(x: float,y: float) ่ฏฅๅฝๆฐ็จไบๅจๆบ่ฝๆๆบๅฑๅนไธ็็นๅฎ็นๆง่ก้ฟๆๆไฝใๅๆ x ๅ y ่กจ็คบๅพ
็นๅปๆงไปถ็ไธญๅฟไฝ็ฝฎใ7. wait() ่ฏฅๅฝๆฐ่กจ็คบๅจๅฝๅ้กต้ข็ญๅใ8. enter() ่ฏฅๅฝๆฐ่กจ็คบๆไธenter้ฎใ9. take_over(text_input: str) ่ฏฅๅฝๆฐ็จไบๆ็คบ็จๆทๆฅ็ฎกๆบ่ฝๆๆบ๏ผๅ
ถไธญ text_input ๆฏๆ็คบ็จๆทๆฅ็ฎกๆๆบ็ๅๅ ใๅฆๆๅๅ ไธ็กฎๅฎ๏ผ่ฏทๅกซๅโ่ฏทๆจๆฅ็ฎกๅฝๅ็้ขโใ10. drag(x1: float,y1: float,x2: float,y2: float) ่ฏฅๅฝๆฐๆง่กไธไธชๅฏน่ตทๅงๅ็ป็นๆๆ็ๆๅจๆไฝ๏ผ่กจ็คบๆๆไป็น1ๆๅฐ็น2ใๅธธ่ง็ๅบๆฏๅ
ๆฌๆปๅๆๅจใๆปๅจ้ๆฉๅจๆๅจๅๅพ็่ฃๅชใ11. screen_shot() ่ฏฅๅฝๆฐ็จไบๆชๅพใ12. long_screen_shot() ่ฏฅๅฝๆฐๆง่ก้ฟๆชๅพใ13. call_api(api_name: str,params: str) ่ฐ็จๆๅฎ็APIๅนถไผ ๅ
ฅ็ปๅฎ็ๅๆฐใapi_nameๆฏAPI็ๅ็งฐใparamsๅ
ๅซAPIๆ้็่พๅ
ฅๅๆฐใไพๅฆ๏ผcall_api(Amazon, open)ๆๅณ็ๆๅผไบ้ฉฌ้APPใๅฆๆไฝ ๅ็ฐๅฝๅๆไปคๆ ๆณๅจๅฝๅ้กต้ขไธๆง่ก๏ผไฝ ้่ฆ่พๅบno_answerใๅฆๆไฝ ๅ็ฐๅฝๅๆไปคๅทฒๅฎๆ๏ผไฝ ้่ฆ่พๅบaction_completedใ"""
image_path = "./assets/test_action.png"
# 3. Build the message format
messages = [{"type": "image", "value":f"{image_path}",
{"type": "text", "value":f"{instruction}"]
# 4. Inference
response = model.generate(
message = messages,
)
print(response)
Expected output:
{"tap(700,964)"}
Action Space
At each step, the agent outputs is a single JSON object that contains:
- One (and only one) primitive action, chosen from the list below;
- Optional modifiers (
duration,thought) and/or a task-level flag (STATUS).
Note that all keywords are case-sensitive, and we use compact JSON (i.e., no extra whitespace), which affects the tokenizerโs behavior.
w| Action | Description | Conditions for Racc = +2 | Example |
|---|---|---|---|
| Tap | Click at coordinate (x, y) | dist([x, y], [xc, yc]) โค 14% | tap(x,y) |
| Scroll | Scroll at coordinate (x, y) with direction up / down / left / right |
dist([x, y], [xc, yc]) โค 14% and direction = gt[direction] |
scroll(x,y,direction) |
| Text Input | Type text at coordinate (x, y) | dist([x, y], [xc, yc]) โค 14% and F1(text, gt[text]) > 0.5 |
text(x,y,text_input) |
| Navigation Back | Adb command to go back to the previous page | โ | navigate_back() |
| Navigation Home | Adb command to go to the home screen of the mobile | โ | navigate_home() |
| Long Press | Long press at coordinate (x, y) | dist([x, y], [xc, yc]) โค 14% | long_press(x,y) |
| Finish | Indicate that navigation task has been completed | โ | finish() |
| Wait | Wait for several seconds | โ | wait() |
| Enter | Adb command to press enter | โ | enter() |
| Takeover | Request user takeover | โ | take_over(message) |
| Drag | Drag from coordinate (xโ, yโ) to (xโ, yโ) |
dist([xโ, yโ], [x1c, y1c]) โค 7.5% and dist([xโ, yโ], [x2c, y2c]) โค 7.5% |
drag(x1,y1,x2,y2) |
| Call API | Adb command to open or kill app | app = gt[app] and open/kill = gt[operation] |
call_api(api_name,operation) |
| Screenshot | Adb command to take a screenshot | โ | screen_shot() |
| Long Screenshot | Adb command to take a long screenshot | โ | long_screen_shot() |
Evaluation
1.Data preparation
Please download the four compressed files from the Magic-RICH dataset and extract them into the .datasets/ directory.
assets/datasets/RoutineInstructionComplexHanding_Exception
utils/
For the preparation of other open-source datasets, please refer to Other datasets preparation.
2. Param
We use run_eval.py for evaluation.
--data: Name of a eval dataset--model: Path to the model--work-dir (str, default to '.'): Directory to save evaluation results--mode (str, default: 'all', choices: ['all', 'infer']): If set to "all", the script performs both inference and evaluation; if set to "infer", it performs inference only.--eval_model_path (str, default: 'None'):'Path to eval model (required if mode is 'all' and data is 'ScreenQA-short')'
3. Run
# Referring Benchmark
python run_eval.py --data ScreenQA-short --model MagicGUI_Path --mode all --eval_model_path Eval_Model_Path
python run_eval.py --data ScreenSpot_v2_mobile --model MagicGUI_Path --mode all
python run_eval.py --data Os-Atlas-mobile --model MagicGUI_Path --mode all
# Magic-RICH dataset
python run_eval.py --data Routine --model MagicGUI_Path --mode all
python run_eval.py --data Complex --model MagicGUI_Path --mode all
python run_eval.py --data Instruction --model MagicGUI_Path --mode all
python run_eval.py --data Handling_Exception --model MagicGUI_Path --mode all
# Open-source AndroidControl and GUI-Odyssey
python run_eval.py --data AC-Low --model MagicGUI_Path --mode all
python run_eval.py --data AC-High --model MagicGUI_Path --mode all
python run_eval.py --data GUI-Odyssey --model MagicGUI_Path --mode all
Performance Evaluation
Performance comparison on the Referring Benchmark
| Agent Models | ScreenQA-short | ScreenSpot v2 mobile | Os-Atlas-mobile |
|---|---|---|---|
| Closed-source Models | |||
| GPT-4o (Hurst et al., 2024) | 90.3 | 10.6 | 4.6 |
| Gemini 2.0 (Pichai et al., 2024) | 90.4 | 10.6 | 5.8 |
| Open-source Models | |||
| InternVL-2-8B (Chen et al., 2024) | 88.4 | 4.2 | 2.4 |
| Qwen2-VL-7B (Wang et al., 2024) | 92.6 | 70.7 | 27.2 |
| Qwen2.5-VL-7B (Bai et al., 2025) | 92.1 | 56.1 | 26.6 |
| UI-TARS-7B (Qin et al., 2025) | 95.4 | 88.6 | 82.5 |
| UI-TARS-1.5-7B (Seed, 2025) | 93.0 | 85.8 | 79.3 |
| MagicGUI-CPT | 94.6 | 90.2 | 95.2 |
Performance comparison on the Magic-RICH dataset
| Agent Models | Routine | Instruction | Complex | Handing Exception | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Type | Grd | SR | Type | Grd | SR | Type | Grd | SR | ||
| Closed-source Models | ||||||||||
| GPT-4o (Hurst et al., 2024) | 49.3 | 16.7 | 4.6 | 56.6 | 13.5 | 19.8 | 49.0 | 14.6 | 7.4 | 85.1 |
| Gemini 2.0 (Pichai et al., 2024) | 89.2 | 49.4 | 34.7 | 84.1 | 54.2 | 51.4 | 83.3 | 50.3 | 42.0 | 73.7 |
| Open-source Models | ||||||||||
| InternVL-2-8B (Chen et al., 2024) | 30.1 | 2.8 | 1.3 | 37.1 | 4.0 | 15.8 | 17.1 | 6.0 | 1.3 | 70.8 |
| Qwen2-VL-7B (Wang et al., 2024) | 71.7 | 41.0 | 28.1 | 73.6 | 43.9 | 41.5 | 65.6 | 28.7 | 21.2 | 68.3 |
| Qwen2.5-VL-7B (Bai et al., 2025) | 94.3 | 92.6 | 76.3 | 89.3 | 95.7 | 83.6 | 86.6 | 69.6 | 60.0 | 67.0 |
| UI-TARS-7B (Qin et al., 2025) | 83.5 | 84.9 | 73.3 | 76.6 | 85.6 | 69.8 | 91.4 | 69.1 | 67.0 | 3.6 |
| UI-TARS-1.5-7B (Seed, 2025) | 85.6 | 96.2 | 81.5 | 78.6 | 92.1 | 72.2 | 94.7 | 74.3 | 71.1 | 1.0 |
| MiMo-VL-7B-SFT (Xiaomi, 2025) | 93.0 | 77.9 | 65.3 | 89.7 | 85.7 | 75.4 | 89.1 | 80.1 | 71.0 | 57.0 |
| AgentCPM-GUI (Zhang et al., 2025) | 84.3 | 92.2 | 75.1 | 70.4 | 80.7 | 56.0 | 72.3 | 54.6 | 39.4 | 2.4 |
| MagicGUI-CPT | 98.5 | 98.5 | 97.2 | 95.5 | 96.3 | 92.9 | 88.5 | 82.3 | 72.9 | 93.2 |
| MagicGUI-RFT | 99.7 | 97.5 | 97.5 | 97.2 | 95.6 | 94.0 | 92.1 | 80.4 | 74.1 | 92.1 |
Performance comparison on open-source AndroidControl and GUI-Odyssey datasets.
| Agent Models | AC-Low | AC-High | GUI-Odyssey | |||
|---|---|---|---|---|---|---|
| Type | SR | Type | SR | Type | SR | |
| Closed-source Models | ||||||
| GPT-4o (Hurst et al., 2024) | - | 19.5 | - | 20.8 | - | 20.4 |
| Gemini 2.0 (Pichai et al., 2024) | - | 28.5 | - | 60.2 | - | 3.3 |
| Claude 2.0 (Anthropic, 2024) | - | 28.5 | - | 12.5 | 60.9 | - |
| Open-source Models | ||||||
| Qwen2-VL-7B (Wang et al., 2024) | 55.7 | 36.2 | 45.8 | 21.2 | 58.6 | 13.3 |
| Qwen2.5-VL-7B (Bai et al., 2025) | 94.1 | 85.0 | 75.1 | 62.9 | 59.5 | 46.3 |
| Aguvis-7B (Xu et al., 2024) | 93.9 | 89.4 | 65.6 | 54.2 | 26.7 | 13.5 |
| OS-Atlas-7B (Wu et al., 2024) | 73.0 | 67.3 | 70.4 | 56.5 | 91.8* | 76.8* |
| UI-TARS-7B (Qin et al., 2025) | 95.2 | 91.8 | 81.6 | 74.4 | 86.1 | 67.9 |
| AgentCPM-GUI (Zhang et al., 2025) | 94.4 | 90.2 | 77.7 | 69.2 | 90.9 | 75.0 |
| MagicGUI-CPT | 94.5 | 86.7 | 84.6 | 73.1 | 90.4 | 73.5 |
| MagicGUI-RFT | 97.2 | 93.5 | 84.7 | 76.3 | 89.7 | 74.3 |
License
- This project is licensed under the Apache-2.0 license. The model weights are fully open for academic research, and commercial use licenses can be applied for by contacting [email protected]. This project uses the pre-trained Qwen2VL-7B-Instruct for initialization, which is also licensed under the Apache- 2.0 License.
Citation
If MagicGUI is useful for your research, please cite:
@misc{tang2025magicguifoundationalmobilegui,
title={MagicGUI: A Foundational Mobile GUI Agent with Scalable Data Pipeline and Reinforcement Fine-tuning},
author={Liujian Tang and Shaokang Dong and Yijia Huang and Minqi Xiang and Hongtao Ruan and Bin Wang and Shuo Li and Zhiheng Xi and Zhihui Cao and Hailiang Pang and Heng Kong and He Yang and Mingxu Chai and Zhilin Gao and Xingyu Liu and Yingnan Fu and Jiaming Liu and Xuanjing Huang and Yu-Gang Jiang and Tao Gui and Qi Zhang and Kang Wang and Yunke Zhang and Yuran Wang},
year={2025},
eprint={2508.03700},
archivePrefix={arXiv},
primaryClass={cs.HC},
url={https://arxiv.org/abs/2508.03700},
}
- Downloads last month
- 9