File size: 19,279 Bytes
9a420d1 8ac16f8 9a420d1 8ac16f8 9a420d1 f521761 9a420d1 6c0338b 9a420d1 6c0338b 9a420d1 6c0338b 9a420d1 6c0338b 9a420d1 5e95c7f 6c0338b 5e95c7f 6c0338b 8ac16f8 6c0338b 9a420d1 f521761 9a420d1 8ac16f8 6c0338b 8ac16f8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
---
base_model:
- Qwen/Qwen2.5-VL-7B-Instruct
language:
- en
library_name: transformers
license: apache-2.0
pipeline_tag: image-text-to-text
tags:
- gui
- agent
- gui-grounding
- reinforcement-learning
---
# InfiGUI-G1-7B
This repository contains the InfiGUI-G1-7B model from the paper **[InfiGUI-G1: Advancing GUI Grounding with Adaptive Exploration Policy Optimization](https://arxiv.org/abs/2508.05731)**.
<p align="left">
<a href="https://arxiv.org/abs/2508.05731"><img src="https://img.shields.io/badge/arXiv-Preprint-b31b1b?style=flat&logo=arxiv&logoColor=white" alt="arXiv Paper"></a>
<a href="https://huggingface.co/papers/2508.05731"><img src="https://img.shields.io/badge/HuggingFace-Daily%20Papers-ff9800?style=flat&logo=huggingface" alt="Hugging Face Paper"></a>
<a href="https://huggingface.co/InfiX-ai/InfiGUI-G1-3B"><img src="https://img.shields.io/badge/Model-InfiGUI--G1--3B-007ec6?style=flat&logo=huggingface" alt="InfiGUI-G1 3B Model"></a>
<a href="https://github.com/InfiXAI/InfiGUI-G1"><img src="https://img.shields.io/badge/GitHub-Repo-181717?style=flat&logo=github&logoColor=white" alt="GitHub Repo"></a>
</p>
## Model Description
The model is based on `Qwen2.5-VL-7B-Instruct` and is fine-tuned using our proposed **Adaptive Exploration Policy Optimization (AEPO)** framework. AEPO is a novel reinforcement learning method designed to enhance the model's **semantic alignment** for GUI grounding tasks. It overcomes the exploration bottlenecks of standard RLVR methods by integrating a multi-answer generation strategy with a theoretically-grounded adaptive reward function, enabling more effective and efficient learning for complex GUI interactions.
## Paper Overview
A fundamental challenge for GUI agents is robustly grounding natural language instructions, which requires not only precise **spatial alignment** (locating elements accurately) but also correct **semantic alignment** (identifying the functionally appropriate element). While existing Reinforcement Learning with Verifiable Rewards (RLVR) methods have enhanced spatial precision, they often suffer from inefficient exploration. This "confidence trap" bottlenecks semantic alignment, preventing models from discovering correct actions for difficult semantic associations.
To address this critical exploration problem, we introduce **InfiGUI-G1**, a series of models trained with **Adaptive Exploration Policy Optimization (AEPO)**. AEPO overcomes the exploration bottleneck by integrating a **multi-answer generation** strategy to explore a diverse set of candidate actions in a single forward pass. This exploration is guided by a theoretically-grounded **Adaptive Exploration Reward (AER)** function, derived from first principles of efficiency (η=U/C), which provides rich, informative learning signals to dynamically balance exploration and exploitation.
## Quick Start
### Installation
First, install the required dependencies:
```bash
pip install transformers qwen-vl-utils
````
### Example
```python
import json
import math
import torch
import requests
from io import BytesIO
from PIL import Image, ImageDraw, ImageFont
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
from qwen_vl_utils import process_vision_info, smart_resize
MAX_IMAGE_PIXELS = 5600 * 28 * 28
def resize_image(width: int, height: int, max_pixels: int) -> tuple[int, int]:
"""
Resize image to fit within max_pixels constraint while maintaining aspect ratio.
Applies smart_resize for final dimension optimization.
"""
current_pixels = width * height
if current_pixels <= max_pixels:
target_width, target_height = width, height
else:
scale_factor = math.sqrt(max_pixels / current_pixels)
target_width = round(width * scale_factor)
target_height = round(height * scale_factor)
# Apply smart_resize for final dimensions
final_height, final_width = smart_resize(target_height, target_width)
return final_width, final_height
def load_image(img_path: str) -> Image.Image:
"""Load image from URL or local path."""
if img_path.startswith("https://"):
response = requests.get(img_path)
return Image.open(BytesIO(response.content))
else:
return Image.open(img_path)
def visualize_points(original_image: Image.Image, points: list,
new_width: int, new_height: int,
original_width: int, original_height: int) -> None:
"""Draw prediction points on original image and save as output.png."""
output_img = original_image.copy()
draw = ImageDraw.Draw(output_img)
font = ImageFont.load_default(size=100)
for i, point_data in enumerate(points):
coords = point_data['point_2d']
# Map coordinates from resized image back to original image
original_x = int(coords[0] / new_width * original_width)
original_y = int(coords[1] / new_height * original_height)
label = str(i + 1)
# Draw circle
circle_radius = 20
draw.ellipse([original_x - circle_radius, original_y - circle_radius,
original_x + circle_radius, original_y + circle_radius],
fill=(255, 0, 0))
# Draw label
draw.text((original_x + 20, original_y - 20), label, fill=(255, 0, 0), font=font)
print(f"Point {i+1}: Predicted coordinates {coords} -> Mapped coordinates [{original_x}, {original_y}]")
output_img.save("output.png")
print(f"Visualization with {len(points)} points saved to output.png")
def main():
# Load model and processor
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
"InfiX-ai/InfiGUI-G1-7B",
torch_dtype=torch.bfloat16,
attn_implementation="flash_attention_2",
device_map="auto"
)
processor = AutoProcessor.from_pretrained("InfiX-ai/InfiGUI-G1-7B", padding_side="left")
# Load and process image
img_path = "https://raw.githubusercontent.com/InfiXAI/InfiGUI-G1/main/assets/test_image.png"
image = load_image(img_path)
# Store original image and resize for model input
original_image = image.copy()
original_width, original_height = image.size
new_width, new_height = resize_image(original_width, original_height, MAX_IMAGE_PIXELS)
resized_image = image.resize((new_width, new_height))
# Prepare model inputs
instruction = "shuffle play the current playlist"
system_prompt = 'You FIRST think about the reasoning process as an internal monologue and then provide the final answer.\nThe reasoning process MUST BE enclosed within <think> </think> tags.'
prompt = f'''The screen's resolution is {new_width}x{new_height}.
Locate the UI element(s) for "{instruction}", output the coordinates using JSON format: [{{"point_2d": [x, y]}}, ...]'''
messages = [
{"role": "system", "content": system_prompt},
{
"role": "user",
"content": [
{"type": "image", "image": resized_image},
{"type": "text", "text": prompt}
]
}
]
# Generate predictions
text = processor.apply_chat_template([messages], tokenize=False, add_generation_prompt=True)
image_inputs, video_inputs = process_vision_info([messages])
inputs = processor(text=text, images=image_inputs, videos=video_inputs, padding=True, return_tensors="pt").to("cuda")
generated_ids = model.generate(**inputs, max_new_tokens=512)
output_text = processor.batch_decode(
[out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)],
skip_special_tokens=True,
clean_up_tokenization_spaces=False
)
# Parse and visualize results
output_text = output_text[0].split("</think>")[-1].replace("```json", "").replace("```", "").strip()
output = json.loads(output_text)
if output:
visualize_points(original_image, output, new_width, new_height, original_width, original_height)
if __name__ == "__main__":
main()
```
## Results
Our InfiGUI-G1 models, trained with the AEPO framework, establish new state-of-the-art results among open-source models across a diverse and challenging set of GUI grounding benchmarks:
<div align="left">
<table style="width: 100%; max-width: 750px; border-collapse: collapse; border-top: 2px solid #212529; border-bottom: 2px solid #212529; font-family: sans-serif;">
<thead style="background-color: #f8f9fa;">
<tr style="border-bottom: 1.5px solid #212529;">
<th style="padding: 12px 10px; text-align: left; width: 24.9%; font-weight: 600; color: #343a40;">Model</th>
<th style="padding: 12px 10px; text-align: center; font-weight: 600; color: #343a40;">MMBench-GUI</th>
<th style="padding: 12px 10px; text-align: center; font-weight: 600; color: #343a40;">ScreenSpot-v2</th>
<th style="padding: 12px 10px; text-align: center; font-weight: 600; color: #343a40;">UI-Vision</th>
<th style="padding: 12px 10px; text-align: center; font-weight: 600; color: #343a40;">I2E-Bench</th>
<th style="padding: 12px 10px; text-align: center; font-weight: 600; color: #343a40;">ScreenSpot-Pro</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 10px; text-align: left;">Qwen2.5-VL-7B</td>
<td style="padding: 10px; text-align: center;">33.9</td>
<td style="padding: 10px; text-align: center;">88.8</td>
<td style="padding: 10px; text-align: center;">0.9</td>
<td style="padding: 10px; text-align: center;">53.8</td>
<td style="padding: 10px; text-align: center;">-</td>
</tr>
<tr>
<td style="padding: 10px; text-align: left;">GUI-G²-7B</td>
<td style="padding: 10px; text-align: center;">-</td>
<td style="padding: 10px; text-align: center;"><u>93.3</u></td>
<td style="padding: 10px; text-align: center;">-</td>
<td style="padding: 10px; text-align: center;">-</td>
<td style="padding: 10px; text-align: center;">47.5</td>
</tr>
<tr>
<td style="padding: 10px; text-align: left;">UI-TARS-7B</td>
<td style="padding: 10px; text-align: center;">-</td>
<td style="padding: 10px; text-align: center;">91.6</td>
<td style="padding: 10px; text-align: center;">17.6</td>
<td style="padding: 10px; text-align: center;">61.4</td>
<td style="padding: 10px; text-align: center;">35.7</td>
</tr>
<tr>
<td style="padding: 10px; text-align: left;">UGround-v1-7B</td>
<td style="padding: 10px; text-align: center;">65.7</td>
<td style="padding: 10px; text-align: center;">-</td>
<td style="padding: 10px; text-align: center;">12.9</td>
<td style="padding: 10px; text-align: center;">70.3</td>
<td style="padding: 10px; text-align: center;">-</td>
</tr>
<tr>
<td style="padding: 10px; text-align: left;">UI-TARS-1.5-7B</td>
<td style="padding: 10px; text-align: center;">64.3</td>
<td style="padding: 10px; text-align: center;">-</td>
<td style="padding: 10px; text-align: center;">-</td>
<td style="padding: 10px; text-align: center;">73.2</td>
<td style="padding: 10px; text-align: center;"><u>49.6</u></td>
</tr>
<tr>
<td style="padding: 10px; text-align: left;">Qwen2.5-VL-72B</td>
<td style="padding: 10px; text-align: center;">41.8</td>
<td style="padding: 10px; text-align: center;">-</td>
<td style="padding: 10px; text-align: center;">-</td>
<td style="padding: 10px; text-align: center;">51.4</td>
<td style="padding: 10px; text-align: center;">-</td>
</tr>
<tr>
<td style="padding: 10px; text-align: left;">UGround-v1-72B</td>
<td style="padding: 10px; text-align: center;">-</td>
<td style="padding: 10px; text-align: center;">-</td>
<td style="padding: 10px; text-align: center;">23.2</td>
<td style="padding: 10px; text-align: center;"><u>76.3</u></td>
<td style="padding: 10px; text-align: center;">-</td>
</tr>
<tr>
<td style="padding: 10px; text-align: left;">UI-TARS-72B</td>
<td style="padding: 10px; text-align: center;"><u>74.3</u></td>
<td style="padding: 10px; text-align: center;">90.3</td>
<td style="padding: 10px; text-align: center;"><u>25.5</u></td>
<td style="padding: 10px; text-align: center;">73.7</td>
<td style="padding: 10px; text-align: center;">-</td>
</tr>
<tr>
<th colspan="6" style="padding: 10px 12px; text-align: left; font-style: italic; background-color: #f8f9fa; border-top: 1px solid #dee2e6; border-bottom: 1px solid #dee2e6; color: #343a40;">Ours</th>
</tr>
<tr style="background-color: #f0f8ff;">
<td style="padding: 10px; text-align: left;"><b>InfiGUI-G1-7B</b></td>
<td style="padding: 10px; text-align: center;"><b>80.8</b></td>
<td style="padding: 10px; text-align: center;"><b>93.5</b></td>
<td style="padding: 10px; text-align: center;"><b>26.1</b></td>
<td style="padding: 10px; text-align: center;"><b>77.4</b></td>
<td style="padding: 10px; text-align: center;"><b>51.9</b></td>
</tr>
<tr style="background-color: #f0f8ff;">
<td style="padding: 10px; text-align: right;"><i>w/ Expl. Success</i></td>
<td style="padding: 10px; text-align: center;">86.4</td>
<td style="padding: 10px; text-align: center;">95.6</td>
<td style="padding: 10px; text-align: center;">34.4</td>
<td style="padding: 10px; text-align: center;">83.0</td>
<td style="padding: 10px; text-align: center;">58.0</td>
</tr>
</tbody>
</table>
</div>
## Evaluation
This section provides instructions for reproducing the evaluation results reported in our paper.
### 1. Getting Started
Clone the repository and navigate to the project directory:
```bash
git clone https://github.com/InfiXAI/InfiGUI-G1.git
cd InfiGUI-G1
```
### 2. Environment Setup
The evaluation pipeline is built upon the [vLLM](https://github.com/vllm-project/vllm) library for efficient inference. For detailed installation guidance, please refer to the official vLLM repository. The specific versions used to obtain the results reported in our paper are as follows:
- **Python**: `3.10.12`
- **PyTorch**: `2.6.0`
- **Transformers**: `4.50.1`
- **vLLM**: `0.8.2`
- **CUDA**: `12.6`
The reported results were obtained on a server equipped with 4 x NVIDIA H800 GPUs.
### 3. Model Download
Download the InfiGUI-G1 models from the Hugging Face Hub into the `./models` directory.
```bash
# Create a directory for models
mkdir -p ./models
# Download InfiGUI-G1-3B
huggingface-cli download --resume-download InfiX-ai/InfiGUI-G1-3B --local-dir ./models/InfiGUI-G1-3B
# Download InfiGUI-G1-7B
huggingface-cli download --resume-download InfiX-ai/InfiGUI-G1-7B --local-dir ./models/InfiGUI-G1-7B
```
### 4. Dataset Download and Preparation
Download the required evaluation benchmarks into the `./data` directory.
```bash
# Create a directory for datasets
mkdir -p ./data
# Download benchmarks
huggingface-cli download --repo-type dataset --resume-download likaixin/ScreenSpot-Pro --local-dir ./data/ScreenSpot-Pro
huggingface-cli download --repo-type dataset --resume-download ServiceNow/ui-vision --local-dir ./data/ui-vision
huggingface-cli download --repo-type dataset --resume-download OS-Copilot/ScreenSpot-v2 --local-dir ./data/ScreenSpot-v2
huggingface-cli download --repo-type dataset --resume-download OpenGVLab/MMBench-GUI --local-dir ./data/MMBench-GUI
huggingface-cli download --repo-type dataset --resume-download vaundys/I2E-Bench --local-dir ./data/I2E-Bench
```
After downloading, some datasets require unzipping compressed image files.
```bash
# Unzip images for ScreenSpot-v2
unzip ./data/ScreenSpot-v2/screenspotv2_image.zip -d ./data/ScreenSpot-v2/
# Unzip images for MMBench-GUI
unzip ./data/MMBench-GUI/MMBench-GUI-OfflineImages.zip -d ./data/MMBench-GUI/
```
### 5. Running the Evaluation
To run the evaluation, use the `eval/eval.py` script. You must specify the path to the model, the benchmark name, and the tensor parallel size.
Here is an example command to evaluate the `InfiGUI-G1-3B` model on the `screenspot-pro` benchmark using 4 GPUs:
```bash
python eval/eval.py \
./models/InfiGUI-G1-3B \
--benchmark screenspot-pro \
--tensor-parallel 4
```
- **`model_path`**: The first positional argument specifies the path to the downloaded model directory (e.g., `./models/InfiGUI-G1-3B`).
- **`--benchmark`**: Specifies the benchmark to evaluate. Available options include `screenspot-pro`, `screenspot-v2`, `ui-vision`, `mmbench-gui`, and `i2e-bench`.
- **`--tensor-parallel`**: Sets the tensor parallelism size, which should typically match the number of available GPUs.
Evaluation results, including detailed logs and performance metrics, will be saved to the `./output/{model_name}/{benchmark}/` directory.
## Citation Information
If you find this work useful, we would be grateful if you consider citing the following papers:
```bibtex
@misc{liu2025infiguig1advancingguigrounding,
title={InfiGUI-G1: Advancing GUI Grounding with Adaptive Exploration Policy Optimization},
author={Yuhang Liu and Zeyu Liu and Shuanghe Zhu and Pengxiang Li and Congkai Xie and Jiasheng Wang and Xueyu Hu and Xiaotian Han and Jianbo Yuan and Xinyao Wang and Shengyu Zhang and Hongxia Yang and Fei Wu},
year={2025},
eprint={2508.05731},
archivePrefix={arXiv},
primaryClass={cs.AI},
url={https://arxiv.org/abs/2508.05731},
}
```
```bibtex
@article{liu2025infigui,
title={InfiGUI-R1: Advancing Multimodal GUI Agents from Reactive Actors to Deliberative Reasoners},
author={Liu, Yuhang and Li, Pengxiang and Xie, Congkai and Hu, Xavier and Han, Xiaotian and Zhang, Shengyu and Yang, Hongxia and Wu, Fei},
journal={arXiv preprint arXiv:2504.14239},
year={2025}
}
```
```bibtex
@article{liu2025infiguiagent,
title={InfiGUIAgent: A Multimodal Generalist GUI Agent with Native Reasoning and Reflection},
author={Liu, Yuhang and Li, Pengxiang and Wei, Zishu and Xie, Congkai and Hu, Xueyu and Xu, Xinchen and Zhang, Shengyu and Han, Xiaotian and Yang, Hongxia and Wu, Fei},
journal={arXiv preprint arXiv:2501.04575},
year={2025}
}
```
## Acknowledgements
We would like to express our gratitude for the following open-source projects: [VERL](https://github.com/volcengine/verl), [Qwen2.5-VL](https://github.com/QwenLM/Qwen2.5-VL) and [vLLM](https://github.com/vllm-project/vllm). |