Stanford shows AI agents can study a codebase before the task
In short
- Researchers at Stanford University, with one author at Meta, report that an AI agent can use its idle time to read a codebase or file system before it is given a task. With a 128,000-token "study", the agent at a 64-token answer budget matches the accuracy that otherwise needs a 15 times larger budget on the SWE-QA-Pro code-question benchmark, and 7 times on StudyBench.
- The same team says an agent that keeps thinking while its commands run reaches the median human score on eight machine-learning tasks 1.6 to 2.0 times sooner. All numbers are the authors' own, from a preprint (a paper not yet peer reviewed) posted to arXiv on 30 November 2026.
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:
- Offline: before the task arrives, the agent explores the environment and writes down a trace, the "study". When the question comes, the same model, now called the solver, answers with the study in front of it.
- Online: after the task arrives, the agent uses the wait for each tool result to plan its next steps.
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:
- A wiki-style study that follows the folder layout (one folder per client matter): 11.5 tool calls per task against 17.8 for a plain study.
- Eight parallel agents, each studying its own share and writing a note: test-time efficiency of 0.585, against 0.547 for serial agents, 0.515 for the RLM baseline and 0.458 for retrieval-augmented generation (RAG) limited to 16k tokens.
- A hierarchical summary, where the model reads the opening words of each matter's documents and writes a one-line and a page-long description of each: 0.589, matching the eight agents at $0.96 against $4.07.
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
- It is a preprint. The authors report 95% confidence intervals and 3 seeds per offline task, but nothing here has been peer reviewed or reproduced by others.
- Studies were run on contexts that did not change. The authors list keeping a study up to date as an open problem, since real codebases change quickly, along with letting an agent decide how long to study.
- Compression helps unevenly. A 256-token summary of the study kept 0.97 of its gain on AIME 2025, but on repositories at most 0.95 on SWE-QA-Pro and 0.75 on StudyBench, because the value is spread over many file-level details.
- Grading of StudyBench, SWE-QA-Pro and Harvey LAB used another model, GLM-5.3-Flash, against a rubric or reference answer.
- "Tokens" count only what the model generates, not the input it reads; the paper argues this tracks speed, and prices every token in its dollar table.
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
- Scaling Proactive Compute: When Agents Anticipate the Task, arXiv, 30 Nov 2026
- Scaling Proactive Compute project page, 3 Dec 2026
- proactive-compute on GitHub, code
Sources
- Scaling Proactive Compute: When Agents Anticipate the Task
- Scaling Proactive Compute
- proactive-compute
Related stories
- Berkeley AI Research releases FantasticML, a 48-task agent test
- IETF starts four working groups, two for AI-agent protocols
- AWS says attacks on exposed AI software rose about 800% in 2026
- Gemini API lets agents change rules mid-chat and keep cache
- Decoy strings that halt an AI agent when read, Anthropic says
- SpaceXSI's Grok Bot connects to 12 small-business apps