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 [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
Safetensors
Model size
8B 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_RFT

Base model

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

Dataset used to train GUIAgent/MagicGUI_RFT

Paper for GUIAgent/MagicGUI_RFT