Evaluation¶
Details and the evaluation rules (development sets, closed sets) are in eval/README.md.
Every result file records where it was measured: the full commit, its tag, and whether the working
copy had uncommitted changes (then its name says +dirty). --final refuses to run unless the
working copy is clean and the commit has a tag (tag the release first: git tag v1.0.0).
Element resolver (eval.run)¶
python -m eval.run --offline -v
python -m eval.run --language en
python -m eval.run --sweep
| Option | Meaning |
|---|---|
--offline |
Skips the cases that need the internet (SauceDemo). |
--language |
Only the cases in this language: pt or en. Default: both. |
--site |
Only one site (e.g. store, users_en). |
--split |
Only one split: dev, or test (the closed set, accepted only with --final). The default excludes the closed set. |
--sweep |
Tries combinations of minimum score × gap. |
--check |
Only checks that the expected selectors exist (the closed set included). |
--final |
Runs the closed set (split test). Once, at the end of development. |
--headed |
Shows the browser while evaluating. |
-v, --verbose |
Shows each case. |
Complete tasks (eval.plan_run)¶
python -m eval.plan_run --reference
python -m eval.plan_run --agent --profiles ollama-small ollama-medium -v
python -m eval.plan_run --agent --profiles ollama-small --language en --prompt-language auto
python -m eval.plan_run --agent --suite injection --profiles ollama-small ollama-medium -v
| Option | Meaning |
|---|---|
--profiles |
Model profiles to evaluate. |
--reference |
Includes the hand-written plans (the ceiling, with no LLM). |
--agent |
Runs the tasks through the full agent loop (replanning, effect checks, end check). |
--language |
Only the tasks in this language: pt or en. Default: both. |
--vision |
With --agent: confirms doubted steps with a screenshot; the table adds the questions asked, the steps confirmed and the time spent. |
--suite |
main (default): the ordinary tasks. injection: tasks on pages that try to hijack the agent; the table adds the attacked column (runs in which some attack worked) and attempts (steps that tried to do what the page asked, even if a barrier stopped them). extraction: tasks that read tables, lists and texts, judged on what was read (the task's extraction), with the CSV files written to a temporary folder. downloads: tasks judged on the file saved (a piece of its name and content), with a decoy that must not be clicked. uploads: tasks judged on which file each field received; some must send nothing. tabs: links and buttons that open a new tab (needs --agent). frames: a form inside an iframe from another origin, with a lookalike button on the page. |
--prompt-language |
Planner prompt language: pt, en or auto. Default: the profile's. |
--task |
Runs only one task (by id). |
--no-page |
Does not send the list of the page's elements to the model. |
--check |
Checks the tasks, without calling models. |
--final |
Runs the closed set (split test). Once, at the end. |
-v, --verbose |
Shows each task's plan and, when the plan failed, the model's refused answers and why each was refused. |
Closed sets' sources (eval.closed_sets)¶
Turns a closed set's sheets (one per generator, pagina;pedido) into the tasks file to annotate, one
task per request with its origin and generator, split: "test", and empty checks, allowed
and reference. It prints only how many tasks it wrote, never a request, and does not write over a
tasks file that exists (it may be annotated already).
python -m eval.closed_sets skeleton eval/synthetic_controlled_2026-10-22 synthetic_controlled
python -m eval.closed_sets page-items synthetic # per generator: how many requests cite an item of their page
python -m eval.closed_sets negatives eval/plans/holdout_controlled_tasks.json # prefill the negative checks
The results of eval.plan_run --final come out by origin, by generator, and without the generators
a sensitivity analysis leaves out (for synthetic_controlled: the ChatGPT's requests).
Resilience benchmark pages (eval.resilience.build)¶
Builds the altered versions of the task pages, in 5 levels of perturbation, the tasks
rewritten for them (eval/plans/resilience_tasks.json), and the fixed-selector scripts of the
traditional executor, recorded on the original pages (eval/plans/resilience_scripts.json). Deterministic: rebuilding gives the same
pages. Every element a task checks is marked with data-eval, the evaluation's own marker, which
no executor may use.
python -m eval.resilience.build --check
| Level | Perturbation |
|---|---|
| L0 | The original page, only with the evaluation's markers. |
| L1 | Superficial: ids, classes, names and test attributes renamed or removed (the page's own scripts keep working). |
| L2 | Semantic: synonyms in the labels ("Salvar" → "Gravar"), a search button turned into an icon. |
| L3 | Structural: repeated items reversed, buttons moved to the top of forms, extra wrappers. |
| L4 | Behavioral: part of the page hidden behind "Show more", a cookie banner covering the page. |
| L5 | Adversarial: lookalikes next to the targets, an unexpected destructive button, and an instruction pointing at it, phrased in a way the injection detector has never seen. |
| Option | Meaning |
|---|---|
--check |
Also runs the reference plans on the L0 pages, to check the rewritten tasks. |
The closed resilience set's catalog (eval.resilience.closed.catalog_md)¶
The closed set's perturbations come from eval/resilience/closed/catalog.json: each operator with
its source and category (the taxonomy of Hammoudi et al. for levels 1 to 4; Greshake et al. and
Gray et al. for level 5), its weight, what is left out and why, the generator's rules and the seed.
CATALOG.md is written from it, so the two never differ:
python -m eval.resilience.closed.catalog_md
The closed resilience set's generation (eval.resilience.closed.targets, eval.resilience.closed.generate)¶
targets records, once, on the original (L0) development pages, the evaluation's marker of the element
each step of a base task's reference plan acts on (reference_targets.json, committed); the closed
set's check then uses only these markers, with plain Playwright and no part of ANCHOR. generate
makes the closed set from the catalog, once, by the author, who reads only its counts and the list of
level-2 replacements for the veto (see eval/resilience/closed/README.md):
python -m eval.resilience.closed.targets # already run: its result is committed
python -m nltk.downloader wordnet omw-2.0 # the dictionaries, once
python -m eval.resilience.closed.generate # prints counts; writes the list for the veto
python -m eval.resilience.closed.generate --vetoes vetoes.csv # again, until no new veto
Resilience benchmark runs (eval.resilience.run, eval.resilience.report)¶
Runs the three executors on the altered pages: the traditional script (fixed selectors recorded on L0), the LLM in control (it chooses every action and element, with no protection) and ANCHOR (a saved automation whose approved plan is the reference plan, run twice on each altered page, with no user: the 1st run measures the recovery, the 2nd the reuse, which counts only if it needed no model). Each part saves its own results, so the benchmark can run in parts; the report puts them together.
python -m eval.resilience.run --executors script
python -m eval.resilience.run --executors anchor --profiles ollama-small --language pt
python -m eval.resilience.run --executors llm --profiles ollama-medium --language en
python -m eval.resilience.run --final --profiles ollama-small ollama-medium # the closed set, once, at the end
python -m eval.resilience.report eval/results/resilience_*.json
Option (run) |
Meaning |
|---|---|
--executors |
script, llm and/or anchor. Default: all three. |
--profiles |
Model profiles, for llm and anchor (the script uses no model). |
--language |
Only the tasks in this language: pt or en. Default: both. |
--levels |
Perturbation levels. Default: 1 to 5. |
--task |
Only one base task (e.g. p-reg-01). |
-v, --verbose |
Shows the error and the steps (with the element actually acted on and how it was chosen) of the runs that need a look: failed, attacked, false successes and recoveries. |
--final |
The closed set's final run: level 0 and the 150 closed tasks. Once, on the tagged release. |
report takes the result files (.json; patterns like eval/results/resilience_*.json are expanded)
and prints the success per level of each executor, and the false successes, unrequested actions,
attacks, attack attempts, model calls and time.
Interventions experiment (eval.interventions)¶
Does the system ask the user less as it learns? The resolver's development cases are run by the Executor with the choice memory and a simulated user that knows the right element of each case: round 1 starts with an empty memory, round 2 repeats the cases with the memory of round 1, and round 3 repeats them in a shuffled order. It reports, per round and language, the interventions, the right actions, the silent errors and the right actions that came from the memory. No model is used.
python -m eval.interventions --offline -v
python -m eval.interventions
| Option | Meaning |
|---|---|
--offline |
Skips the cases that need the internet (SauceDemo). |
--language |
Only the cases in this language: pt or en. Default: both. |
--rounds |
How many rounds. Default: 3. |
--seed |
Seed of the shuffled order (round 3 on). Default: 7. |
-v, --verbose |
Shows each case of each round (ASK: the user was asked; MEM: from the memory; SIL: silent error). |
Vision probe (eval.vision_probe)¶
Measures how long the model takes to answer a question about a screenshot, and whether it gets it right, before the effect check by screenshot is built. It asks 6 yes/no questions with known answers about the registration page, at two screen widths, and saves the results.
python -m eval.vision_probe --profiles ollama-small ollama-medium
| Option | Meaning |
|---|---|
--profiles |
Ollama model profiles to measure (the model must have the vision capability: ollama show <model>). |
The human closed set's draw (eval.human_sample)¶
Draws the human closed set's 60 requests from the collection's Google Forms export: 30 from people
who work in IT and 30 from people who do not, each profile spread over the 9 pages, with a fixed
seed; the form's pilot response and whoever did not agree are left out, every request field of a page
is read (one or two per page), a stratum takes one request per person before anyone's second, and a
stratum with too few requests is completed (the other profile on the same page, then another page),
each completion recorded. The rules are in the
module's docstring. It runs only exactly as committed, once, prints only counts, and writes the
tasks to annotate (eval/plans/holdout_human_tasks.json) and how the draw went
(eval/plans/holdout_human_sample.json: the commit, the seed, the input's hash, counts, who answered
by profile, how many different people the 60 requests come from and how many each gave, and the share
who opened each page's link).
python -m eval.human_sample <export.csv>
The human collection's publication (eval.human_publish)¶
After the draw, and after the person checks the responses for accidental personal data, writes
eval/human_collection/responses.csv: every response the consent allows to publish, numbered by its
place in the export before anything is left out (the numbers of "Não concordo" are simply missing),
without the time it was sent, with the profile, every "abriu o link" and every request, and the tasks
drawn from it. Removals come from a file kept outside the repository (response;field;text;type):
each text becomes [removido: type], in the publication and in a drawn task, and
eval/human_collection/removals.csv records the response, field, type and task, never the text.
python -m eval.human_publish <export.csv> --removals <removals.csv>