Stanford shows AI agents can study a codebase before the task

In short

15x smaller test budget needed on SWE-QA-Pro after a 128k study; 46.9 to 4.5 tool calls per task, uncapped solver, 16k study; 24 vs 49 min time for half of runs to beat the median human; $4.23 to $1.66 cost of 120 legal tasks with a 32k study

What is proactive compute?

Today's AI agents are mostly reactive. An agent placed in a code repository does nothing until someone asks a question, and while a command runs it sits idle. The paper, "Scaling Proactive Compute: When Agents Anticipate the Task", by Shayan Talaei, Gino Chiaranaipanich, Amirreza Zeinali, Amir Youssefi, Azalia Mirhoseini and Amin Saberi, calls the work an agent does in those gaps proactive compute. Five authors list Stanford University; Amir Youssefi lists Meta.

The authors measured how much of its time an agent actually spends generating text. On MLE-Bench, a set of machine-learning engineering tasks, a DeepSeek-V4-Flash agent generated tokens for only 7% of a two-hour session and spent the rest waiting for training runs and commands to finish.

They separate two cases:

The idea is not new. Earlier work such as Sleep-time Compute and IdleSpec showed that preparing ahead helps, at a few coarse levels of effort. What this paper adds is control at the level of single tokens, scaled up to 128,000-token studies and a 112-million-token file system, to see how the benefit grows. Both budgets are fixed with budget forcing: if the model stops early it is told to keep reasoning, and if it overruns, its output is cut. That lets them vary the study budget (P) and the test-time budget (T) independently. The work needs no training; it only changes how the model is prompted at inference time.

What did studying ahead save?

The main model is DeepSeek-V4-Flash. The authors also ran Qwen3.8-27B and Muse Spark Open on every benchmark and gpt-5.6-luna on a subset, and say the findings hold; we did not read those tables. The nine benchmarks cover maths (AIME, HMMT), pattern puzzles (ARC-AGI-1, MIR-Bench), code questions (StudyBench, SWE-QA-Pro) and legal work (Harvey LAB).

The maths result has a plain reason. On AIME, 84% of the 128k-token studies already contained the right answer, because the context holds most of each problem and the agent works it out before the final question. On code repositories the task is harder to predict, so the study mostly records where things are and what it found, and the solver reuses that instead of searching again.

Studying has diminishing returns. The authors found new material arrives 5 to 12 times more slowly late in a study than in its first 1,000 tokens on maths and code, and at the longest budgets agents sometimes drifted into talking about the continuation prompt. Test-time efficiency stopped improving on StudyBench and SWE-QA-Pro.

Does the study pay for itself?

A study is written once and can serve many questions about the same context. Counting only generated tokens, the paper finds it breaks even after 9 to 11 tasks for a 16k study and 13 to 37 tasks for a 64k one. In dollars, on 120 Harvey LAB legal tasks priced at list rates for DeepSeek-V4-Flash, a 32,000-token wiki-style study cut the total from $4.23 to $1.66, breaking even after 2.4 tasks. Across the studies in the paper's cost table, break-even came after 1.8 to 10.3 tasks and the total cost of 120 tasks fell by 42% to 61%. The saving relies on the study being cached as a shared prompt prefix, with 79% to 95% of the solver's input tokens served from cache. It is a saving when many tasks share one context, not for a one-off question.

How do you study 112 million tokens?

Harvey LAB is a fictitious law firm's file system of 112 million tokens, far more than any model's context window. A single study also stalls: beyond 128k tokens, five of six single studies stopped early or filled their budget with repeated text. The authors tried three ideas:

Online: what if the agent keeps thinking while commands run?

On eight MLE-Bench tasks, a DeepSeek-V4-Flash agent worked for two hours in a shell with one NVIDIA B200 GPU, 32 runs per task. A command running longer than 30 seconds moved to the background, and the proactive agent kept generating, up to 1k, 4k or 16k tokens per wait. Half of the 16k agent's runs beat the median human Kaggle entrant within 24 minutes, against 49 minutes for the reactive agent; across three models the gain was 1.6 to 2.0 times sooner. The first valid submission came at a median of 11 minutes against 25. The agent generated text for 26% of the session against 7%.

This is not a free saving. To reach the same point, the 16k agent generated about 1.7 times as many tokens as the reactive one. The authors expect the online case to buy time at the expense of tokens, while the offline case can save both.

What is not shown

Is the code available?

The project page, dated 3 December 2026, links the paper and a GitHub repository, ScalingIntelligence/proactive-compute, which shows an MIT licence and a separate data-licences file we did not open. The authors thank Meta for some of the GPU compute and list Stanford HAI, Google, Google DeepMind, IBM and US government research agencies among their funders.

Terms in plain English

Official channels of Stanford AI Lab: Website · X

Sources

Sources

Related stories

More from AI Research Labs

All stories from AI Research Labs