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/
    • Routine
    • Instruction
    • Complex
    • Handing_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.310.64.6
Gemini 2.0 (Pichai et al., 2024) 90.410.65.8
Open-source Models
InternVL-2-8B (Chen et al., 2024) 88.44.22.4
Qwen2-VL-7B (Wang et al., 2024) 92.670.727.2
Qwen2.5-VL-7B (Bai et al., 2025) 92.156.126.6
UI-TARS-7B (Qin et al., 2025) 95.488.682.5
UI-TARS-1.5-7B (Seed, 2025) 93.085.879.3
MagicGUI-CPT 94.690.295.2

Performance comparison on the Magic-RICH dataset

Agent Models Routine Instruction Complex Handing Exception
TypeGrdSR TypeGrdSR TypeGrdSR
Closed-source Models
GPT-4o (Hurst et al., 2024) 49.316.74.6 56.613.519.8 49.014.67.4 85.1
Gemini 2.0 (Pichai et al., 2024) 89.249.434.7 84.154.251.4 83.350.342.0 73.7
Open-source Models
InternVL-2-8B (Chen et al., 2024) 30.12.81.3 37.14.015.8 17.16.01.3 70.8
Qwen2-VL-7B (Wang et al., 2024) 71.741.028.1 73.643.941.5 65.628.721.2 68.3
Qwen2.5-VL-7B (Bai et al., 2025) 94.392.676.3 89.395.783.6 86.669.660.0 67.0
UI-TARS-7B (Qin et al., 2025) 83.584.973.3 76.685.669.8 91.469.167.0 3.6
UI-TARS-1.5-7B (Seed, 2025) 85.696.281.5 78.692.172.2 94.774.371.1 1.0
MiMo-VL-7B-SFT (Xiaomi, 2025) 93.077.965.3 89.785.775.4 89.180.171.0 57.0
AgentCPM-GUI (Zhang et al., 2025) 84.392.275.1 70.480.756.0 72.354.639.4 2.4
MagicGUI-CPT 98.598.597.2 95.596.392.9 88.582.372.9 93.2
MagicGUI-RFT 99.797.597.5 97.295.694.0 92.180.474.1 92.1

Performance comparison on open-source AndroidControl and GUI-Odyssey datasets.

Agent Models AC-Low AC-High GUI-Odyssey
TypeSR TypeSR TypeSR
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.736.2 45.821.2 58.613.3
Qwen2.5-VL-7B (Bai et al., 2025) 94.185.0 75.162.9 59.546.3
Aguvis-7B (Xu et al., 2024) 93.989.4 65.654.2 26.713.5
OS-Atlas-7B (Wu et al., 2024) 73.067.3 70.456.5 91.8*76.8*
UI-TARS-7B (Qin et al., 2025) 95.291.8 81.674.4 86.167.9
AgentCPM-GUI (Zhang et al., 2025) 94.490.2 77.769.2 90.975.0
MagicGUI-CPT 94.586.7 84.673.1 90.473.5
MagicGUI-RFT 97.293.5 84.776.3 89.774.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 magicgui@honor.com. 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
10
Safetensors
Model size
8.29B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for GUIAgent/MagicGUI_CPT

Base model

Qwen/Qwen2-VL-7B
Finetuned
(420)
this model
Quantizations
2 models

Dataset used to train GUIAgent/MagicGUI_CPT