Views
No views yet
1git clone https://github.com/MagicAgent-GUI
2cd MagicGUI
3conda create -n gui_agent python=3.11
4conda activate gui_agent
5pip install -r requirements.txt1import torch
2from utils.model import Qwen2VLChat
3
4# 1. Load the model and tokenizer
5model_path = "./models/RFT" # model path
6model = Qwen2VLChat.from_pretrained(model_path, min_pixels=4*28*28, max_pixels=768*28*28)
7model = model.to("cuda:0")
8
9# 2. Build the input
10instruction = """你是一个训练有素的手机智能体,能够帮助用户进行单步导航任务。已知当前智能手机的截图<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。"""
11
12image_path = "./assets/test_action.png"
13
14# 3. Build the message format
15messages = [{"type": "image", "value":f"{image_path}",
16 {"type": "text", "value":f"{instruction}"]
17
18# 4. Inference
19response = model.generate(
20 message = messages,
21)
22
23print(response){"tap(700,964)"}duration, thought) and/or a task-level flag (STATUS).| 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() |
assets/datasets/
RoutineInstructionComplexHanding_Exceptionutils/--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')'1# Referring Benchmark
2python run_eval.py --data ScreenQA-short --model MagicGUI_Path --mode all --eval_model_path Eval_Model_Path
3python run_eval.py --data ScreenSpot_v2_mobile --model MagicGUI_Path --mode all
4python run_eval.py --data Os-Atlas-mobile --model MagicGUI_Path --mode all
5# Magic-RICH dataset
6python run_eval.py --data Routine --model MagicGUI_Path --mode all
7python run_eval.py --data Complex --model MagicGUI_Path --mode all
8python run_eval.py --data Instruction --model MagicGUI_Path --mode all
9python run_eval.py --data Handling_Exception --model MagicGUI_Path --mode all
10# Open-source AndroidControl and GUI-Odyssey
11python run_eval.py --data AC-Low --model MagicGUI_Path --mode all
12python run_eval.py --data AC-High --model MagicGUI_Path --mode all
13python run_eval.py --data GUI-Odyssey --model MagicGUI_Path --mode all| 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 |
| 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 |
| 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 |
1@misc{tang2025magicguifoundationalmobilegui,
2 title={MagicGUI: A Foundational Mobile GUI Agent with Scalable Data Pipeline and Reinforcement Fine-tuning},
3 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},
4 year={2025},
5 eprint={2508.03700},
6 archivePrefix={arXiv},
7 primaryClass={cs.HC},
8 url={https://arxiv.org/abs/2508.03700},
9}