← Latest papers
🤖 AI

Socratic-SWE: Self-Evolving Coding Agents via Trace-Derived Agent Skills

Socratic-SWE introduces a closed-loop self-evolution framework that transforms an agent's historical solving traces into structured skills to generate targeted, verifiable repair tasks, thereby enabling continuous improvement and achieving state-of-the-art performance on SWE benchmarks without relying on fixed mutation procedures.

Original authors: Chuan Xiao, Zhengbo Jiao, Shaobo Wang, Wei Wang, Bing Zhao, Hu Wei, Linfeng Zhang, Lin Qu

Published 2026-06-08
📖 5 min read🧠 Deep dive

Original authors: Chuan Xiao, Zhengbo Jiao, Shaobo Wang, Wei Wang, Bing Zhao, Hu Wei, Linfeng Zhang, Lin Qu

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are trying to teach a robot how to fix broken software. Usually, you have to write thousands of specific "homework assignments" for the robot, find the answers, and grade them. This is expensive, slow, and often the homework doesn't match the robot's actual weak spots.

The paper introduces Socratic-SWE, a new way to train these coding robots. Instead of a teacher handing out static homework, the robot teaches itself by analyzing its own mistakes and successes, turning them into a personalized study guide.

Here is how it works, using simple analogies:

1. The Old Way: The Static Textbook

Imagine a student trying to learn carpentry. In the old method, a teacher gives them a stack of 1,000 pre-written blueprints to fix.

  • The Problem: Some blueprints are too easy (the student already knows how to fix them), and some are impossible (the student doesn't have the right tools yet). The teacher doesn't know what the student is struggling with right now.
  • The Result: The student wastes time on things they already know or gets stuck on things they can't solve, and eventually, they stop improving.

2. The New Way: Socratic-SWE (The Self-Teaching Apprentice)

Socratic-SWE changes the game. It creates a closed loop where the robot acts as both the student and the teacher.

Step 1: The "Trace" (The Video Replay)

Every time the robot tries to fix a bug, it leaves behind a digital "footprint" called a trace. This is like a video replay of the robot's entire thought process:

  • Where did it look?
  • What code did it change?
  • Did the test pass or fail?
  • Did it accidentally break something else?

In the past, researchers only used these replays to give a simple "Pass" or "Fail" grade and then threw the video away. Socratic-SWE says, "Wait! Let's watch the video again."

Step 2: Distilling "Skills" (The Study Guide)

The system watches all the replays and looks for patterns.

  • If the robot failed: It notices, "Oh, every time I try to fix a file with three tabs open, I forget to save the first one."
  • If the robot succeeded: It notices, "When I check the error log before editing, I usually get it right."

It turns these patterns into a structured "Agent Skill Registry." Think of this as a personalized Study Guide or a Coach's Cheat Sheet. It lists exactly what the robot is bad at (e.g., "Don't forget to check for side effects") and what it's good at.

Step 3: Generating New Homework (The Custom Quiz)

Now, the robot uses this Study Guide to create new homework.

  • Instead of picking random bugs, the robot asks: "Based on my Study Guide, I keep failing at 'multi-file edits.' Let me create a new, tricky bug that specifically requires me to edit three files at once."
  • This ensures the homework is perfectly targeted at the robot's current weaknesses.

Step 4: The "Verifier" Gatekeeper

Before the new homework is given to the robot, a strict Gatekeeper checks it.

  • Does the bug actually exist?
  • Can the robot actually fix it?
  • Is the test reliable?
    If the homework is broken or impossible, it gets thrown out. Only high-quality, solvable tasks make it to the training pool.

The "Gradient Alignment" (The Compass)

There is one more clever trick. The system doesn't just want the robot to solve any problem; it wants the robot to get better at the right things.

  • Imagine a compass. The system has a "trusted direction" (a set of known, high-quality tasks).
  • When the robot generates a new task, the system asks: "Does solving this new task move the robot in the same direction as our trusted compass?"
  • If yes, the task is kept. If no, it's discarded. This prevents the robot from learning "tricks" that only work on fake problems.

The Results: Getting Smarter Faster

The researchers tested this on four major benchmarks (like final exams for coding agents).

  • The Baseline: A standard robot trained on fixed data.
  • The Competition: Other robots that try to teach themselves but without this specific "Skill Registry" method.
  • Socratic-SWE: After just three rounds of self-teaching, it scored 50.4% on the hardest test (SWE-bench Verified). This was a huge jump compared to the others, which either got stuck or improved very slowly.

Why This Matters

The paper claims that Socratic-SWE proves you don't need a human to write endless new homework. By reusing the robot's own history (traces) to build a skill guide, the robot can continuously generate its own curriculum. It turns the robot's past failures into its future fuel, allowing it to evolve and get better without needing a constant stream of human teachers.

In short: It's like a robot that watches its own game replays, writes its own study guide, creates its own practice drills, and then takes a test to see if it actually improved. And it turns out, this self-coaching method works better than having a human hand out the same old worksheets.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →