Small Models Steer, Large Models Code: A New Paradigm for Recursive Self-Improvement
Recursive Self-Improvement (RSI) enables AI agents to autonomously write, evaluate, and refine code. However, relying solely on large models often leads to a strategic bottleneck where systems get trapped in local optima due to context anchoring and path dependency. This article explores a counter-intuitive RSI paradigm where a smaller model (e.g., 9B parameters) generates high-level strategies while a larger model handles code implementation. Using the open-source AgentPilot project as an example, it details the architecture and engineering practices of this multi-model collaboration approach, highlighting how matching model capabilities to specific roles can drive continuous system evolution more effectively than simply scaling up model size.
1. What is Recursive Self-Improvement (RSI)?
Recursive Self-Improvement (RSI) refers to an agent system utilizing its own capabilities to improve itself, forming a closed loop of “generate-evaluate-correct-regenerate.” In the field of agents and code generation, the typical form of this concept involves having a model automatically write a program to solve a task, running the program to observe the results, feeding the failure information back to the model, and having it modify the program. This cycle repeats until a solution meeting the requirements is produced.
From an engineering perspective, the core components of RSI typically include:
- Strategy Generator: Decides “what to do next,” such as switching algorithms, adjusting the search space, or modifying optimization objectives.
- Executor: Translates the strategy into runnable code.
- Evaluator: Scores the execution results or verifies correctness.
- Memory & Experience Base: Accumulates historical success and failure information to avoid repeating the same mistakes.
Ideally, this closed loop should lead to continuous performance improvement with each iteration. In practice, however, researchers have discovered an intriguing phenomenon: the bottleneck of the loop often lies not in “writing code,” but in “thinking about strategy.”
2. The Overlooked Bottleneck: The Mindset of Large Models
Many teams operate on the intuitive assumption that the stronger the model, the better the self-improvement effect. Yet, experimental observations reveal a different reality. When a large model is responsible for code implementation, it can indeed polish a given solution to a fine degree—fixing bugs when they arise and trying different approaches to patch remaining flaws. This “local repair” capability is highly robust, but the cost is that the system struggles to step back and reflect on a more fundamental question: Is the initially chosen methodology itself wrong?
This phenomenon can be likened to the “sunk cost effect.” The model has invested heavily in patching history within its context, and this history becomes inertia, anchoring subsequent attempts in the wrong direction. The technical causes can be summarized in three points:
- Context Anchoring: Failure records in a long context make the model inclined to “patch within the existing framework” rather than start over.
- Path Dependency: Every step of self-improvement is based on the output of the previous step. Once an early direction deviates, errors accumulate and amplify along the timeline.
- Capability Redundancy Masking Strategy Flaws: The large model’s formidable repair ability makes the system appear to be “constantly progressing,” when in reality, it is just spinning in circles within an incorrect local optimum.
3. A Counter-Intuitive Solution: Small Models Steer, Large Models Row
To address this bottleneck, researchers from the Data Intelligence Laboratory at the University of Hong Kong proposed a counter-intuitive division of labor: let a small model with only around 9B parameters be responsible for proposing strategies, while a more capable large model is tasked with implementing those strategies into code.
Why are small models better suited to “steer”? The answer lies in the behavioral differences between the two types of models:
- Small models tend to “change approaches” rather than “fix details.” With limited repair capabilities, when one path fails, a small model is more likely to propose a leap toward a completely different algorithmic direction. This “necessity is the mother of invention” characteristic effectively breaks path dependency.
- Large models excel at “faithful execution.” Given a clear algorithmic strategy, a large model can deliver high-quality engineering implementation, accurately translating the strategy’s intent into code.
In other words, “exploration” and “exploitation” are explicitly assigned to two different scales of models: the small model acts as the explorer, ensuring the diversity of the search space; the large model acts as the exploiter, ensuring that every candidate direction is fully and high-quality implemented. This design has a clear correspondence in search theory—it essentially introduces a “restart mechanism” into a self-evolving system to prevent premature convergence.
4. Engineering Implementation: AgentPilot-Style System Design
Centered around this approach, the team iteratively developed the open-source project AgentPilot. Stripped of specific implementation details, its general architecture can be abstracted into the following process:
Loop Start:1. Strategy model (small model) reads: task description + historical attempt summary + failure cause analysis2. Strategy model outputs: a high-level algorithmic strategy (not specific code)3. Execution model (large model) translates the strategy into fully runnable code4. Execute code in a sandbox environment, collect evaluation metrics and error logs5. If criteria are met, exit; otherwise, write this round's success/failure info into the experience base, return to step 1
Several engineering points are worth noting:
1. Interface Design for Strategy and Implementation. The output of the strategy model should be a structured algorithmic description (ideas, pseudocode, key trade-offs), not direct code generation. This both leverages the large model’s implementation capabilities and makes the strategy history easier to compress and retrieve.
2. Compression and Distillation of Historical Information. Dumping the complete context of each attempt directly to the strategy model will reintroduce the anchoring effect. A better practice is to maintain a “strategy evolution graph”: recording the success/failure conclusions and reasons for each direction, while omitting intermediate repair details.
3. Enforcing Diverse Strategy Constraints. When prompting the strategy model, explicitly require that “this round’s strategy must differ methodologically from existing failed directions,” using rule-based methods to guarantee exploratory behavior.
4. Sandbox and Evaluation Isolation. The execution phase should run in an isolated environment, equipped with resource limits and timeout controls to ensure the automated iteration process is safe and manageable. In cloud environments, this can be achieved leveraging general capabilities of container platforms, logging services, and monitoring alerts.
5. Implications and Outlook
This practice offers three key takeaways for agent system designers:
First, matching model capabilities to roles is more important than “stacking the strongest model.” The overall system performance depends on whether the behavioral characteristics of each component complement each other, rather than the ceiling of a single component.
Second, the architectural design of a self-improving system is essentially a fight against convergence. Any mechanism that makes the system “look like it’s progressing” could simultaneously be a mechanism that traps the system “in place.” Deliberate perturbation sources must be introduced to break inertia.
Third, multi-model collaboration is an effective path to control costs. Having a small model handle high-frequency strategy probing, with a large model intervening only when high-quality implementation is needed, can sustain longer cycles of continuous evolution within a limited compute budget.
As model capabilities become increasingly stratified, “putting the right model to the right task” will evolve from an empirical trick to a standard design principle in agent engineering. Exploration in the direction of RSI is still in its early stages, but these counter-intuitive findings remind us: the path to stronger intelligence may not necessarily lie in larger models, but rather in smarter collaboration structures.
