Datasets:
Add files using upload-large-folder tool
Browse filesFiles changed (50)
- LICENSEAdded+22
- NOTICEAdded+58
- README.mdAdded+156
- adapters/__init__.pyAdded+6
- data/test.jsonlAdded
- data/trajectories.jsonlAdded
- gui_longdep.pyAdded+60
- images/part_4__pool0-04045--20260321_210933__0006/1.pngAdded
- images/part_4__pool0-04045--20260321_210933__0006/11.pngAdded
- images/part_4__pool0-04045--20260321_210933__0006/16.pngAdded
- images/part_4__pool0-04045--20260321_210933__0006/32.pngAdded
- images/part_4__pool0-04045--20260321_210933__0006/35.pngAdded
- images/part_4__pool0-04045--20260321_210933__0006/40.pngAdded
- images/part_4__pool0-04045--20260321_210933__0006/47.pngAdded
- images/part_4__pool0-04045--20260321_210933__0006/49.pngAdded
- images/part_4__pool0-04045--20260321_210933__0006/6.pngAdded
- images/part_4__pool0-04045--20260321_210933__0006/8.pngAdded
- images/part_4__pool0-04287--20260321_185811__0018/0.pngAdded
- images/part_4__pool0-04287--20260321_185811__0018/1.pngAdded
- images/part_4__pool0-04287--20260321_185811__0018/10.pngAdded
- images/part_4__pool0-04287--20260321_185811__0018/11.pngAdded
- images/part_4__pool0-04287--20260321_185811__0018/12.pngAdded
- images/part_4__pool0-04287--20260321_185811__0018/13.pngAdded
- images/part_4__pool0-04287--20260321_185811__0018/2.pngAdded
- images/part_4__pool0-04287--20260321_185811__0018/3.pngAdded
- images/part_4__pool0-04287--20260321_185811__0018/4.pngAdded
- images/part_4__pool0-04287--20260321_185811__0018/5.pngAdded
- images/part_4__pool0-04287--20260321_185811__0018/6.pngAdded
- images/part_4__pool0-04287--20260321_185811__0018/7.pngAdded
- images/part_4__pool0-04287--20260321_185811__0018/8.pngAdded
- images/part_4__pool0-04287--20260321_185811__0018/9.pngAdded
- images/part_4__pool0-04451--20260322_114022__0107/10.pngAdded
- images/part_4__pool0-04451--20260322_114022__0107/11.pngAdded
- images/part_4__pool0-04451--20260322_114022__0107/12.pngAdded
- images/part_4__pool0-04451--20260322_114022__0107/14.pngAdded
- images/part_4__pool0-04451--20260322_114022__0107/16.pngAdded
- images/part_4__pool0-04451--20260322_114022__0107/17.pngAdded
- images/part_4__pool0-04451--20260322_114022__0107/18.pngAdded
- images/part_4__pool0-04451--20260322_114022__0107/19.pngAdded
- images/part_4__pool0-04451--20260322_114022__0107/2.pngAdded
- images/part_4__pool0-04451--20260322_114022__0107/20.pngAdded
- images/part_4__pool0-04451--20260322_114022__0107/22.pngAdded
- images/part_4__pool0-04451--20260322_114022__0107/23.pngAdded
- images/part_4__pool0-04451--20260322_114022__0107/24.pngAdded
- images/part_4__pool0-04451--20260322_114022__0107/25.pngAdded
- images/part_4__pool0-04451--20260322_114022__0107/27.pngAdded
- images/part_4__pool0-04451--20260322_114022__0107/3.pngAdded
- images/part_4__pool0-04451--20260322_114022__0107/4.pngAdded
- images/part_4__pool0-04451--20260322_114022__0107/5.pngAdded
- score.pyAdded+419
12345678910111213141516171819202122GUI-LongDep: license summary
1. Data (data/ and images/) Licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0): https://creativecommons.org/licenses/by/4.0/legalcode
The data is derived from two datasets: - nvidia/ProCUA-SFT (CC BY 4.0), 250 samples / 147 trajectories; - xlangai/AgentNet (MIT License, Copyright (c) 2025 The OpenCUA Authors), 14 samples / 9 trajectories. The MIT copyright and permission notice for the AgentNet portion is reproduced in NOTICE and must be kept with every copy or substantial portion of that material. See NOTICE for attributions and for the changes made to the upstream data.
2. Code (gui_longdep.py, score.py, adapters/ except adapters/evocua/osworld/) Licensed under the Apache License, Version 2.0: https://www.apache.org/licenses/LICENSE-2.0
3. adapters/evocua/osworld/ Copied from OSWorld-V2 (mm_agents/evocua, mm_agents/utils/qwen_vl_utils.py) under the Apache License, Version 2.0; the full license text is in adapters/evocua/osworld/LICENSE. The only change is that absolute imports were rewritten as relative imports.12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758GUI-LongDep: A Long-Range Dependency Benchmark for GUI AgentsCopyright 2026 The SparseGUI Authors
This dataset contains material from the following works.
------------------------------------------------------------------------------ProCUA-SFT Source: https://huggingface.co/datasets/nvidia/ProCUA-SFT Creator: NVIDIA (Jung et al., "ProCUA-SFT Technical Report", arXiv:2606.17321) License: Creative Commons Attribution 4.0 International (CC BY 4.0) https://creativecommons.org/licenses/by/4.0/ Used: screenshots, task instructions and actions of 147 trajectories. Changes: steps selected; trajectories truncated after the last benchmark step; each action additionally given as structured actions with pixel coordinates (the upstream action code is kept); scoring annotations added; screenshot files renamed (pixel content unchanged).
------------------------------------------------------------------------------AgentNet (OpenCUA) Source: https://huggingface.co/datasets/xlangai/AgentNet Creator: The OpenCUA Authors (Wang et al., "OpenCUA: Open Foundations for Computer-Use Agents", arXiv:2508.09123) License: MIT License (reproduced below) Used: screenshots, task instructions and actions of 9 trajectories (ubuntu, MultiApp). Changes: same as above. Terms of use stated by AgentNet: users must respect the privacy rights and confidentiality of any data subjects represented in the dataset, and any unauthorized reproduction, distribution, or use that infringes upon intellectual property rights is forbidden. The OpenCUA authors ask users to acknowledge OpenCUA and cite the OpenCUA paper.
MIT License
Copyright (c) 2025 The OpenCUA Authors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
------------------------------------------------------------------------------OSWorld-V2 EvoCUA agent code (adapters/evocua/osworld/) Source: OSWorld-V2, commit c098500d251a4c43f8a08fe2784823daf46c7fc6, which ports the agent of meituan/EvoCUA License: Apache License 2.0 (adapters/evocua/osworld/LICENSE) Changes: absolute imports rewritten as relative imports.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156---license: cc-by-4.0language:- enpretty_name: GUI-LongDepsize_categories:- n<1Ktask_categories:- image-text-to-texttags:- gui-agent- computer-use- long-context- benchmarkconfigs:- config_name: default data_files: - split: test path: data/test.jsonl---
# GUI-LongDep: A Long-Range Dependency Benchmark for GUI Agents
GUI-LongDep tests whether a GUI agent uses its long interaction history. Each of the **264samples** is one step of a real desktop trajectory. The correct action at that step needsinformation that was shown **only in an earlier screenshot**, at least 5 steps back, and appearsnowhere in the recent screenshots, the instruction or the action text. Scoring is deterministic(`score.py`, no LLM judge).
Paper: [SparseGUI: Accelerating Long-Horizon GUI Agents with Learned Sparse Attention](https://arxiv.org/pdf/2612.02762).Code: [github.com/MichelleMa8/SparseGUI](https://github.com/MichelleMa8/SparseGUI).See the paper for how the benchmark was built and for full results.
## Data sources
All screenshots, instructions and trajectories come from **two public datasets**. We selected thesteps, truncated each trajectory after its last benchmark step, added structured pixel actionsnext to the upstream action code and added the scoring annotations. Screenshots arebyte-identical to upstream.
| Source | License | Samples | Trajectories ||---|---|---:|---:|| [nvidia/ProCUA-SFT](https://huggingface.co/datasets/nvidia/ProCUA-SFT) | CC BY 4.0 | 250 | 147 || [xlangai/AgentNet](https://huggingface.co/datasets/xlangai/AgentNet) | MIT | 14 | 9 |
## Files
```data/test.jsonl 264 samples: traj_id, step, gold_action, requirements, evidence, ...data/trajectories.jsonl 156 trajectories: instruction, stepsimages/<traj_key>/<t>.png 4,006 screenshots, 1920x1080gui_longdep.py loader (standard library only)score.py scorer (standard library only)adapters/evocua/ example adapter: EvoCUA prompt and reply parsing (prompt needs Pillow)LICENSE, NOTICE licenses and upstream attributions```
The data does not depend on any model's prompt or output format. Each trajectory step has:
| Field | Content ||---|---|| `image` | screenshot before the action || `description` | the action in natural language || `actions` | the action as a list of structured actions (below), coordinates in **pixels** || `code` | the upstream action code as recorded (pyautogui; AgentNet uses 0–1 coordinates) |
`gold_action` of a sample uses the same action format:
| `action` | Fields ||---|---|| `left_click`, `right_click`, `double_click`, `triple_click`, `mouse_move` | `coordinate` [x, y] || `left_click_drag` | `coordinate` (end point; starts at the current pointer position), `duration` || `type` | `text` || `key` | `keys` (pressed together, e.g. `["ctrl", "c"]`) || `key_down`, `key_up` | `keys` || `scroll` | `pixels` (amount as in `pyautogui.scroll`: positive up, negative down; at the pointer position) || `wait` | `time` (seconds) |
## Usage
For a sample (`traj_id`, `step` = *t*), give the model the instruction, the history of steps0 … *t*−1 and screenshot *t*, and let it predict the action at step *t*. How the history is shown(screenshots, descriptions, actions) is up to the model's own prompt format.
```pythonfrom gui_longdep import GUILongDep # run from the dataset folderbench = GUILongDep(".")for sample in bench.samples: task = bench.task(sample) # instruction, history (steps 0..t-1), screenshot (step t) ... # build your prompt, run the model```
Convert each prediction to pixel actions and write one line per sample,`{"sample_id": ..., "actions": [...]}`, then score:
```bashpython score.py --predictions preds.jsonl --out report.jsonpython score.py --self-check # gold actions score 264/264```
A sample is correct if the first predicted action has the gold action type and every entry in`requirements` passes. Only the remembered content is checked (typed text, a clicked region orkeys), not the exact wording or coordinates of the gold action.
**Adapters.** To support a model, add `adapters/<name>/` with a `to_actions(response, width,height)` function that parses its raw reply into pixel actions; then`python score.py --predictions replies.jsonl --adapter <name>` scores lines of`{"sample_id": ..., "response": "<raw reply>"}`. `adapters/evocua` is the adapter for theEvoCUA agent used in the paper. It also builds the exact EvoCUA request:
```pythonfrom adapters.evocua import EvoCUAPrompterprompter = EvoCUAPrompter(".")messages = prompter.messages(prompter.bench.samples[0], history="full") # or "trunc4"```
## License
- **Data** (`data/`, `images/`): CC BY 4.0. The AgentNet portion is used under the MIT License; its notice is reproduced in `NOTICE`. Keep `NOTICE` with every copy.- **Code** (`gui_longdep.py`, `score.py`, `adapters/`): Apache-2.0. `adapters/evocua/osworld/` is vendored from OSWorld-V2.- AgentNet asks users to respect the privacy of anyone shown in the data and not to infringe intellectual property. These terms also apply to the AgentNet samples here.
## Citation
Please cite our paper **and the two source datasets**:
```bibtex@misc{sparsegui2026, title = {SparseGUI: Accelerating Long-Horizon GUI Agents with Learned Sparse Attention}, year = {2026}, eprint = {2612.02762}, archivePrefix = {arXiv}, url = {https://arxiv.org/abs/2612.02762}}
@misc{jung2026procuasfttechnicalreport, title = {ProCUA-SFT Technical Report}, author = {Jaehun Jung and Ximing Lu and Brandon Cui and Muhammad Khalifa and Shaokun Zhang and Hao Zhang and Jin Xu and Amala Sanjay Deshmukh and Karan Sapra and Andrew Tao and Yejin Choi and Jan Kautz and Mingjie Liu and Yi Dong}, year = {2026}, eprint = {2606.17321}, archivePrefix = {arXiv}, url = {https://arxiv.org/abs/2606.17321}}
@misc{wang2025opencuaopenfoundationscomputeruse, title = {OpenCUA: Open Foundations for Computer-Use Agents}, author = {Xinyuan Wang and Bowen Wang and Dunjie Lu and Junlin Yang and Tianbao Xie and Junli Wang and Jiaqi Deng and Xiaole Guo and Yiheng Xu and Chen Henry Wu and Zhennan Shen and Zhuokai Li and Ryan Li and Xiaochuan Li and Junda Chen and Boyuan Zheng and Peihang Li and Fangyu Lei and Ruisheng Cao and Yeqiao Fu and Dongchan Shin and Martin Shin and Jiarui Hu and Yuyan Wang and Jixuan Chen and Yuxiao Ye and Danyang Zhang and Dikang Du and Hao Hu and Huarong Chen and Zaida Zhou and Haotian Yao and Ziwei Chen and Qizheng Gu and Yipu Wang and Heng Wang and Diyi Yang and Victor Zhong and Flood Sung and Y. Charles and Zhilin Yang and Tao Yu}, year = {2025}, eprint = {2508.09123}, archivePrefix = {arXiv}, url = {https://arxiv.org/abs/2508.09123}}```123456"""Model adapters for GUI-LongDep.
An adapter turns the model-independent data into one model's prompt and turns that model'sraw reply into pixel actions. ``score.py --adapter <name>`` imports ``adapters.<name>`` and callsits ``to_actions(response, width, height)``. ``evocua`` is the reference adapter."""123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960"""Model-independent loader for GUI-LongDep. Standard library only.
from gui_longdep import GUILongDep bench = GUILongDep(".") # folder of the downloaded dataset for sample in bench.samples: task = bench.task(sample) task["instruction"] # task instruction task["history"] # steps 0..t-1: {t, image, description, actions, code} task["screenshot"] # path of the screenshot at step t (to act on) # ... build your model's prompt, run it, convert its reply to pixel actions ...
Every step of a trajectory stores the upstream action in three model-independent forms:
description natural-language description of the action actions structured actions with pixel coordinates (schema: README.md) code the upstream action code as recorded (pyautogui; AgentNet uses 0..1 coordinates)
Turn ``history`` into your model's own prompt format and score its predictions, convertedto pixel actions, with ``score.py``. ``adapters/evocua`` is a complete example."""from __future__ import annotations
import jsonfrom pathlib import Path
def read_jsonl(path: str | Path) -> list[dict]: with open(path, encoding="utf-8") as fh: return [json.loads(line) for line in fh if line.strip()]
class GUILongDep: def __init__(self, root: str | Path = "."): self.root = Path(root) self.samples = read_jsonl(self.root / "data/test.jsonl") self.trajectories = {t["traj_id"]: t for t in read_jsonl(self.root / "data/trajectories.jsonl")}
def steps(self, sample: dict) -> list[dict]: """Steps 0..t of the sample's trajectory (step t is the one to predict).""" traj = self.trajectories[sample["traj_id"]] t = int(sample["step"]) steps = traj["steps"][: t + 1] if [s["t"] for s in steps] != list(range(t + 1)): raise ValueError(f"{sample['sample_id']}: trajectory steps 0..{t} are incomplete") return steps
def image_path(self, step: dict) -> Path: return self.root / step["image"]
def task(self, sample: dict) -> dict: """What a model may see at the sample's step: instruction, steps 0..t-1, screenshot t.""" traj = self.trajectories[sample["traj_id"]] steps = self.steps(sample) return { "instruction": traj["instruction"], "width": traj["width"], "height": traj["height"], "history": steps[:-1], "screenshot": self.image_path(steps[-1]), }123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419#!/usr/bin/env python"""Deterministic scorer for GUI-LongDep, a long-range dependency benchmark for GUI agents.
Standard library only. No LLM judge is called.
A sample is correct iff 1. the first canonical predicted call has the same action as the first canonical gold call (``type`` followed by ``key enter`` is one ``type`` call), and 2. every entry of ``requirements`` passes (``aggregation = "all"``).
Requirement types (text checks look only at the first canonical call's text): norm every span occurs in the predicted text after normalization, on token boundaries (``700`` does not match inside ``7000``, ``0.19`` not inside ``0.199``); each span consumes its own occurrence. norm_ordered as ``norm``, and the spans occur in the listed order. num the number at the span's position is within ``tolerance_abs`` of ``value``. The position is the whole text when the gold text is a single field, otherwise the same tab-separated field as in the gold text. box the first predicted call is the required pointer action and its point lies inside ``target_box`` (pixels, inclusive). key the prediction is exactly one ``key`` call with the required keys.
Role rules derived from the gold text: * tab fields if the gold ``type`` text is a tab-separated row and a span equals one whole field, the same predicted field must equal the span. * binding all spans of the requirement must occur in one segment of the prediction split on , ; tab and newline. * missing_value the whole predicted text (or its tab field) must equal the span. * allowed_variants a span also passes if one of its listed literal variants passes.
Text normalization: Unicode NFKC, typographic quotes to ASCII, case folding, validthousands separators removed, whitespace runs collapsed.
Predictions are model-independent: a list of actions in the dataset's action format (seeREADME.md), with coordinates in **pixels** of the 1920x1080 screenshot. Predictions file(JSONL), one line per sample:
{"sample_id": "lr-0000", "actions": [{"action": "type", "text": "1884"}]} {"sample_id": "lr-0001", "actions": [{"action": "left_click", "coordinate": [169, 248]}]}
To score raw model replies instead, give ``--adapter <name>``: lines then carry``{"sample_id": ..., "response": "<raw reply>"}`` and ``adapters/<name>``'s``to_actions(response, width, height)`` converts each reply to pixel actions.
Usage: python score.py --predictions preds.jsonl [--out report.json] python score.py --predictions replies.jsonl --adapter evocua python score.py --self-check # gold must score 264/264"""from __future__ import annotations
import argparseimport importlibimport jsonimport reimport sysimport unicodedatafrom collections import defaultdictfrom pathlib import Path
HERE = Path(__file__).resolve().parentSCREEN = (1920, 1080) # every screenshot of the benchmark
# --------------------------------------------------------------------------- ## Action canonicalization# --------------------------------------------------------------------------- #_ALIASES = {"click": "left_click", "drag": "left_click_drag"}_KEY_ALIASES = {"return": "enter", "escape": "esc"}_CLICKS = {"left_click", "right_click", "middle_click", "double_click", "triple_click"}
def _clean_keys(raw_keys): keys = raw_keys if isinstance(raw_keys, list) else [raw_keys] out = [] for key in keys: if isinstance(key, str): if key.startswith("keys=["): key = key[6:] if key.endswith("]"): key = key[:-1] if key.startswith("['") or key.startswith('["'): key = key[2:] if len(key) > 2 else key if key.endswith("']") or key.endswith('"]'): key = key[:-2] if len(key) > 2 else key key = key.strip() out.append(key) return out
def _point(v): try: return float(v[0]), float(v[1]) except (TypeError, IndexError, ValueError, KeyError): return None
def _norm_keys(keys): out = [] for k in _clean_keys(keys if isinstance(keys, list) else [keys]): k = str(k) if len(k) > 1: k = _KEY_ALIASES.get(k.lower(), k.lower()) out.append(k) return out
def _canon_one(a): a = dict(a) name = _ALIASES.get(str(a["action"]), str(a["action"])) if name == "click": name = "left_click" a["action"] = name if name in ("key", "key_down", "key_up"): a["keys"] = _norm_keys(a.get("keys", [])) if name == "terminate": a["status"] = "failure" if str(a.get("status", "success")).lower() == "failure" else "success" return a
def canonical_calls(calls): """Normalize names / keys and merge multi-call patterns that execute as one action.""" c = [_canon_one(a) for a in (calls or [])] out, i = [], 0 while i < len(c): a = c[i] nxt = c[i + 1] if i + 1 < len(c) else None if a["action"] == "mouse_move" and nxt is not None and nxt["action"] == "scroll": out.append({**nxt, "coordinate": a.get("coordinate")}) i += 2 continue if a["action"] == "mouse_move" and nxt is not None and nxt["action"] == "left_click_drag": out.append({**nxt, "start": a.get("coordinate")}) i += 2 continue if (a["action"] == "key_down" and i + 2 < len(c) and c[i + 1]["action"] in _CLICKS and c[i + 2]["action"] == "key_up" and c[i + 2]["keys"] == a["keys"]): out.append({**c[i + 1], "modifiers": list(a["keys"])}) i += 3 continue if (a["action"] == "type" and nxt is not None and nxt["action"] == "key" and nxt["keys"] == ["enter"]): out.append({**a, "text": str(a.get("text", "")) + "\n"}) i += 2 continue out.append(a) i += 1 return out
# --------------------------------------------------------------------------- ## Text normalization and boundary-aware search# --------------------------------------------------------------------------- #_SEGMENT = re.compile(r"[,;\t\n]")_QUOTES = str.maketrans({"‘": "'", "’": "'", "‚": "'", "‛": "'", "“": '"', "”": '"', "„": '"', "‟": '"'})_THOUSANDS = re.compile(r"(?<![\d.,])\d{1,3}(?:,\d{3})+(?![\d,]|\.\d*,)")_NUMBER = re.compile(r"[+-]?(?:\d+(?:\.\d*)?|\.\d+)%?")
def norm(s): s = unicodedata.normalize("NFKC", str(s if s is not None else "")).translate(_QUOTES) s = _THOUSANDS.sub(lambda m: m.group(0).replace(",", ""), s) return re.sub(r"\s+", " ", s).strip().casefold()
def _ascii_alnum(c): return c.isascii() and c.isalnum()
def _boundary_ok(text, i, j): """``text[i:j]`` is not glued to a neighbouring ASCII token or to a decimal part.""" if i > 0 and _ascii_alnum(text[i]): p = text[i - 1] if _ascii_alnum(p): return False if p in ".," and text[i].isdigit() and i > 1 and text[i - 2].isdigit(): return False if j < len(text) and _ascii_alnum(text[j - 1]): n = text[j] if _ascii_alnum(n): return False if n in ".," and text[j - 1].isdigit() and j + 1 < len(text) and text[j + 1].isdigit(): return False return True
def find_all(text, span): out, start = [], 0 if not span: return out while (i := text.find(span, start)) >= 0: if _boundary_ok(text, i, i + len(span)): out.append((i, i + len(span))) start = i + 1 return out
def _fields(text): return [norm(f) for f in str(text).rstrip("\n").split("\t")]
# --------------------------------------------------------------------------- ## Requirement checks# --------------------------------------------------------------------------- #def _parse_number(s, unit): s = norm(s).replace(" ", "") if not _NUMBER.fullmatch(s): return None pct = s.endswith("%") v = float(s.rstrip("%")) if pct: if not re.search(r"proportion|fraction", unit or "", re.I): return None v /= 100 return v
class _Text: """The predicted text with the occurrences already claimed by earlier spans."""
def __init__(self, raw): self.raw = raw self.text = norm(raw) self.fields = _fields(raw) self.used = []
def take(self, span, after=-1): for i, j in find_all(self.text, span): if i < after or any(i < b and a < j for a, b in self.used): continue return i, j return None
def _span_ok(t, span, field, whole, after): if field is not None: ok = field < len(t.fields) and t.fields[field] == span return after if ok else None if whole: return len(t.text) if t.text == span else None hit = t.take(span, after) if hit is None: return None t.used.append(hit) return hit[1]
def check_requirement(req, pred, t, fields): """One requirement against the canonical predicted calls; ``(passed, reason)``.""" m = req["match"] first = pred[0] if pred else None if m == "key": want = _norm_keys(req.get("keys") or []) ok = len(pred) == 1 and first["action"] == "key" and first.get("keys") == want return ok, "ok" if ok else "key" if m == "box": if first is None or first["action"] != _canon_one({"action": req.get("action", "left_click")})["action"]: return False, "box_action" p = _point(first.get("coordinate")) if p is None: return False, "box_coord" x0, y0, x1, y1 = req["target_box"] ok = x0 <= p[0] <= x1 and y0 <= p[1] <= y1 return ok, "ok" if ok else "box" if t is None: return False, "not_type" if m == "num": field = fields.get(id(req), [None])[0] if field is not None: src = t.fields[field] if field < len(t.fields) else None else: src = t.text if len(t.fields) == 1 else None if src is None: return False, "num_position" v = _parse_number(src, req.get("unit", "")) if v is None: return False, "num_parse" ok = abs(v - float(req["value"])) <= float(req["tolerance_abs"]) + 1e-9 return ok, "ok" if ok else "num_tol" if m not in ("norm", "norm_ordered"): return False, f"unknown_match:{m}" spans = [norm(s) for s in req.get("span") or []] variants = {norm(k): [norm(v) for v in vs] for k, vs in (req.get("allowed_variants") or {}).items()} req_fields = fields.get(id(req), [None] * len(spans)) whole = bool(req.get("missing_value")) ordered = m == "norm_ordered" texts = [t] if req.get("binding"): raw = _THOUSANDS.sub(lambda mm: mm.group(0).replace(",", ""), unicodedata.normalize("NFKC", t.raw)) texts = [_Text(part) for part in _SEGMENT.split(raw)] for seg in texts: used0, after, ok = list(seg.used), -1, True for span, field in zip(spans, req_fields): res = None for cand in [span] + variants.get(span, []): f = field if seg is t else None res = _span_ok(seg, cand, f, whole and f is None, after if ordered else -1) if res is not None: break if res is None: ok = False break after = res if ok: return True, "ok" seg.used = used0 return False, "binding" if req.get("binding") else "span"
def _assign_fields(sample, gold_text): """Gold tab-field index of each span that equals a whole gold field.""" out = {} if gold_text is None or "\t" not in str(gold_text).rstrip("\n"): return out gf, taken = _fields(gold_text), set() for req in sample["requirements"]: if req["match"] not in ("norm", "norm_ordered", "num"): continue idx = [] for s in req.get("span") or []: hits = [k for k, f in enumerate(gf) if f == norm(s)] free = [k for k in hits if k not in taken] k = (free or hits or [None])[0] if k is not None: taken.add(k) idx.append(k) out[id(req)] = idx return out
def score(sample, pred_actions): """Score one prediction (pixel actions): ``correct`` / ``action`` (0/1) and reasons.""" gold = canonical_calls(sample["gold_action"]) pred = canonical_calls(pred_actions) if not pred: return {"correct": 0, "action": 0, "reasons": ["no_call"]} action_ok = pred[0]["action"] == gold[0]["action"] gold_text = gold[0].get("text") if gold[0]["action"] == "type" else None t = _Text(pred[0].get("text", "")) if pred[0]["action"] == "type" else None fields = _assign_fields(sample, gold_text) reasons = [check_requirement(r, pred, t, fields)[1] for r in sample["requirements"]] passed = action_ok and all(r == "ok" for r in reasons) return {"correct": int(passed), "action": int(action_ok), "reasons": reasons if action_ok else ["action"] + reasons}
# --------------------------------------------------------------------------- ## CLI# --------------------------------------------------------------------------- #def _read_jsonl(path): with open(path, encoding="utf-8") as fh: return [json.loads(line) for line in fh if line.strip()]
def summarize(samples, per_sample): groups = defaultdict(list) for s in samples: r = per_sample.get(s["sample_id"]) v = r["correct"] if r is not None else 0 groups["all"].append(v) groups[f"rule:{s['rule']}"].append(v) groups[f"source:{s['source']}"].append(v) return {g: {"n": len(v), "accuracy": sum(v) / len(v)} for g, v in sorted(groups.items())}
def main(argv=None): ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) ap.add_argument("--samples", default=str(HERE / "data/test.jsonl")) ap.add_argument("--predictions", help="JSONL with sample_id + actions (or response, with --adapter)") ap.add_argument("--adapter", help="model adapter in adapters/ that parses raw replies, e.g. evocua") ap.add_argument("--self-check", action="store_true", help="score gold against itself") ap.add_argument("--out", help="write the full report (with per-sample results) as JSON") args = ap.parse_args(argv)
samples = _read_jsonl(args.samples) if args.self_check: fails = [s["sample_id"] for s in samples if not score(s, s["gold_action"])["correct"]] print(f"self-check: {len(samples) - len(fails)}/{len(samples)} gold actions pass") if fails: print("failing:", fails[:20]) return 1 if fails else 0 if not args.predictions: ap.error("--predictions is required unless --self-check")
to_actions = None if args.adapter: sys.path.insert(0, str(HERE)) to_actions = importlib.import_module(f"adapters.{args.adapter}").to_actions by_id = {s["sample_id"]: s for s in samples} per_sample, unknown, duplicate = {}, 0, 0 for p in _read_jsonl(args.predictions): sid = p.get("sample_id") if sid not in by_id: unknown += 1 continue if sid in per_sample: duplicate += 1 actions = to_actions(p.get("response"), *SCREEN) if to_actions else p.get("actions") per_sample[sid] = score(by_id[sid], actions) missing = len(samples) - len(per_sample) report = {"n_samples": len(samples), "n_predicted": len(per_sample), "missing_scored_wrong": missing, "unknown_ids": unknown, "duplicate_ids": duplicate, "groups": summarize(samples, per_sample)} for g, r in report["groups"].items(): print(f"{g:32s} n={r['n']:4d} accuracy={r['accuracy']:.4f}") if missing or unknown or duplicate: print(f"warning: {missing} samples without prediction (scored wrong), " f"{unknown} unknown ids, {duplicate} duplicate ids", file=sys.stderr) if args.out: with open(args.out, "w", encoding="utf-8") as fh: json.dump({**report, "per_sample": per_sample}, fh, indent=1, ensure_ascii=False) return 0
if __name__ == "__main__": sys.exit(main())LICENSEAdded+22
NOTICEAdded+58
README.mdAdded+156
adapters/__init__.pyAdded+6
data/test.jsonlAdded
data/trajectories.jsonlAdded
gui_longdep.pyAdded+60
images/part_4__pool0-04045--20260321_210933__0006/1.pngAdded

Large File Pointer Details
- SHA256: e56e0065c8fe473e3449a6d967b4206466f8c2c0065cd65f3dc11e7757a08498
- Pointer size: 131 Bytes
- Size of remote file: 268 kB
images/part_4__pool0-04045--20260321_210933__0006/11.pngAdded

Large File Pointer Details
- SHA256: ab4e967c3055ffcd04b4f02f54bbecfea9634a4eecf7ccbe41102df238a2b026
- Pointer size: 131 Bytes
- Size of remote file: 775 kB
images/part_4__pool0-04045--20260321_210933__0006/16.pngAdded

Large File Pointer Details
- SHA256: f14d24ebbb7d7cb7204a9a3ab26aa82ff672aafc9749708e85e86480e22e381c
- Pointer size: 131 Bytes
- Size of remote file: 131 kB
images/part_4__pool0-04045--20260321_210933__0006/32.pngAdded

Large File Pointer Details
- SHA256: cb163e50e3b3fef369c60b652eb52bfcc72f7302682c6843d24eec5c4437d057
- Pointer size: 131 Bytes
- Size of remote file: 136 kB
images/part_4__pool0-04045--20260321_210933__0006/35.pngAdded

Large File Pointer Details
- SHA256: 0a8e8398108cf995064fba2c3d96923ae0620cc64a800afb1a44b9a59305e257
- Pointer size: 131 Bytes
- Size of remote file: 136 kB
images/part_4__pool0-04045--20260321_210933__0006/40.pngAdded

Large File Pointer Details
- SHA256: 408716a594ef74d4d4de02e29ab0b4b36fd28e2e72b953ff7b1c74fc9947d2b3
- Pointer size: 131 Bytes
- Size of remote file: 137 kB
images/part_4__pool0-04045--20260321_210933__0006/47.pngAdded

Large File Pointer Details
- SHA256: 7413a196bb7c4d44fc8f860da0a1287303af81a586507de832263a81e2c7ddb2
- Pointer size: 131 Bytes
- Size of remote file: 138 kB
images/part_4__pool0-04045--20260321_210933__0006/49.pngAdded

Large File Pointer Details
- SHA256: 39f7b1320756a7894d6c7cfc5abd515629eb6fcfd2979610c0de67df2f2063d4
- Pointer size: 131 Bytes
- Size of remote file: 138 kB
images/part_4__pool0-04045--20260321_210933__0006/6.pngAdded

Large File Pointer Details
- SHA256: b636e150c70a5cdb67d27c057b822980bb2b7dc304d460a7f0e028afd77b9c4d
- Pointer size: 131 Bytes
- Size of remote file: 265 kB
images/part_4__pool0-04045--20260321_210933__0006/8.pngAdded

Large File Pointer Details
- SHA256: 8cdc9c4479876c0e521936b7a17e768e66d7e9939b0de5ce3e5c1bf381c59e62
- Pointer size: 131 Bytes
- Size of remote file: 310 kB
images/part_4__pool0-04287--20260321_185811__0018/0.pngAdded

Large File Pointer Details
- SHA256: bc7443baeac942aa2ddfd8cb0420e9908c7e82fc0409d3ef1d5478d4958bda66
- Pointer size: 131 Bytes
- Size of remote file: 501 kB
images/part_4__pool0-04287--20260321_185811__0018/1.pngAdded

Large File Pointer Details
- SHA256: 19d4329b458232a05313a2c382c5c5edf93571430428140475171471d073b51b
- Pointer size: 131 Bytes
- Size of remote file: 106 kB
images/part_4__pool0-04287--20260321_185811__0018/10.pngAdded

Large File Pointer Details
- SHA256: de75842ede2527715946b1a3059c153cd14d7997df1f2afdbf5ef71c6f17cb3c
- Pointer size: 131 Bytes
- Size of remote file: 140 kB
images/part_4__pool0-04287--20260321_185811__0018/11.pngAdded

Large File Pointer Details
- SHA256: a1ae1f31f0b1a0234e0a5aae722bffded83f3f55d4569e0128160a85016c4eb7
- Pointer size: 131 Bytes
- Size of remote file: 139 kB
images/part_4__pool0-04287--20260321_185811__0018/12.pngAdded

Large File Pointer Details
- SHA256: f897876534047d549fd7f702b86d141362e1c2b2a5157e5b74de2d10a8af58a3
- Pointer size: 131 Bytes
- Size of remote file: 140 kB
images/part_4__pool0-04287--20260321_185811__0018/13.pngAdded

Large File Pointer Details
- SHA256: 56be098f97f74d7019030c9d9f308a22fac8eebd75e4d36347ae040fb0d9db17
- Pointer size: 131 Bytes
- Size of remote file: 139 kB
images/part_4__pool0-04287--20260321_185811__0018/2.pngAdded

Large File Pointer Details
- SHA256: 9771adbecd17163351ae880fb0c64c7ebc8cbc8be6eca4e94d6a9c0160535036
- Pointer size: 131 Bytes
- Size of remote file: 128 kB
images/part_4__pool0-04287--20260321_185811__0018/3.pngAdded

Large File Pointer Details
- SHA256: 86bbeaae9bdd46a25919bdce694b520ce9a7d1db568945b91d8fb5f84a6c2a79
- Pointer size: 131 Bytes
- Size of remote file: 113 kB
images/part_4__pool0-04287--20260321_185811__0018/4.pngAdded

Large File Pointer Details
- SHA256: a68652b907ad3af1cbca2b13800be58c4f08a0107473b8e44bf5939c9a11991e
- Pointer size: 131 Bytes
- Size of remote file: 290 kB
images/part_4__pool0-04287--20260321_185811__0018/5.pngAdded

Large File Pointer Details
- SHA256: 7d61c9b01bea3dc67a8002517065f11119d55db30f3871bdbcbe3bf8448ce45d
- Pointer size: 131 Bytes
- Size of remote file: 292 kB
images/part_4__pool0-04287--20260321_185811__0018/6.pngAdded

Large File Pointer Details
- SHA256: b4735bd0978e3c1c115e191b4c3e9d38849b0a48676d95fc4fa2f5f14cd5c411
- Pointer size: 131 Bytes
- Size of remote file: 287 kB
images/part_4__pool0-04287--20260321_185811__0018/7.pngAdded

Large File Pointer Details
- SHA256: ba7af0c89fff8688804026177eac24bc5e1804f90159cfe2b73e15ea8adbcf04
- Pointer size: 131 Bytes
- Size of remote file: 138 kB
images/part_4__pool0-04287--20260321_185811__0018/8.pngAdded

Large File Pointer Details
- SHA256: 890e2eb69dff367be9766ae9ab7623c0492914b7f90e0da30ed9a98108f311b5
- Pointer size: 131 Bytes
- Size of remote file: 139 kB
images/part_4__pool0-04287--20260321_185811__0018/9.pngAdded

Large File Pointer Details
- SHA256: 2693ad60b9fe7a9ecccbd869c143b08892b28982ac9ebadf045daffe4f1fd0cf
- Pointer size: 131 Bytes
- Size of remote file: 138 kB
images/part_4__pool0-04451--20260322_114022__0107/10.pngAdded

Large File Pointer Details
- SHA256: 306ea2ad150d5d7590868c11343f3216347ae1f0973ff75324faca50ee945896
- Pointer size: 131 Bytes
- Size of remote file: 372 kB
images/part_4__pool0-04451--20260322_114022__0107/11.pngAdded

Large File Pointer Details
- SHA256: 24080e2818b39da6c661d4e8449bea4ce8380d70c4aebb2a84d367c609d2883b
- Pointer size: 131 Bytes
- Size of remote file: 374 kB
images/part_4__pool0-04451--20260322_114022__0107/12.pngAdded

Large File Pointer Details
- SHA256: 75004e9ffe71b91f0627147dab4ba374c9992a11eb01a527564c4977f628e745
- Pointer size: 131 Bytes
- Size of remote file: 372 kB
images/part_4__pool0-04451--20260322_114022__0107/14.pngAdded

Large File Pointer Details
- SHA256: b01619d23dca822e7e9073887bf2c3a751261e64d41b54ec1f725413f2d79959
- Pointer size: 131 Bytes
- Size of remote file: 372 kB
images/part_4__pool0-04451--20260322_114022__0107/16.pngAdded

Large File Pointer Details
- SHA256: 9326c6ab3135dd28df28f98ba8320a1288d0628fdfda98e485d102db9d34ef23
- Pointer size: 131 Bytes
- Size of remote file: 142 kB
images/part_4__pool0-04451--20260322_114022__0107/17.pngAdded

Large File Pointer Details
- SHA256: 2d59836b3e6d47b7cd3bf2057bedf95ddd583c35f4982562ca60c6915efffb75
- Pointer size: 131 Bytes
- Size of remote file: 140 kB
images/part_4__pool0-04451--20260322_114022__0107/18.pngAdded

Large File Pointer Details
- SHA256: 715fe0934b0b444b98b05dc099acbda8d0f25226b53cb4b33bd3ba5610ccf397
- Pointer size: 131 Bytes
- Size of remote file: 142 kB
images/part_4__pool0-04451--20260322_114022__0107/19.pngAdded

Large File Pointer Details
- SHA256: 644dd6cf84313dcee48cd24d708f3ea470feb4d88554ea1e4fa8b5f53c451693
- Pointer size: 131 Bytes
- Size of remote file: 141 kB
images/part_4__pool0-04451--20260322_114022__0107/2.pngAdded

Large File Pointer Details
- SHA256: b2869301ffa3856a44ac041bc57d23d64842067a15fa93b6a2a23fa1edf0d0b9
- Pointer size: 131 Bytes
- Size of remote file: 372 kB
images/part_4__pool0-04451--20260322_114022__0107/20.pngAdded

Large File Pointer Details
- SHA256: 94c50b95dae9ccdd8a8bfd58ecff7d81f73091166292c964b0148a39938e7f51
- Pointer size: 131 Bytes
- Size of remote file: 141 kB
images/part_4__pool0-04451--20260322_114022__0107/22.pngAdded

Large File Pointer Details
- SHA256: 9b14650f29af53e45bec09ee5e2704b759c3e6646cbe8ce1ef97a32b0fe47649
- Pointer size: 131 Bytes
- Size of remote file: 141 kB
images/part_4__pool0-04451--20260322_114022__0107/23.pngAdded

Large File Pointer Details
- SHA256: fcd81ad17df9e79eae09d81ddab2f4ca37227b212b33a1ab33a23684c4e0d6d9
- Pointer size: 131 Bytes
- Size of remote file: 141 kB
images/part_4__pool0-04451--20260322_114022__0107/24.pngAdded

Large File Pointer Details
- SHA256: 4754b35824e90efa16d09c84d19d4c5fa17a435676da9230d57d532c30b86dff
- Pointer size: 131 Bytes
- Size of remote file: 142 kB
images/part_4__pool0-04451--20260322_114022__0107/25.pngAdded

Large File Pointer Details
- SHA256: f3e1d49a21dc6e1bc0f8e0870607f2e6cabcd53de67499a781e9532a6d7ecdac
- Pointer size: 131 Bytes
- Size of remote file: 142 kB
images/part_4__pool0-04451--20260322_114022__0107/27.pngAdded

Large File Pointer Details
- SHA256: b3e35c534660174c58996d7ed43d64c7aa3d4c7e8f442b92edfe51da409209db
- Pointer size: 131 Bytes
- Size of remote file: 141 kB
images/part_4__pool0-04451--20260322_114022__0107/3.pngAdded

Large File Pointer Details
- SHA256: aa792e8690d67b0d2863285627e7d4e3d03e5a5b5646fcf2b6778f7bc54c5ef9
- Pointer size: 131 Bytes
- Size of remote file: 372 kB
images/part_4__pool0-04451--20260322_114022__0107/4.pngAdded

Large File Pointer Details
- SHA256: 1848020a114b1e4d9d275195165e86b7fb954dd41b5c4632782c7a9979c7b713
- Pointer size: 131 Bytes
- Size of remote file: 137 kB
images/part_4__pool0-04451--20260322_114022__0107/5.pngAdded

Large File Pointer Details
- SHA256: 70ebfc155ccb38b869304d72a50568f3d7fbb3a8168b0b43e976594f47ff1319
- Pointer size: 131 Bytes
- Size of remote file: 247 kB
score.pyAdded+419