Repository navigation
Conversation
The loop, its policies (state, fixed, judge), report, fix orchestration and run metadata move under eval_agent/loop/; the run directory, logger, log entries/files/tracing, schema, narration and model instrumentation under eval_agent/runlog/. Pure moves plus import updates; policy.py is split into state.py (Policy, RunState) and fixed.py (FixedOrderPolicy).
Stages (loop/stages.py) runs and records M1 probe, explore, M2, M3, M4 and the held-out M4 pass, holding the stage dependencies and never the loop; VLDiagnoseLoop.stages() builds one per run and policies reach it through RunState.stages. What outlives a run (explorer notes, default M3 agent, token count) is one StageMemory. The case partition becomes the pure function loop/partition.split_cases. Stage bodies are unchanged apart from the renamed members.
The judge stages were most of a run's wall time: replaying recorded prompts, a 28k-char M3 review took 71-124 s on claude-fable-5 and 5 s on sonnet. ClaudeModel.DEFAULT_MODEL is the single default; the benchmark CLI and the judge auto-detection read it, and the benchmark's default effort is medium.
Every analyzer asked the model one prompt at a time, and no backend batched: vllm_offline sent the engine one prompt per call. A 16-case agentic benchmark run spent 10,081 s in one M1, on serial generations (421 counted when it was two hours in). Model.generate_batch answers a list of inputs in order. hf_local pads a text-only spec's prompts into batches, vllm_offline passes the list through, api keeps several requests in flight. Analyzers write per-case probes that yield an Ask where they need answers; run_probes batches each round across the cases. Fifteen analyzers, Stage 0 and ProbeGenerator use it. Decoding settings move to RuntimeConfig.sampling, applied to every call that passes none: Stage 0 labelled under sampling while analyzers ran greedy. pope and chair read the labelled answer instead of asking again. Measured on Qwen3.5-2B: greedy 217 s -> 19.8 s for 24 prompts; float32 answers identical to single calls on 16/16.
ProbeAgent defaults to at most 6 analyzers and 30 minutes per probe round; an analyzer not started in time is skipped and named in the rationale. M1 prints its plan and one line per finished analyzer. Analyzers that read only the first case declare single_case and are not offered on a multi-case batch. A selection is no longer padded up to the cap.
A batch runs until its longest answer ends, so throughput grows almost linearly with the batch size: Qwen3.5-2B at a 2048-token cap took 4.3 s per prompt at 16, 2.8 s at 32 and 1.6 s at 64.
M4 reports a hypothesis as unmet when its test names only identifiers with no M2 result. Three of six hypotheses in one run ended that way, on made-up signal names and case ids. The proposal call now checks each test the way M4 routes it and feeds the unmet ones back with the signals that have a result.
Stage 0 and every analyzer now hand the model a batch, so the analyzer thread pool multiplied the requests an endpoint received: up to 8 analyzers times RuntimeConfig.concurrency. In-process analyzers run one at a time; max_workers bounds Docker-mode analyzers only. CaseDiscoveryAgent drops its own pool and its concurrency argument. The benchmark's --concurrency sets RuntimeConfig.concurrency for endpoint and gemini, default 8. The analyzer cap does not shorten a list the caller named.
Measured on Qwen3.5-2B / BBH causal judgement at T=0.6: an unchanged prompt asked again gave the labelled answer 68 times in 128.
FixAgent, CandidateValidator, PipelineCoder and run_coded_pipeline no longer take concurrency. The fresh baseline samples and a template candidate are one try_generate_batch each; run_pipelines runs every case and sample of a spec as probes, one round per strategy step; the coded-pipeline bridge answers the calls that arrive together as one batch from one host thread. Candidates that call a hooking method on the model run one case at a time. Model.concurrency is how many generate calls the default generate_batch runs at once; the api backend sets it from RuntimeConfig.concurrency. With --concurrency defaulting to 8 the benchmark had been passing 8 to FixAgent on hf_local as well, so eight threads generated on one in-process model.
The coding agent writes a probe in the sandbox directory that already holds the cases file. In 3 of 19 sessions it overwrote that file with invented cases to try its script and deleted it afterwards, so the real run found nothing to read and M1 logged 'sandbox produced no parseable result'. ExperimentSandbox.put() places an input and keeps its content; run() restores it when it was changed or removed. The M1 probe generators, the M2 statistics tool generator, the explore agent and the M5 experiment writer use it, the probe prompts say to leave the file alone, and a failed probe run is logged with its own error.
run.py built FixAgent with cli_config=coder_cfg about fifteen lines before coder_cfg was assigned, so every run without --paper-method-only stopped with UnboundLocalError.
Example configs, argparse defaults and compose commands named claude-opus-4-8, claude-opus-5 or claude-fable-5. They now use ClaudeModel.DEFAULT_MODEL unless a config or flag names a model, and where the coder took an empty model name (the CLI's session default) it now gets the judge's.
…case loops hf_local encodes every input as a single call does and stacks the encodings, so text and multimodal specs share one batching path. A multimodal family batches only once it is listed in BATCHED_MULTIMODAL_FAMILIES, after its batched answers matched one-at-a-time answers on a real checkpoint in float32 (Qwen2-VL, Qwen2.5-VL, Qwen3-VL, Qwen3.5 and Qwen2-Audio so far). Model.logprobs_batch is new: padded batches on hf_local, one engine call on vllm_offline, concurrent calls elsewhere. context_shap, vl_shap, mm_shap, calibration, arith_audit and answer_extraction_audit ask in batches; _shapley.coalitions() lists what an estimate will evaluate so it can be asked up front.
A search climbs one tier at a time over the same cases and its candidates are one e-BH family, but each tier drew its own fresh baseline samples: 64 generations per tier and a different baseline for each. CandidateValidator now keeps the baseline it measured for a model and a set of cases.
…was asked hf_local encoded every input of a generate_batch onto the device before the first batch ran. One vl_shap case asks for hundreds of masked images, so the encodings are now made four batches at a time. Inputs that carry different tensors (with an image, without one) batch separately in place of dropping the whole call to one input at a time. The fix baseline kept per model and case ids would have been reused for a deployed template, which rewrites the prompts under the same ids; the key now includes each case's prompt and recorded answer.
llm_benchmark's preflight read judge_model from config.yaml, which no longer sets it, and so probed the CLI's own default model. It now falls back to the package default like the run does. vl_shap built every masked copy of the image before its one logprobs_batch call, several hundred at the defaults; it now asks 64 at a time.
run_fix searches the explore partition with record=False and confirms one candidate. record=False muted the whole recorder, so the run log held only the confirm phase and none of the searched candidates' model calls. It now leaves out the fix outcome event alone.
The analyzer built its prompt as str(case.inputs) + elicit, a bare string, so a vision model answered without the picture. It keeps the inputs and replaces the prompt, as calibration does.
One answer labelled a case by chance under sampling: two Stage 0 passes agreed on 17 of 32 cases (Qwen3.5-2B, BBH causal judgement, T=0.6). CaseDiscoveryAgent(n_samples=k) draws k answers per case in one batch and labels by majority (25 of 32 with five). The benchmark runner uses five when the task samples, one when greedy (--label-samples). The fix stage's repeated baseline draws k fresh samples and no longer counts case.observed, which the label chose.
jiaq-liu
approved these changes
Nov 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
A run spent most of its time asking the target model one prompt at a time. This PR makes batching part of the
Modelinterface and moves every stage onto it.Model.generate_batch/try_generate_batch/logprobs_batch.hf_localruns padded batches (text and the checked multimodal families),vllm_offlinehands the engine the whole list, and API backends keepRuntimeConfig.concurrencyrequests in flight.Ask,run_probes); rounds are batched across cases.FixAgent,CandidateValidator,PipelineCoderandrun_coded_pipelinelost theirconcurrencyargument.CaseDiscoveryAgent(n_samples=k), benchmark--label-samples).sonnet; the examples follow that default; benchmark--judge-effortdefaults tomedium.mmau_qwen2_audio/run.pyno longer readscoder_cfgbefore it is defined;verbalized_confidenceasks with the case's image.CHANGELOG.mdhas one entry per change.Measured
Agentic benchmark in Docker: Qwen3.5-2B,
bbh_causal_judgement, 32 cases,hf_local, sonnet judge at medium effort,--max-actions 8, on a shared GPU.78a68403)The judge proposes the fix candidates, so the fix stage does different work in each run. On the same fixed candidates, seconds per model call went from 8-25 to 1.2-2.9.
Majority labels: two independent Stage 0 passes gave a case the same label on 17 of 32 cases with one answer and on 25 of 32 with five. Stage 0 generates five times as much (about 110 s to 520 s on these cases).
Not verified
BATCHED_MULTIMODAL_FAMILIES(LLaVA, InstructBLIP, Gemma 4, GLM-4V, Kimi-VL, Llama 4, Qwen omni, Nemotron omni) still run one input at a time.mmau_qwen2_audioand the judge-model defaults were linted and unit-tested, not run in Docker.