# Benchmark

> Run Visto AI on AACR-Bench, a public set of expert-reviewed pull requests, and read its findings and score against a plain one-prompt control.

Web page: https://visto-ai.com/docs/benchmark/

[AACR-Bench](https://github.com/alibaba/aacr-bench) is a public set of reviewed pull requests. Its version 2 (`dataset/v2/positive_samples.json`, licensed Apache-2.0) holds 151 merged pull requests of public repositories, with 944 review comments checked by experts. Visto AI ships commands that turn it into replay cases, review them, and judge the findings against the experts' comments, beside a plain one-prompt control on the same model.

The data set is not part of this repository: download it yourself and keep it outside the project folder. The commands read it as untrusted data, never run it, and put nothing made from it in the repository.

## Results

Measured on 142 of the 151 pull requests (GitHub could no longer compare the commits of the other 9), with their 880 reference comments. Reviewer and control: `openai/gpt-5.6-luna` through OpenRouter, effort medium, high for large or primary-branch pull requests. Judge: `anthropic/claude-sonnet-5.5`, a different model family.

| Run | Recall | Precision | F1 | Findings |
|---|---|---|---|---|
| Visto AI, current contract with file focus | 0.130 | 0.446 | 0.201 | 249 |
| Visto AI, current contract without file focus, rounds A / B | 0.141 / 0.139 | 0.422 / 0.426 | 0.211 / 0.209 | 275 / 263 |
| Plain control, rounds A / B | 0.151 / 0.152 | 0.453 / 0.436 | 0.227 / 0.226 | 274 / 264 |

- A full run of the reviewer on the 142 cases costs about 2.30 USD in model calls, with a median of 33 to 40 seconds per case. The control costs about 0.65 USD.
- File focus means a test, documentation, generated, vendored or lock file is still read and scored but takes no finding. It trades about 20 findings a run, nearly all of them not matching an expert comment, for no measurable change in F1.
- Between identical runs, recall moves by under 0.01 and precision by about 0.04.
- The plain control finds a little more. It computes no score, places no finding on a line, and cannot gate or approve.
- The blocker and major findings, the ones a merge waits on, cover an expert comment 0.435 and 0.456 of the time in rounds A and B of the contract without file focus.

The score, from the backtest on the same pull requests in the first full run (2026-11-24). Every pull request here has an expert comment, so "approved" means approved despite a known problem:

| Threshold | Commented blocks left below it, A / B | Pull requests approved (of 142), A / B | Changed lines a person reads, A / B |
|---|---|---|---|
| 20 | 0% / 0% | 0 / 0 | 97% / 98% |
| 40 | 8% / 8% | 1 / 3 | 70% / 69% |
| 70 (the default) | 44% / 41% | 35 / 30 | 58% / 59% |
| 90 | 90% / 94% | 120 / 123 | 42% / 26% |

The full write-ups, with the code, data, models and costs each came from, are in `docs/benchmarks/`:

- [2026-11-24-aacr-bench-v2.md](https://raw.githubusercontent.com/visto-ai/visto-ai/0faf484aa43f4fcdc1f30c1d5c056ea26c1c0d32/docs/benchmarks/2026-11-24-aacr-bench-v2.md): the first full run, findings and score.
- [2026-11-25-aacr-bench-v2-experiments.md](https://raw.githubusercontent.com/visto-ai/visto-ai/0faf484aa43f4fcdc1f30c1d5c056ea26c1c0d32/docs/benchmarks/2026-11-25-aacr-bench-v2-experiments.md): placement by quote, and two experiments.
- [2026-11-26-the-finding-contract.md](https://raw.githubusercontent.com/visto-ai/visto-ai/0faf484aa43f4fcdc1f30c1d5c056ea26c1c0d32/docs/benchmarks/2026-11-26-the-finding-contract.md): the finding contract and file focus in use today.

## Run it

| Command | Reads GitHub | Model calls | Takes `--max-cost` |
|---|---|---|---|
| `eval:import-aacr` | Yes, needs `GITHUB_TOKEN` | None | No |
| `eval:replay` | Yes, needs `GITHUB_TOKEN` | Paid | Yes, 10 by default |
| `eval:judge` | No | Paid | Yes, 5 by default |
| `eval:backtest` | Yes, needs `GITHUB_TOKEN` | Paid | Yes, 10 by default |

All files must be outside the project folder.

```bash
export GITHUB_TOKEN=...        # a read-only token
export OPENROUTER_API_KEY=...  # or the variable your configuration names

# 1. Turn the raw file into a case file and a history file
npm run eval:import-aacr -- --input ../aacr/positive_samples.json --cases-out ../aacr/cases.jsonl --history-out ../aacr/history.jsonl

# 2. Replay the reviewer, then the control, on the same cases
npm run eval:replay -- --cases ../aacr/cases.jsonl --out ../runs/reviewer --label reviewer --config config.local.yml --max-cases 10 --max-cost 3
npm run eval:replay -- --cases ../aacr/cases.jsonl --out ../runs/plain --label plain --config config.local.yml --max-cases 10 --max-cost 3 --plain

# 3. Judge each run against the reference comments, each one on the cases both runs answered
npm run eval:judge -- --cases ../aacr/cases.jsonl --run ../runs/reviewer --with ../runs/plain --config judge.local.yml --max-cost 3
npm run eval:judge -- --cases ../aacr/cases.jsonl --run ../runs/plain --with ../runs/reviewer --config judge.local.yml --max-cost 3

# 4. Replay the score on the history file
npm run eval:backtest -- --history ../aacr/history.jsonl --out ../runs/score --label score --config config.local.yml --max-cases 10 --max-cost 3
```

`judge.local.yml` is an ordinary configuration file whose `model` block names the judge's model. Use a model of another family than the reviewer's, so that the model does not rate its own kind.

As with the replay, when the provider reports no cost and the configuration has no `prices`, `--max-cost` stops nothing.

## The import

`eval:import-aacr` orders the pull requests by a hash of their address and head, so that `--max-cases 10` takes a spread of repositories whatever the order of the file. It reads each pull request's title and description from GitHub, so that the review sees what the app would see, and takes the merge base from a comparison, as `eval:import-history` does.

It prints how many records it read and wrote, and how many it skipped, by code:

| Code | What was skipped |
|---|---|
| `bad_record` | A malformed record, or one with no usable comment. |
| `bad_comment` | A malformed comment; the rest of its record is kept. |
| `duplicate` | A pull request already read from the file. |
| `pr_unreadable` | A pull request GitHub could not return. |
| `head_unreadable` | A pull request whose commits GitHub could not compare. |
| `too_many_files` | A pull request whose comparison holds too many files to read. |

## The control

`eval:replay --plain` asks the same model, with the same configuration, one question for each case: the title, the description and every changed file's patch except a secret file's, with a short plain prompt, answered with a list of findings. It builds no context, packs no batches, places no finding and computes no score. A case whose request would not fit in `limits.inputTokensPerCall` fails with `too_large`.

The control shows what the engine adds to the model alone.

## The judge

`eval:judge` writes `judge.jsonl`, `judge-summary.json` and `judge-summary.md` into the run folder, and changes none of the run's own files. It needs no GitHub token.

For each finding, one model call is shown the finding and the reference comments of the same file, and names every reference that raises the same concern about the same code. A finding in a file with no reference comment is unmatched, with no call. The judge reads everything a person would read in the review: findings placed on a line, findings that could not be placed, and findings beyond the diff.

| Metric | Meaning |
|---|---|
| **Recall** | The share of reference comments that some finding covers. One finding may cover several references. |
| **Precision** | The share of findings that cover a reference comment, counted by a maximum one-to-one matching between findings and references within a case. |
| **F1** | The harmonic mean of the two, from the raw counts. It is 0 when either is 0 or when only one is undefined, and undefined (printed as an em dash) only when both are. |

AACR-Bench's own count depends on the order of the findings, and the two runs order them differently, so it is not used here.

- A failed replay case is left out of all three numbers, and counted.
- A finding whose judge call failed twice counts as unmatched, and is counted.
- With `--with`, both runs are restricted to the cases that are ok in both, so the reviewer and the control are rated on the same cases. Without it, a case one run failed counts for the other.
- A judge stopped by `--max-cost` rates only the first cases of the case file, in the file's order, and prints how many it did not judge.

The judge's reasons are kept in `judge.jsonl`. Read a sample of them by hand before trusting a number.

## The score on the benchmark

The backtest on the history file reports Safety, Benefit and Focus as described in [Backtest](https://visto-ai.com/docs/backtest/), with these differences:

- Read only the loose Safety. The history file has no later commits, so strict Safety means nothing here. Do not use `--memory` with it.
- Every pull request in the data has at least one expert comment, so Benefit is the share of pull requests the score would have approved with nothing shown to a person despite a known problem. Here, lower is better.
- Safety counts expert comments of every weight, nits included, so it understates how well the score keeps defects in view.

## Reading the numbers

- **It cannot show false alarms.** Every pull request in version 2 has a problem, so the benchmark cannot show whether the score approves what is safe.
- **Precision is a lower bound.** A real problem the experts did not annotate counts against the finding that raised it.
- **The data is public.** The pull requests are public and merged, and the models may have seen them in training.
- **The judge is a model.** It rates one model's judgement of "the same concern", not a person's; reading a sample of its reasons is how you check it.
- **It is not your codebase.** Nothing here is a number for your repositories. To measure on your own pull requests, use the [replay](https://visto-ai.com/docs/replay/) and the [backtest](https://visto-ai.com/docs/backtest/).
