← Back to Global Robotics News/Editorial detail
Global Robotics News / EDITORIAL DETAIL

Let Code Agents Learn from Their Own Mistakes: ReTerm Explores Failure-Driven RSI

In complex terminal tasks, an error often results in a series of ineffective operations: re-installing reliance on a set-up, continuing to modify the code under the wrong assumption until the budget runs out, the task fails. Can these failures, in turn, b

The code is wrong, the commands are wrong, the environment is bad, what does the Code Agent do next?

In complex terminal tasks, a single error often results in a series of ineffective operations: reinstalling already installed dependencies, continuing to modify the code along the wrong assumptions until the budget runs out, the task fails.

Researchers from Ren Tan University, MMLab at the Chinese University of Hong Kong and Shanghai University of Transportation have proposed ReTerm to allow terminal intelligences to try to recover from their own failures and learn from the recovery results to explore a path of recursive self-improvement (RSI) driven by their own mistakes.

The key to this work is to get "your own problems, your own attempts to recover, your own updates based on success parameters" into the same training loop.

图片

Why would an Agent do a mission?

It's still easy to make mistakes.

Fixing errors in a terminal environment is more complicated than modifying the answers to a logical problem. Error operations may have modified the file, installed dependencies, or started the process; subsequent actions face an environment that has been altered by previous operations. To continue the task, the agent must understand what has happened and determine exactly where the problem arose.

The PyStan case in the paper is intuitive: the software is clearly installed and the import pystan is still executed. The standard GRPO training model repeatedly tries to import, unload and reload without ever jumping in the wrong direction. The ReTerm-GRPO training model checks the installation path and finds that the actual module is located in the stan directory, then uses the import stan to find the recovery direction.

图片

How to make this recovery behaviour more stable? Learning the success trajectory only from a clean environment, it is difficult to fully cover the complex state after a real failure; mistakes in artificial injection are not necessarily consistent with the mistakes the model would actually make.

ReTerm-10K allows the model to learn how to take over the failure scene

The team built ReTerm-10K to provide recovery samples for the model: first collect the basic model's own failed tasks, then ask a stronger teacher model to take over, demonstrate how to check for problems, fix errors and complete tasks.

图片

After successful verification and quality screening, the team obtained about 10,000 recovery tracks to support cold start training. The model first recovered from demonstration training and then explored how to solve the new problems they encountered in online reinforcement learning.

ReTerm-GRPO is a failure

Going to the next round of training

The idea behind ReTerm-GRPO is straightforward: let the Agent try to correct his own mistakes and learn from them.

图片

After the agent fails to execute a task, the system retains the environment and operational records at the time, starting from the same failed site, allowing it to independently attempt multiple recovery methods. Which attempts ultimately complete the task are judged by the task verifier.

The success of these recovery attempts translates into reinforcement learning signals, updating model parameters, and allowing the Agent to more effectively diagnose problems and correct errors.

Self-improvement occurs in this cycle: the model constantly encounters its own problems, attempts to recover independently, and learns from the results.

The 9B model is upgraded synchronously in three main assessments

In three main assessments covering terminal operations and software engineering, the ReTerm-9B improved by more than 13 percentage points compared to the base model:

  • Terminal-Bench 2.0:20.2% → 34.8%, up by 14.6 percentage points.

  • SWE-bench Verified: 45.2% → 58.4%, up by 13.2 percentage points.

  • OpenThoughts-TBLite: 44.2% → 60.6%, up by 16.4 percentage points.

图片

The 9B model also demonstrates stronger task-resolution capabilities. In all three main assessments, ReTerm-9B achieved significant improvements, demonstrating stronger competitiveness in the same-scale model, and achieving better results in some assessments than the larger parameter-scale model. This demonstrates that learning to recover from its own failures is an effective pathway to improving the ability of the terminal's intelligent body.

Among them, ReTerm uses the same operating framework and evaluation configuration as Qwen 3.5-9B to directly observe the benefits of recovery training; other models have data from their respective papers or official releases, with different operating configurations.

A different operating framework, a different type of task still works.

In the same Terminal-Bench 2.0 task, ReTerm outperformed the base model in three different operating frameworks, retaining a 6.7 to 12.4 percentage point increase, indicating that revenue can be migrated to different interaction settings.

图片

The benefits of resuming training also extend to mathematical reasoning and spreadsheet operations. Pass@1 for AIME 2025 increased from 73.3% to 93.3%, SpreadsheetBench Verified increased from 37.8% to 48.8%; AIME 2024 and Aider Polyglot also achieved improvements, demonstrating the potential for generalization in cross-task areas.

Improvement from more efficient recovery

The dilution experiment further addresses a key question: What brings more recovery than regular reinforcement training?

The dilution experiment further validated the role of recovery training. In Terminal-Bench 2.0, the recovery performance of the SFT demonstration will increase from 20.2% to 25.8%, the standard GRPO to 28.0%, and the ReTerm-GRPO to 34.8%.

While improving task completion, Agent is also better at recovering from errors. In the five categories of planning, tool use, code implementation, verification and resource management errors, ReTerm-GRPO's recovery rate is higher than that of the basic model and the standard GRPO, indicating that the benefits of recovering training are reflected in multiple execution scenarios.

These results show that ReTerm has a better chance of adjusting direction after a mistake and continuing to complete the task. However, the recovery rate for the other four types of errors, apart from the use of tools, is still less than 32%, leaving room for further improvement.

Making failure the starting point for the next round of self-improvement

ReTerm demonstrates a specific Agent self-improvement path: allowing the model to retain the failed site it left behind, attempt to recover autonomously, and then train the next round of strategies with verifiable task results.

This work provides an experimental, analyzable starting point for the failure-driven RSI. As the strategy evolves, the model can constantly confront its new problems, allowing recovery and task-solving capabilities to develop together during the same training process.

RoboInd editorial channelResearch, robotics companies and market intelligence for cross-border sourcing.Explore the channel ↗
Share this
← Previous postEarlier Than DeepSeek Super Agent, Comma Builds Long-Term Memory into an Agent “Ch...2026-11-04 Next post →NVIDIA and UT Austin Release Realtime-Bench, Challenging GPT-6 on Real-Time Intera...2026-11-04
End of editorialExplore more from Global Robotics News ↗