# Measuring reliability in agentic computer-use RL Reference code, a **reliability toolkit (`cua_reliability`)**, and the evaluation harness for the paper *Teach it to stop, not just to click* (arXiv, 2026). **The paper's spine is a measured reliability methodology for agentic CUA-RL.** Agentic-RL results are reported in single runs, but those numbers are dominated by variance *upstream* of evaluation — chiefly in *which data* you train on, not the random seed (across three cells, σ_eval ≈ 0 and σ_train ≤ 10% everywhere, while σ_data grows with difficulty to 48% on the hardest cell) — and on hard tasks that variance is *bimodal*. A stress test makes the stakes external: a single-run improvement of the size this field publishes has the **wrong sign ~1/3 of the time** in the variance regime we measure. The **testbed** that produces the numbers we characterize is verifier-guided repair of a 35B CUA — Segment-Aggregated On-Policy Self-Distillation (SA-OPSD), a single *completion verifier* used as in-context hint, distillation teacher, reward, and inference gate — which also yields a two-tier repairability gradient that replicates on a second policy. The method is the *apparatus*; the reliability measurement is the contribution. > **The evaluation environments are private and are not part of this release.** > The oracle-graded web-mirror environments, their registry, and the > production training/serving backend are proprietary. This repo ships the > **method**, the **verifier**, the **evaluation/statistics harness**, and the > **reference scripts** — everything that touches private infrastructure does so > through documented interfaces (`sa_opsd/config.py`, `sa_opsd/backend.py`, > `env_registry.example.json`) so you can run it against **your own** > environment and trainer. No secrets, tokens, endpoints, or environment frames > are included. ## Quickstart: report your agentic-RL numbers honestly `cua_reliability` (`sa_opsd/reliability.py`) is **stdlib-only** — `pip install -e .`, or just copy the one file. Given per-seed held-out rates for a condition, it tells you the between-run SD, how many seeds a claim needs, and a bootstrap CI: ```python from sa_opsd.reliability import ( training_run_sd, required_seeds_existence, required_seeds_difference, power_table, bootstrap_ci, ) # per-seed held-out success rates for ONE condition (data + config fixed) rates = [0.09, 0.80, 0.09, 0.86, 0.78, 0.05, 0.81, 0.09, 0.79, 0.83] sd = training_run_sd(rates) # 0.359 between-run SD required_seeds_existence(sum(rates)/len(rates), sd, base=0.0) # 4 seeds to beat base required_seeds_difference(sd, delta=0.18) # 63 seeds to resolve Δ=0.18 power_table(sd) # {0.1: 203, 0.15: 91, 0.2: 51, 0.3: 23, 0.5: 9} bootstrap_ci([1]*14 + [0]*10) # (0.38, 0.79) 95% CI ``` The lesson the paper earns: **existence is cheap (k≤5), resolution is expensive** (telling two high-variance coordinate cells apart needs k≈46). If you publish an agentic-RL delta, run this on your seeds before you believe the mean. If it helps, [cite the paper](#citation). ## What's here ``` sa_opsd/ the method + reliability toolkit (pure-Python) reliability.py cua_reliability: variance components, required-k power, bootstrap CIs (the paper's spine, stdlib-only) methods/ reference losses: grpo.py, gkd.py, sa_opsd.py, witness.py dataset.py RolloutRecord + group-relative advantages + JSONL I/O segments.py segment split / aggregation divergences.py KL / distillation divergences teacher/ teacher (witness) interface + mock env/ AgentEnv INTERFACE (base.py) + mock.py [private impls not shipped] policy.py, budget.py, rollout.py, types.py, pilot_tasks.py config.py all endpoints/credentials via env vars — NO secrets backend.py train_cycle / eval_action CONTRACT (bring your own) scripts/ flagship reference scripts (scrubbed) completion_verifier.py the verifier (any capable VLM; open VLM is a drop-in) build_grpo_fiverr.py build a verifier-scored SA-OPSD batch run_robustness_sweep.py k-seed training protocol eval_heldout_bootstrap.py leakage-free held-out eval + bootstrap 95% CI run_e2e.py end-to-end oracle harness (serves a challenger) fit_variance_components.py crossed-ANOVA variance decomposition + boot CIs rliable_bimodality.py IQM + stratified bootstrap + Hartigan dip test out_of_sample_validation.py validate the k-seed rule on held-out seeds external_stress_test.py P(a field-typical single-run delta flips sign) results/ aggregate result JSONs (stats only — no frames): cross_cell_variance, external_stress_test, out_of_sample_validation, rliable_bimodality, base_prior, frame_stratified, fara_result paper/ the paper (tex + pdf) tests/ unit tests for the method (mock env; no private deps) ``` ## The method in one paragraph For a group of on-policy steps, the completion verifier scores each step (acting after completion = over-execution = reward 0; progress = reward 1), yielding group-relative advantages. The loss combines a **GRPO policy term** (down-weight the bad action via a clipped importance ratio against the captured `log π_old`, with a Schulman-k3 KL anchor to the base) and an **advantage-gated distillation term** (`gate = σ(−A/τ)` × behavior-cloning of the verifier's corrected action), so it can both *push a bad action down* (which imitation cannot) and *install a positive the base never explores*. In the paper this runs as a *multimodal* update — the policy log-probs are conditioned on the screenshots. The reference loss shape is in `sa_opsd/methods/sa_opsd.py`; the advantage shaping is in `sa_opsd/dataset.py`. ## Key results (see the paper) **1 — The reliability spine (the contribution).** A variance-components decomposition across three cells (D=3 independent data draws × k=8 seeds, Henderson crossed-ANOVA, bootstrap CIs): | Cell | σ_data | σ_resid | σ_train | σ_frame | σ_eval | |---|---|---|---|---|---| | Fiverr (token, mean 0.79) | 0.10 | 0.18 | 0.07 | 0.12 | ≈0 | | Shopify (near-coord, mean 0.72) | 0.10 | 0.13 | 0.065 | 0.13 | ≈0 | | Indeed (far-coord, mean 0.29) | **0.26** | 0.22 | 0.12 | 0.10 | ≈0 | - **σ_eval ≈ 0 and σ_train ≤ 10% in every cell** — the noise is never in evaluation and reseeding is never the main source. Data composition's share grows with difficulty — a minority on the two reliably-repaired cells, dominant (48%) only on the hardest. - The hard-cell distribution is **bimodal** (Hartigan dip *p* = 0.07; IQM 0.56, CI [0.19, 0.81]) — a single run has ~30% chance of the failure mode. - **External stress test:** with the effect sizes agentic-RL papers report (e.g. +7.7pp), a single-run measurement has the **wrong sign 33–44%** of the time in the coordinate regime; even +0.20 flips 25–34%. - **Out-of-sample validation:** a *k*-seed mean predicts a held-out half 1.3–1.7× better than a single run. - Two of our own headline claims (a clean sample-efficiency curve; a "grounding cannot be bought" boundary) were **falsified under replication**. **2 — The repair testbed (apparatus).** Held-out independent trajectories, 5 seeds, bootstrap CI — a **two-tier repairability gradient by corrective-action constraint** (a fixed token vs an open-ended coordinate/fill): | Failure (corrective action) | Held-out rate | Boot 95% CI | Base | |---|---|---|---| | Done-detection — `done()` (fixed token) | **0.97 ± 0.06** | [0.95, 0.99] | 0.00 | | Field-targeting — near-prior click | **0.71 ± 0.26** | [0.58, 0.84] | 0.00 | | Spatial grounding — far-prior click | **0.53 ± 0.35** | [0.44, 0.63] | 0.05 | | Form-progression — generative field-fill | **0.14 ± 0.04** | [0.08, 0.19] | 0.00 | A fixed token is reliably installed; open-ended corrections only partially. The ordering **replicates on a second, architecturally distinct policy** (Fara-7B, a dense Qwen2.5-VL: token 1.00 ± 0.00, coordinate 0.81 ± 0.14). Frame-level repair **transfers end-to-end** only when the corrective action is the task's sole blocker (LinkedIn 8/20 vs base 0/15, Fisher *p* = 0.006). ## Reproducing against your own setup 1. Provide a completion verifier (any capable VLM): `export ANTHROPIC_API_KEY=...` (or set `SA_OPSD_VERIFIER_MODEL` and adapt `scripts/completion_verifier.py`). 2. Provide your environment registry and serving endpoint: ```bash cp env_registry.example.json my_envs.json # fill in YOUR envs export SA_OPSD_ENV_REGISTRY=my_envs.json export SA_OPSD_CUA_URL=https://your-agent-endpoint export SA_OPSD_MANTIS_TOKEN=... export SA_OPSD_AUGUR_DSN=... # telemetry, optional ``` 3. Provide a training/eval backend implementing the `sa_opsd/backend.py` contract (`train_cycle` / `eval_action`) and `export SA_OPSD_BACKEND_APP=...`. 4. Run: build a batch (`build_grpo_fiverr.py`), sweep seeds (`run_robustness_sweep.py`), evaluate held-out (`eval_heldout_bootstrap.py`). `sa_opsd/config.py` fails loudly with the exact variable name if anything is missing. The unit tests (`pytest tests/`) run against a mock environment and need none of the above. ## What is deliberately NOT included, and why - **The environments** (oracle-graded web mirrors) — proprietary. - **The environment registry with real endpoints/tokens** — secrets. - **Raw rollout frames** — screenshots of the private environments. - **The production 35B-VLM training/serving backend** — proprietary; its contract is documented in `backend.py` so you can substitute your own. ## License Apache-2.0 (see `LICENSE`). ## Citation If you use `cua_reliability`, the SA-OPSD reference losses, or the reliability protocol, please cite: ```bibtex @misc{sahu2026teach, title = {Teach it to stop, not just to click}, author = {Sahu, Barada and Pandey, Shivesh}, year = {2026}, eprint = {2607.17136}, archivePrefix = {arXiv}, primaryClass = {cs.SE}, doi = {10.48550/arXiv.2607.17136}, url = {https://arxiv.org/abs/2607.17136} } ``` > Published on arXiv: [arxiv.org/abs/2607.17136](https://arxiv.org/abs/2607.17136) > (primary `cs.SE`; cross-listed `cs.LG`, `cs.AI`, `cs.HC`). > DOI: [10.48550/arXiv.2607.17136](https://doi.org/10.48550/arXiv.2607.17136). > The PDF is also at `paper/paper_a_arxiv.pdf`.