# SCoR: Sparse Context Reset for Long-Horizon GUI Agents Official implementation of **Beyond Planning: Sparse Context Reset for Long-Horizon GUI Agents** (EMNLP 2026). ## What the method does GUI executors such as UI-TARS-1.5-7B and EvoCUA-8B are reliable over short horizons and unreliable over long ones. Our failure analysis says this is often not a capability gap. Replaying 54 OSWorld tasks that both executors fail, and intervening at the first failure state, the same frozen executor recovers far more often when its accumulated context is replaced by a locally executable subtask than when it continues under the original instruction — recovery rises from 27 to 42 states for UI-TARS and 27 to 40 for EvoCUA. We call this the **Task Granularity Gap**: the executor fails not because it lacks the skill, but because it is operating under a context whose granularity falls outside its stable execution regime. **SCoR (Sparse Context Reset)** acts on that gap from outside the executor. A lightweight **Refiner** is invoked only at subtask boundaries — when the executor emits `DONE`, `FAIL`, or `CALL_USER`, or exhausts its local step budget `K`. At each boundary it emits ``` Thought: Subtask: Crop: [ymin, xmin, ymax, xmax] # normalized to [0, 1000] ``` then **resets the executor's local dialogue** and hands control back. The executor runs autonomously under the new context until the next boundary. It never sees the accumulated history of earlier rollouts; long-horizon state reaches it only through the Refiner's reset context. The crop anchors the first observation of the sub-rollout, after which full screenshots resume. Nothing about the environment is reset — the VM, the applications, and the screen all continue. Only the executor's context is. The executor is frozen throughout, including during training. The Refiner is the only trained component. ## Results | Executor | Standalone | + SCoR | | --- | --- | --- | | UI-TARS-1.5-7B | 24.98 | **41.34** (+65.5%) | | EvoCUA-8B | 42.39 | **53.16** (+25.4%) | OSWorld task success rate (%) under a matched 50-step action budget. SCoR with a frozen EvoCUA-8B and a Qwen3-VL-8B Refiner exceeds the reported 50-step results of Agent S2 with Gemini-2.5-Pro (45.76) and Jedi-7B with o3 (50.65). On Online-Mind2Web the same learned reset behavior transfers, taking UI-TARS from 30.00 to 36.60. ## Repository layout ``` scor/ ├── agent/ │ ├── pe.py # RefinerAgent, ExecutorAgent, the reset context │ ├── action_parser.py # action space, response parsing, pyautogui codegen │ └── _utils.py # Qwen2.5-VL resize math, box normalization ├── env/ │ └── osworld_env.py # HTTP client for a remote OSWorld manager/wrapper └── eval/ └── eval_pe.py # multi-GPU evaluation entry point ``` This release covers evaluation. The turn-level GRPO training code for the Refiner is not included yet. ## Setup Python >= 3.10 and one CUDA GPU per evaluation worker. ```bash git clone https://github.com/huia711/SCoR.git cd SCoR pip install -r requirements.txt ``` The pinned stack targets a UI-TARS executor, which needs the legacy vLLM V0 runtime. `requirements.txt` documents the newer pins for a Qwen3-VL-family executor. ### 1. Bring up OSWorld SCoR talks to OSWorld over HTTP rather than driving VMs in-process, so workers can share a pool of machines. Install OSWorld following [the upstream instructions](https://github.com/xlang-ai/OSWorld), then start the API server described in [`third_party/osworld_server/`](third_party/osworld_server/README.md): ```bash cp third_party/osworld_server/*.py /path/to/OSWorld/ cd /path/to/OSWorld && python env_api_manager.py --host 0.0.0.0 --port 8000 ``` ### 2. Build a task index No task data ships here. Generate the index from OSWorld's own split files: ```bash python scripts/make_task_index.py \ --split /path/to/OSWorld/evaluation_examples/test_all.json \ --output data/osworld_test_all.jsonl ``` Each line is `{"domain": ..., "example_id": ...}`. Pass `--domains chrome vlc` for a subset. ## Evaluation ```bash export EXECUTOR_MODEL=/path/to/UI-TARS-1.5-7B # frozen executor export REFINER_MODEL=/path/to/scor-refiner-8b # the trained Refiner export ENV_URL=http:// export ENV_MANAGER_PORT=8000 bash scripts/eval_pe.sh ``` One worker is launched per visible GPU, each holding its own executor engine and its own remote environment. Results land in `results/eval/PE-__/` with per-task screenshots, `model_output.jsonl` (every Refiner and executor turn), `refiner_steps.json`, and `eval.json`. Re-running resumes and skips finished tasks; `--resume_mode success` re-runs only the failures. To serve the Refiner behind an OpenAI-compatible endpoint instead of loading it locally: ```bash export REFINER_API_TYPE=openai export REFINER_API_MODEL= export REFINER_API_BASE_URL=http://:8080/v1 export REFINER_API_KEY= # read from the environment, never committed bash scripts/eval_pe.sh ``` Any flag of `scor.eval.eval_pe` is forwarded verbatim, e.g. `bash scripts/eval_pe.sh --num_eval_workers 4`. `AGENT_MAX_STEPS` caps total environment steps per task, `MAX_PLANS` caps Refiner calls, and `MAX_STEPS_PER_SUBTASK` is the executor's local budget `K`. Setting `REFINER_FIRST=False` lets the executor attempt the global instruction first and only hands over once it stalls, with `--initial_max_steps` sizing that first stretch. ### Tests Refiner output parsing is covered by unit tests that need no VM or GPU: ```bash python -m pytest tests/ -q ``` ## Citation This work will appear at EMNLP 2026. The ACL Anthology entry does not exist until the proceedings are published, so a preprint link and the final BibTeX will be added here. ## Acknowledgements Built on [OSWorld](https://github.com/xlang-ai/OSWorld), [UI-TARS](https://github.com/bytedance/UI-TARS), and [ZeroGUI](https://github.com/OpenGVLab/ZeroGUI). See [NOTICE](NOTICE) for per-file attribution. Released under the [Apache License 2.0](LICENSE).