# RelationGUI · RelationQA · RelationAgent
### Beyond Element-Level Understanding: Explicit Relational Understanding for GUI Agents
**Pattern Recognition, Volume 176, 113262 (2026)**
Longhui Ma · Di Zhao · Siwei Wang · Zhao Lv · Miao Wang
[](https://doi.org/10.1016/j.patcog.2026.113262)
[](https://huggingface.co/datasets/ahuiqqq/RelationGUI)
**RelationGUI** captures spatial, functional, and hierarchical relationships between GUI elements across desktop, mobile, and web interfaces. **RelationQA** evaluates functional relational reasoning through multiple-choice questions with marked screenshots and cropped views. **RelationAgent** learns grounding, relational understanding, and navigation in three successive stages.
## Overview

*Figure 2 from the paper: the cross-platform data collection and annotation pipeline of RelationGUI.*
The functional taxonomy covers **trigger**, **complement**, **parallel**, and **none**. RelationQA uses top-1 exact-match accuracy.
| Dataset | Description | Count |
|---|---|---:|
| **RelationGUI (Paper)** | Multi-view / multi-dimension relational samples across Desktop (6,854), Mobile (20,284), and Web (10,586) | 37,724 |
| **RelationGUI (Cleaned v2026.09)** | Quality-filtered canonical relation groups (28,093 source-isolated training groups) | 30,670 |
| **RelationQA** | Multiple-choice relational evaluation benchmark (Desktop 587, Mobile 200, Web 222) | 1,009 |
## Installation
Use Python 3.10+ and a CUDA-compatible PyTorch environment for model training and inference.
```bash
git clone https://github.com/malonghui/RelationGUI.git
cd RelationGUI
python -m venv .venv
# Activate the environment, then:
pip install -r requirements.txt
```
## Dataset Layout
Download the dataset archives from [Hugging Face](https://huggingface.co/datasets/ahuiqqq/RelationGUI) and extract them under `data/`:
```bash
hf download ahuiqqq/RelationGUI --repo-type dataset --revision v2026.09 --local-dir downloads \
--include "*.zip" --include "SHA256SUMS"
python -m zipfile -e downloads/RelationGUI-cleaned.zip data
python -m zipfile -e downloads/RelationQA-cleaned.zip data
```
```text
data/
├── RelationGUI/
│ ├── annotations.jsonl # Canonical relation groups
│ ├── images/
│ └── train/
│ ├── grounding.jsonl
│ ├── referring.jsonl
│ └── relation.jsonl
└── RelationQA/
├── annotations.jsonl # 1,009 benchmark questions and gold labels
└── images/ # Original, red-box marked, and cropped inputs
```
```bash
python train.py --stage grounding --data data/RelationGUI/train/grounding.jsonl \
--image-root data/RelationGUI --output runs/grounding
python merge_adapter.py --adapters runs/grounding --output runs/grounding-merged
python train.py --stage relation --model runs/grounding-merged \
--data data/RelationGUI/train/relation.jsonl --image-root data/RelationGUI \
--output runs/relation
python merge_adapter.py --model runs/grounding-merged \
--adapters runs/relation --output runs/relation-merged
```
For external grounding (UGround) and navigation (Mind2Web) datasets, obtain the data from their respective repositories and pass the formatted JSONL (`instruction`, `output`, and relative `images` paths):
```bash
python train.py --stage navigation --model runs/relation-merged \
--data data/mind2web/train.jsonl --image-root data/mind2web \
--output runs/navigation
```
## RelationQA Evaluation
Inference uses the **red-box marked screenshot and crop** to predict one of the four functional relation labels (`trigger`, `complement`, `parallel`, `none`):
```bash
python infer_relationqa.py --model runs/relation-merged \
--data-root data/RelationQA --output outputs/relationqa.jsonl
python evaluate_relationqa.py --annotations data/RelationQA/annotations.jsonl \
--predictions outputs/relationqa.jsonl
```
Each prediction line is formatted as `{"id": "", "prediction": "trigger"}`. `evaluate_relationqa.py` reports overall accuracy, per-platform accuracy, per-label accuracy, and coverage.
## Citation
```bibtex
@article{ma2026relationgui,
title = {Beyond element-level understanding: Explicit relational understanding for GUI agents},
author = {Ma, Longhui and Zhao, Di and Wang, Siwei and Lv, Zhao and Wang, Miao},
journal = {Pattern Recognition},
volume = {176},
pages = {113262},
year = {2026},
doi = {10.1016/j.patcog.2026.113262}
}
```
## Acknowledgements
We thank the authors of [Qwen2.5-VL](https://github.com/QwenLM/Qwen2.5-VL), [MobileViews](https://huggingface.co/datasets/mllmTeam/MobileViews), [Mind2Web](https://github.com/OSU-NLP-Group/Mind2Web), [UGround](https://github.com/OSU-NLP-Group/UGround), and [ScreenSpot / SeeClick](https://github.com/njucckevin/SeeClick). Code and data are released for academic research use; third-party datasets and models remain subject to their original licenses.