Loading...

How Dream-RSI lets an AI agent improve how it searches

AI systems like AlphaEvolve find better code by trial and error. A language model writes a candidate, a program scores it, and the loop repeats thousands of times. Deciding which attempt to build on next is usually a hand-written rule that never learns. Dream-RSI, a new paper from researchers at the University of Maryland, Google DeepMind and the University of Virginia, trains that rule by replaying old searches instead of paying for new ones. On GPU kernels it reached the same speed with up to 2.4 times fewer calls. We'll place it in the bigger picture first, walk through how it works, then look at what the results really show and what you can reuse in your own agent systems.

Dream-RSI improves the search strategy around a fixed coding agent, not the model. It tests new strategies on recorded search history, the same idea behind experience replay in reinforcement learning and backtesting in finance. This post explains the method, checks what the results really show, and picks out the parts you can use in your own agent loops.

Where Dream-RSI fits in the bigger picture

The full build is on GitHub, Dream-RSI Explorer. It runs the three-stage loop on the live Gemini API, using one of the paper's own benchmarks, packing 26 circles in a square.

You can improve an AI system that solves hard problems in three places.

The middle layer already has faster algorithms and new math results. The weak spot is how the search is guided. That is usually a hand-written rule that does not learn from past searches.

Dream-RSI makes that rule learn. The phrase recursive self-improvement often suggests a model rewriting its own weights. Here it means something narrower and more practical. The system rewrites the code that steers its own search, using its own search history.

With the same LLM, two search strategies can reach very different results at very different costs. Dream-RSI treats the search strategy as something worth training, just like the model.

Why the search strategy is hard to improve

A discovery agent is an LLM coding agent that writes a candidate, runs it, and gets a score. Then it tries again, building on earlier attempts.

The exploration policy decides which earlier attempt to build on, how many to try in parallel, and when to stop. Testing a new policy normally means running a full search with it. A bad policy wastes the whole budget, and there are many policies worth trying.

The three-stage loop

The discovery agent, the evaluator and the tools stay fixed the whole time. Only the exploration policy changes. Each round runs three stages.

How dreaming works

Every attempt in a discovery tree keeps its code, diagnostics and score, linked to the attempt it grew from.

To test a new policy, let it walk a recorded tree. When it picks a node to expand, replay returns the children the agent actually produced. If nothing was recorded there, it gets nothing, so it can't invent results.

Each replay is scored on the best result found. It loses points for every node it opens, since each one stands for a real agent call. It gains a little for running attempts in parallel.

Where this idea comes from

Reinforcement learning has used this idea for years. Experience replay, used in DeepMind's Atari-playing DQN, stores past experience so the learner can reuse it without playing again. Recommender systems use offline evaluation to test a new ranking policy on logged clicks before any user sees it.

Think of dreaming as backtesting a trading strategy on past market data. It's cheap, and it carries the same two risks.

The online rounds are the check on both. Each real round tests the chosen policy for real and adds fresh history for the next replay.

Reading the results carefully

The paper uses Gemini-3.1-Pro and Gemini-3.7-Flash as the discovery agent. The clearest test is a solver for the Lasso regularisation path. Lasso is a linear regression method that pushes many weights to exactly zero. The solver is scored by average runtime on six held-out datasets, and lower is better.

MethodAgent callsAvg runtime (ms)
sklearnn/a44,180.3
glmnetn/a13,767.5
SimpleTES (GPT-OSS-120B)51,2003,804.8
Recursive Fixed (Pro)5503,587.1
Dream-RSI (Pro)3172,931.0
Recursive Fixed (Flash)3,2002,516.7
Dream-RSI (Flash)1,8792,350.6

This table supports two different comparisons, and they say different things.

Flash, the smaller model, built faster solvers than Pro while making several times more calls. How a system spends its attempts can matter as much as which model it uses.

The other two domains show a similar pattern, with the clearest gains in cost.

What the learned policy does, and a warning about hints

On the ConvDiv kernel task, the policy first cut its attempts from 110 to 50. When progress stalled, it raised the effort again, and scores improved. A fixed rule spends the same way whether the search is going well or stuck.

The authors also tried giving the agent past history as hints about which direction to search. Under the same budget, that consistently did worse than no hints. Strong hints narrowed the search and cut the variety of ideas.

Many agent setups feed lessons learned from past runs straight back into the prompt. For open-ended search, this result points the other way. Use history to evaluate the strategy, and keep it out of the agent's instructions.

Where this approach works, and where it doesn't

Every domain in the paper has an evaluator that returns a number, such as runtime, kernel speed or a maths score. Replay depends on those stored scores.

The name also sounds bigger than the method. The model, the evaluator and the tools stay fixed. What improves is the code that steers the search, inside limits a person set.

What you can reuse in your own agent systems

Any agent loop that retries, branches or decides when to stop has an exploration policy, even if it's a few if-statements. You can apply the core idea without a research setup.

The loop engineering post covers the retry and validation loop this sits inside. The Agentic AI and Multi-Agent Systems track in this app covers planning, tool use and reasoning patterns.

Sources