arXiv 2611.04142 (3 November 2026) stops failing web agents from readable patterns in their first steps. A small reimplementation and how to choose the stopping threshold.
Failing runs cost the most
An agent run that is going to fail usually does not fail quickly. It re-checks the same element, retries a malformed action, or clicks around without progress until it hits its step budget. Because every step re-sends the growing history, the late steps are the expensive ones, so a failing run spends most of its tokens after its outcome was already settled.
"Interpretable Early Termination of Web Navigation Agents via Closed Sequential Pattern Mining" by Sergio Talavera and Magdalini Eirinaki, submitted to arXiv on 3 November 2026 (arXiv 2611.04142, a workshop paper for AID-Wild at ACM CAIS 2026), proposes stopping such runs from their first few steps, with a reason a person can read. This guide explains the method, reimplements a small version on synthetic traces, and shows how to choose the stopping threshold. The figures attributed to the paper are the authors' own; the paper has not been independently reproduced.
The method in four steps
- Symbolize each step. The authors encode every step of a ReAct-style web agent trace along four dimensions: action type, selector strategy, observed outcome and a reasoning intent extracted from the agent's text by keyword matching (for example VERIFY, RETRY or STUCK). Their experiments use a medium abstraction level, producing symbols such as
CLICK_BID_SUCCESS__R_VERIFY. - Mine K-step prefixes. Each labelled training trace is cut to its first K symbols, and closed sequential patterns are mined from the prefixes with the BIDE+ algorithm at 5 percent minimum support. A pattern is closed if no longer pattern occurs in exactly the same set of traces, which removes redundant sub-patterns.
- Keep the failure-predictive ones. Each pattern is scored by its precision on the failure class, the share of training prefixes containing it that belong to failed runs, and patterns below 0.50 are dropped. On their data this left 32 patterns from 33, which the authors grouped by hand into four failure categories: recovery failures after unparseable actions, validation loops of repeated verifying clicks, navigation without progress, and loss of task state.
- Match live runs. At step K, the library's patterns are matched against the live prefix as ordered, not necessarily contiguous, subsequences. Matched precisions aggregate into a coverage score, and the run is terminated when coverage exceeds a tuned threshold. The decision comes with the matched patterns, their positions and their categories.
What the paper reports
The authors collected 1,544 MiniWoB++ traces from three open-weight models, Llama-3.2-3B, Qwen-2.5-7B and Mistral-7B-Instruct-v0.3, with a 30-step budget and on average 875.7 tokens per step. Against seven baselines, the pattern library achieved the best F1 at K=3 on their Exclude-errors configuration, 0.717, and matched at least one pattern in 88 percent of test-set failures at K=3. At their recommended operating point, K=5 and threshold 0.15, the policy terminated 50 test traces with 92.0 percent precision, killed 3.2 percent of runs that would have succeeded, and saved 26.3 percent of tokens overall.
They are also candid about the limits. Results vary widely by model: F1 at K=3 ranged from 0.526 for Llama to 0.913 for Qwen. Transfer to WebArena shopping traces was weak, with mean pattern coverage of 0.100, 0.056 and 0.021 across the three models. At longer prefixes a bidirectional LSTM beat pattern mining, 0.765 against 0.612 F1 at K=10. The interpretability claim is structural rather than tested with operators, and the figures come from a single data split.
A small reimplementation
The companion example and the interactive lab implement the same idea on invented traces of a help-desk browser agent at Belgavi's Book Store, which files returns on an admin site. Successful runs are short; failed runs fall into loop shapes like the paper's categories; and some successes start with a few re-checks or one parse failure before recovering, so the problem is not trivially separable.
It differs from the paper in three deliberate ways. Patterns are limited to length 1 to 3 and mined by enumeration, which is exact for small data, instead of BIDE+. The coverage score is defined explicitly, because the paper's main text does not give a formula:
matched = [e for e in lib if contains(prefix, e['steps']) is not None]
coverage = sum(e['precision'] for e in matched) / len(lib) # this reimplementation's choice
stop = coverage >= thresholdAnd token cost uses the replay model the paper motivates: step t costs t times a per-step amount, so the tokens a stop saves are the triangle of history the run no longer re-sends.
Choosing the threshold
With 60 training and 30 test traces and 900 tokens per step of history, the presets in the lab give these operating points:
| Preset | K | Threshold | Patterns | Runs stopped | Successes killed | Precision | Tokens saved |
|---|---|---|---|---|---|---|---|
| loose | 5 | 0.10 | 15 | 15 | 5 | 0.667 | 62.6% |
| recommended | 5 | 0.15 | 15 | 5 | 0 | 1.0 | 39.5% |
| strict | 5 | 0.30 | 15 | 1 | 0 | 1.0 | 9.7% |
| short prefix | 3 | 0.15 | 2 | 11 | 5 | 0.545 | 38.9% |
| long prefix | 8 | 0.15 | 50 | 5 | 0 | 1.0 | 33.0% |
The loose threshold saves the most tokens by killing five of eighteen successful runs, which no help desk would accept. The useful way to choose is the paper's: fix the share of successful runs you are willing to lose first, they used 5 percent, and then take the threshold that saves the most tokens within it. Here that is 0.15. A shorter prefix sees too little to separate a recovering success from a failing loop; a longer one is just as precise but saves less, because the stop comes later.
Two traps the lab makes visible
The threshold depends on the library. Raising the minimum failure precision from 0.5 to 0.8 sounds like it should make stopping more conservative. In this reimplementation it does the opposite: the library shrinks from 15 to 10 patterns, the coverage of each match rises because the denominator fell, and three successful runs are killed at the same threshold. Any change to mining parameters, symbol vocabulary or training data needs the threshold re-tuned on held-out data.
Libraries do not transfer between agents. The shifted-agent preset tests the same library on an agent that fails by searching and reading in circles, a shape absent from training. It stops nothing and catches none of the failures. That matches the paper's weak WebArena transfer, and it means a library is mined per agent and per task family, and re-mined when the agent's prompt or model changes.
Putting it into an agent loop
At step K, compute coverage once. If it passes the threshold, stop the run and hand the case to the normal fallback, for the help desk a person, with the matched patterns attached so they know what went wrong. Log every stop with the patterns and their positions; review a sample of stopped runs each week; and keep a shadow period where the policy only records what it would have stopped, so the success-kill rate is measured on live traffic before any run is actually cut.
The method is worth its complexity when runs are long, failures are common and similar, and someone will read the reasons. For short runs, a plain step or token budget is simpler and nearly as cheap.
Verification
The companion example has eight offline tests covering ordered subsequence matching, closure, every preset in the table, the shifted-agent result and a monotone threshold curve; the lab's JavaScript model is checked against the Python model on all seven presets. The traces are invented and small, so the numbers demonstrate the mechanism, not the paper's results.
Interactive experiment
Early stopping from failure patterns: threshold, precision and tokens saved. Synthetic browser-local fixtures, adjustable inputs, decision traces and JSON export.