← Latest papers
💻 computer science

From Patches to Trajectories: Privileged Process Supervision for Software-Engineering Agents

The paper introduces Patches-to-Trajectories (P2T), a method that leverages reference patches as privileged information to distill optimal solution milestones and curate high-quality, efficient training trajectories for software-engineering agents, thereby significantly improving reasoning effectiveness and inference efficiency compared to standard supervised fine-tuning.

Original authors: Murong Ma, Tianyu Chen, Yun Lin, Shuai Lu, Qinglin Zhu, Yeyun Gong, Zhiyong Huang, Peng Cheng, Yan Lu, Jin Song Dong

Published 2026-05-22
📖 5 min read🧠 Deep dive

Original authors: Murong Ma, Tianyu Chen, Yun Lin, Shuai Lu, Qinglin Zhu, Yeyun Gong, Zhiyong Huang, Peng Cheng, Yan Lu, Jin Song Dong

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 a broken machine. You have a video of a master mechanic fixing it perfectly. The standard way to teach the robot is to show it the entire video, from start to finish, and say, "Copy exactly what you see."

The problem? The master mechanic might have made some silly mistakes along the way. Maybe they looked at the wrong part of the machine three times, or they guessed a solution that happened to work by luck, even though their reasoning was flawed. If the robot copies the whole video, it learns those bad habits too. It might fix the machine, but it will do so inefficiently and with a shaky understanding of why it worked.

This paper, titled "From Patches to Trajectories," introduces a smarter way to teach these software-fixing robots (called AI agents). They call their method P2T.

Here is how P2T works, using a simple analogy:

The Problem: The "Bad Video"

In the old method, researchers would ask a super-smart AI (the "Teacher") to try fixing a bug. If the Teacher's final fix worked, they kept the whole attempt as a lesson for the student robot.

  • The Flaw: The Teacher might have taken a 100-step path to solve a 10-step problem. They might have looked at files they didn't need to, or made a leap of logic that only worked because they got lucky. The student robot learns all that wasted time and bad logic.

The Secret Ingredient: The "Answer Key"

Every real-world software bug comes with a "Gold Standard" fix (a reference patch) written by a human developer.

  • The Old Way: Throw this answer key away after checking if the Teacher's fix matched it.
  • The P2T Way: Use the answer key as a secret cheat sheet for the teacher, but never show it to the student.

How P2T Works: The Two-Phase Process

Phase 1: The Detective Map (Reverse Phase)
Imagine the "Gold Standard" fix is a treasure map showing the final destination. P2T doesn't just give the student the destination; it asks a smart detective (an AI) to work backward from the treasure to figure out the necessary clues needed to find it.

  • The detective creates a "Process Graph" (a checklist of facts).
  • Example: "To fix this, you must first realize that File A talks to File B," or "You must see that the error happens when the temperature is high."
  • Crucial Rule: The detective is strictly forbidden from writing down the final solution or any clues that couldn't be found by looking at the problem normally. This prevents the "cheat sheet" from leaking into the lesson.

Phase 2: The Guided Walk (Forward Phase)
Now, the "Teacher" AI tries to fix the bug again, but this time, it's being watched by a Curator.

  • The Curator has the "Process Graph" (the checklist of necessary clues) in hand.
  • The Teacher tries to walk the path. The Curator watches every step.
  • The Filter:
    1. Effectiveness: Did the Teacher's step actually uncover a necessary clue from the checklist? If they skipped a clue or guessed, the Curator says, "Nope, that step doesn't count."
    2. Efficiency: Did the Teacher waste time? If they looked at a file they already saw, the Curator cuts that part out.
  • The Result: The Curator stitches together only the shortest, most logical path that successfully uncovers all the necessary clues.

The Analogy: The Hiking Guide

Think of the software bug as a mountain hike.

  • Old Method: You show a student a video of a hiker who reached the summit. But the hiker in the video wandered in circles, took a wrong turn, and then got lucky to find the path. The student learns to wander in circles too.
  • P2T Method: You have a map of the perfect route (the Gold Standard). You don't show the map to the student. Instead, you have a guide (the Curator) who watches a hiker (the Teacher) try the climb. The guide has the map and knows exactly which landmarks must be seen to reach the top.
    • If the hiker misses a landmark, the guide says, "Go back and find it."
    • If the hiker takes a detour, the guide says, "Cut that part out."
    • The student only sees the final, edited video: a direct, efficient hike where every step makes sense.

The Results

The paper tested this on real software bugs.

  • Better Smarts: The robots trained with P2T solved 10.8% more problems correctly than those trained with the old method.
  • Cheaper & Faster: Because the robots learned to take shorter, more direct paths, they used 15% less computing power (and money) to solve the problems.
  • No Cheating: The robots didn't just memorize the answer; they learned the process of finding the answer, because the "cheat sheet" was never shown to them directly.

In short, P2T turns a messy, lucky guess into a clean, logical lesson plan, teaching AI agents to be not just successful, but efficient and grounded in reality.

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 →