Stabilizing On-Policy Targeted Guidance in Agentic Reinforcement Learning
Abstract: Naive on-policy RL is often bottlenecked by the capabilities of the base model --- insufficient coverage can result in an inability to learn from certain rewards. At the same time, rewards in modern post-training systems often come from rich textual sources, e.g. judge models with a rubric of criteria. Can we utilize such structures to provide a rich directional signal that enables improving on otherwise difficult to optimize rewards? In this work, we examine a framework we refer to as targeted guidance that learns from per-turn textual feedback via an on-policy self-distillation objective. Our focus is not only on directly improving hard-to-optimize behaviors, but on how to do so throughout the training process without degrading baseline RL performance. Over a range of settings across an agentic multi-turn software engineering environment, we find success by combining targeted self-distillation with a per-criteria RL reward, and by limiting feedback to turns where the policy specifically fails. We further examine the design choices that lead to stable entropy and reduce oscillatory behavior throughout training.
Paper Prompts
Sign up for free to create and run prompts on this paper.
Explain it Like I'm 14
1. What is this paper about?
This paper studies how to train AI agents to improve at difficult tasks, especially software engineering tasks such as editing code and using computer tools.
The researchers focus on a problem with normal reinforcement learning (RL). In RL, an AI tries something, receives a reward or score, and gradually learns to repeat actions that earn higher scores. However, this method struggles when the AI almost never tries the correct behavior in the first place.
For example, suppose an AI must use a new tool in a special format. If it never produces that format, ordinary RL has no good example to learn from. The paper proposes a method called targeted guidance, which gives the AI short, useful text feedback—similar to a teacher’s hint—when it makes a specific mistake.
2. What questions did the researchers ask?
The main questions were:
- Can written feedback help an AI learn behaviors that ordinary RL cannot discover?
- Can the AI learn several goals at the same time, such as using the correct tool format and following a particular writing style?
- Can this extra guidance be added without making the AI worse at its main task, such as solving programming problems?
- What design choices make training stable instead of causing the AI’s behavior to suddenly become worse?
The researchers were especially interested in avoiding problems such as:
- Collapse, where the AI’s behavior becomes confused or useless.
- Oscillation, where the AI learns one behavior but then forgets it while learning another.
- Loss of diversity, where the AI produces fewer kinds of answers than before.
3. How did the researchers approach the problem?
Reinforcement learning
The AI was trained in a multi-step software environment. It could:
- Read a programming problem.
- Think about what to do.
- Call tools.
- Edit code.
- Receive a score based on how well it solved the problem.
This is similar to training a student by giving them practice problems and rewarding correct answers.
The researchers used several kinds of rewards. The main reward measured whether the code worked. Additional rewards measured things such as:
- Whether the AI used a tool correctly.
- Whether it followed a requested writing style.
- Whether it explained its work in a certain way.
- Whether it kept its answer to a reasonable length.
Textual feedback as a teacher’s hint
When the AI failed a particular requirement, a judge supplied feedback such as:
“Use the semantic-search tool with the required number-of-lines parameter.”
The AI then saw this feedback before trying that part of the task again.
The researchers created a temporary “expert” by using the same AI model with the feedback added to its context. The model with the hint often chose better next words or actions. The original model was then trained to make its predictions more like this feedback-guided version.
This is called self-distillation. An everyday analogy would be:
- A student first tries to solve a problem alone.
- A teacher gives the student a hint.
- The student watches how they would solve it with the hint.
- The student practices making the improved choice independently next time.
Only guide the AI when necessary
The researchers found that the feedback should not be used everywhere. They applied it only:
- On turns where the AI actually failed a requirement.
- To the particular part of the conversation connected to that failure.
- Alongside the normal RL reward.
This was important because constant advice could interfere with behaviors the AI had already learned well.
The technical training signal
The researchers used a mathematical measure called KL divergence. In simple terms, it measures how different two sets of probabilities are.
A LLM gives different probabilities to possible next words. The researchers encouraged the ordinary model to have probabilities similar to the feedback-guided model, especially on the words where the two models disagreed.
They also tested the method on the AI’s internal “thinking” text, not just its final answer. This helped the AI remember several instructions at once.
4. What did they find?
The AI learned behaviors that normal RL missed
In one experiment, the AI had to use a new format for a semantic-search tool. Normal RL failed because the original model almost never produced the new format.
Targeted guidance helped the AI learn the correct format. Importantly, its main coding performance did not get worse.
It improved many writing-style requirements
The researchers tested requirements such as:
- Including a Markdown table.
- Describing the user’s problem.
- Giving suggestions.
- Using bold text.
- Running a particular command.
- Writing status updates as poems.
The results showed that targeted guidance improved many of these behaviors more reliably than the other tested methods.
A simplified version of the results is:
| Training method | Learned style requirements | Maintained coding performance |
|---|---|---|
| Standard RL | Some, but not all | Usually yes |
| Basic self-distillation | Some | Mostly |
| Online supervised training | Some | Often worse |
| Targeted guidance | Most of the tested requirements | Yes, about as well as the baseline |
The exact scores differed by requirement, but the main pattern was clear: targeted guidance improved extra behaviors while preserving the AI’s main coding ability.
It handled unusual behaviors
In another experiment, the AI had to write a poem in every status update. This was very different from the behavior it had originally learned.
Normal RL failed to discover this behavior. Targeted guidance helped the AI adopt it while still solving coding tasks.
The method was more stable when designed carefully
The researchers found several important design rules:
- Use feedback only when the AI fails. Giving feedback all the time caused a drop in coding performance.
- Combine feedback with ordinary RL rewards. Feedback helped the AI discover new behaviors, while RL helped it keep and refine them.
- Keep the feedback strength moderate. If the guidance was too strong, the AI became unstable. Its answers became longer and more random, and its coding performance later collapsed.
- Guide the model’s internal thinking as well as its final answer. This helped it remember several requirements at once and reduced the pattern of improving one behavior while forgetting another.
In technical language, the researchers monitored the model’s entropy, which measures how spread out or uncertain its predictions are. A sudden jump in entropy was an early warning that training might soon become unstable.
5. Why are these findings important?
Normal RL is good at strengthening behaviors that an AI already performs sometimes. But it is not good at teaching a completely new behavior if the AI never tries it.
Targeted guidance helps solve this “how would the AI ever discover the right action?” problem. It provides a direction without completely replacing the AI’s own behavior.
The method is also useful because modern AI systems often receive rich written evaluations from judges or reviewers. Instead of reducing all that information to one number, targeted guidance uses the actual explanation.
For example, a score of 0 only says that something went wrong. A message such as “include the required parameter in the tool call” explains how to improve.
6. Simple conclusion and possible impact
The paper argues that AI training can work better when it combines:
- Rewards, which tell the AI whether it succeeded.
- Textual hints, which explain how to improve.
- Careful timing, so advice is given only when needed.
This could help future AI agents learn new tool commands, communication styles, safety rules, or other behaviors that are difficult to discover through trial and error alone.
However, the research has limits. The experiments mainly involved software-engineering agents and style or formatting goals. Each goal also needed a carefully written feedback message. The researchers do not yet know how well the method will work for every kind of task.
Overall, the paper’s main message is:
An AI can learn difficult new behaviors more reliably when it receives specific hints at the exact moment it makes a mistake—but the hints must be used carefully so they do not disrupt skills the AI already has.
Practical Applications
Immediate Applications
The paper’s method can be integrated into existing on-policy reinforcement-learning pipelines, particularly where a model receives verifiable rewards plus textual feedback. The most directly deployable applications are concentrated in agentic software systems, although the underlying workflow is transferable.
- Software engineering agents: learning new tool-call formats (Software; Immediate Application) A coding agent can receive targeted feedback when it uses an outdated or invalid API, search command, parameter schema, or tool delimiter. The feedback-conditioned model supplies token-level guidance only on the failed turn, while the normal task-completion reward preserves coding performance. Potential product/workflow: an RL training component that automatically teaches coding agents newly introduced tools without requiring a complete supervised fine-tuning cycle. Dependencies: reliable detection of tool-format violations, accurate textual hints, an on-policy training pipeline, and sufficiently capable base-model understanding of the feedback.
- Improving coding-agent communication style without reducing correctness (Software; Immediate Application) Development teams can optimize auxiliary requirements such as “describe the user’s problem,” “include a Markdown table,” “explain the solution,” “use a specified command format,” or “request confirmation.” Targeted guidance is applied only when the criterion fails, while coding pass-rate remains part of the ordinary RL objective. Potential product/workflow: configurable style policies for enterprise coding assistants, with organization-specific response rubrics enforced during post-training. Dependencies: style criteria must be independently judgeable; criteria that strongly conflict with task correctness may require careful reward weighting and validation.
- Multi-criteria quality control for LLM agents (Software and enterprise AI; Immediate Application) An existing judge-based post-training system can retain its scalar rewards while also emitting per-criterion explanations. These explanations can be converted into feedback strings and used to target specific failures rather than applying a global distillation loss. Potential product/workflow: a training dashboard showing criterion-level failure rates, feedback effectiveness, KL divergence, entropy, output length, and primary-task performance. Dependencies: judge-model reliability, calibration of binary or weighted criteria, and safeguards against feedback that is incorrect, ambiguous, or overly prescriptive.
- Learning rare output formats and structured communication (Enterprise automation, documentation, customer support; Immediate Application) Models can be trained to produce uncommon but operationally useful formats—status reports, incident summaries, structured handoffs, XML or JSON schemas, compliance disclosures, or domain-specific templates—even when those behaviors have little support in the base policy. Potential product/workflow: a post-training system that adds new formatting conventions through targeted hints rather than collecting a large new demonstration dataset. Dependencies: format validators must accurately identify failures, and the feedback must specify the required change without unintentionally altering content quality.
- Agent-specific error correction during RL training (Software infrastructure; Immediate Application) Failed turns can be routed to a feedback-conditioned expert, with the distillation loss masked on all unrelated turns. This provides a practical debugging and training workflow for tool misuse, invalid arguments, incomplete action sequences, and repeated reasoning loops. Potential product/workflow: automated “failure replay” pipelines that associate each failed action with a judge explanation and a localized policy update. Dependencies: accurate turn attribution; asynchronous training systems may require controls for stale rollouts and stale feedback.
- Safer deployment of style and policy updates (Software governance and AI operations; Immediate Application) The method can support incremental policy changes while monitoring whether the base capability degrades. Because the paper finds that high distillation weights can produce entropy spikes, teams can use entropy, token length, and primary-task reward as deployment gates. Potential product/workflow: a model-release checklist that blocks a training run when output length rises sharply, entropy becomes unstable, or verified task performance falls. Dependencies: suitable baseline metrics, threshold selection, representative evaluation data, and independent safety testing.
- Academic research infrastructure for studying exploration in language-model RL (Academia; Immediate Application) Researchers can use the framework as a controlled baseline for comparing scalar rewards, on-policy self-distillation, online SFT, likelihood-based rewards, and targeted guidance. The method also offers experimentally testable interventions: failure-only gating, per-criterion RL rewards, feedback placement before the offending turn, and distillation over reasoning tokens. Potential tool: an open benchmark containing multi-turn tasks, auxiliary criteria, judge feedback, failure localization, and stability metrics. Dependencies: reproducible implementations, transparent judge prompts, access to substantial compute, and evaluation beyond a single software-engineering environment.
- Targeted reinforcement learning for robotics and tool-using systems (Robotics; Immediate Application with adaptation) In a robot or workflow agent, textual feedback could identify localized failures such as an incorrect action sequence, invalid tool invocation, or failure to follow a safety procedure. The approach is most immediately applicable to language-mediated controllers and simulator-based training rather than directly to continuous motor control. Dependencies: a language interface between the feedback and policy, reliable event-level failure detection, and evidence that textual guidance maps consistently to physical actions. Real-world deployment would require safety constraints and conservative policy updates.
Long-Term Applications
The paper supports broader applications, but these require validation beyond software engineering, improved feedback generation, or scaling to more complex environments.
- General-purpose post-training for healthcare, finance, and legal agents (Healthcare, finance, legal technology; Long-Term Application) Domain agents could receive criterion-specific guidance for behaviors such as citing evidence, asking required clarification questions, documenting uncertainty, following approval workflows, or formatting regulated reports. The ordinary task reward could preserve diagnostic, analytical, or retrieval performance while targeted guidance improves compliance behavior. Dependencies: high-quality domain judges, expert-validated feedback, privacy-preserving training data, robust hallucination evaluation, and formal human oversight. Textual feedback must not be treated as authoritative in high-stakes decisions without independent verification.
- Policy-compliant and auditable AI systems (Public policy and enterprise governance; Long-Term Application) Regulators or organizations could define explicit criteria for transparency, refusal behavior, data handling, accessibility, or documentation. A judge would identify failed criteria and produce actionable explanations that are distilled into the policy. Potential product/workflow: policy-as-code systems that convert regulations into verifiable criteria and maintain audit trails of failed rollouts, feedback, and policy changes. Dependencies: regulations must be translated into unambiguous operational tests; automated judges may encode bias or misinterpret legal requirements; human review remains necessary.
- Adaptive educational tutors (Education; Long-Term Application) Tutors could be trained to improve specific pedagogical behaviors—such as asking a diagnostic question, giving a hint rather than an answer, adapting to reading level, or explaining a misconception—based on per-turn feedback. Failure-only gating could avoid unnecessarily changing responses that are already effective. Dependencies: validated learning-outcome measures, age-appropriate safety controls, privacy protections, and evidence that judge feedback improves learning rather than merely stylistic compliance.
- Long-horizon reasoning and research agents (Scientific computing and knowledge work; Long-Term Application) Per-step feedback could guide agents to verify intermediate claims, maintain a plan, use appropriate tools, report uncertainty, or recover from failed experiments. Distilling guidance into internal reasoning tokens may reduce oscillation among competing objectives, as suggested by the paper’s ablation results. Dependencies: reliable process-level verifiers, explanations that improve rather than shorten reasoning, long-horizon credit assignment, and safeguards against models learning to satisfy the evaluator superficially.
- Robotic manipulation and autonomous planning (Robotics; Long-Term Application) A future multimodal version could translate feedback such as “grasp from the stable side,” “re-check the object pose,” or “use the calibrated tool” into localized policy updates. The failure-turn gating principle could limit changes to the action that caused the problem. Dependencies: multimodal feedback, simulation-to-real transfer, low-latency inference, safety-constrained RL, and proof that language-conditioned self-distillation improves physical success rates without increasing unsafe exploration.
- Dynamic tool and API adaptation (Software platforms and cloud infrastructure; Long-Term Application) Agents could continuously learn evolving APIs, database schemas, deployment commands, and service-specific conventions from validation errors and textual documentation. This could reduce the need to retrain a model whenever an interface changes. Potential product: an API-adaptation layer that converts runtime errors, schema validators, and documentation into localized training feedback. Dependencies: secure handling of untrusted tool output, protection against prompt injection, stable versioning, and mechanisms preventing the agent from learning unsafe workarounds.
- Automatically learned feedback and gating policies (Machine-learning research; Long-Term Application) The paper identifies static human-designed feedback strings as a limitation. Future systems could learn which explanation is most useful, when to apply it, and how strongly to weight it. A meta-optimization loop could jointly train the judge, feedback generator, gating mechanism, and policy. Dependencies: reliable outer-loop objectives, prevention of reward hacking, computational scalability, and evaluation that distinguishes genuine capability improvement from judge exploitation.
- Dense, rollout-level guidance for complex behaviors (General agentic AI; Long-Term Application) The current method targets individual turns. A more advanced version could provide feedback throughout an entire trajectory, including planning, tool selection, intermediate verification, and final reporting. This may help with tasks whose success depends on coordinated behavior across many turns. Dependencies: credit assignment across long trajectories, control of feedback interference, efficient storage of full-vocabulary targets, and stronger theoretical guarantees regarding convergence and bias.
- Personalized assistants that preserve user preferences while improving competence (Daily life and consumer AI; Long-Term Application) Assistants could learn preferences such as concise responses, accessibility formats, household workflows, or preferred planning styles while retaining core task performance. Failure-only guidance could prevent unnecessary changes to interactions that already work well. Dependencies: explicit user consent, privacy-preserving personalization, protection against conflicting preferences, and reliable separation between harmless style changes and changes affecting factuality or safety.
- Energy-efficient RL post-training (Energy and AI infrastructure; Long-Term Application) Because the teacher need not autoregressively generate replacement trajectories, the method could reduce the cost of some guided-training workflows relative to online SFT or expert rollout generation. Optimized kernels and last-hidden-layer implementations could make targeted guidance more practical at scale. Dependencies: the additional forward pass must remain cheaper than generating alternative trajectories; full-logit KL computation, memory use, and large-model training costs still require engineering optimization.
- Standardized stability-aware training platforms (Industry and academia; Long-Term Application) The paper suggests a general control framework in which distillation strength is adjusted according to entropy, output length, failure rates, and primary-task reward. Future platforms could automatically reduce guidance when entropy spikes or when auxiliary objectives begin to interfere with core performance. Potential product: an adaptive RL controller with dynamic distillation weights, criterion routing, rollback checkpoints, and automatic regression detection. Dependencies: robust early-warning metrics, reliable dynamic weighting algorithms, and evidence that stability indicators transfer across models, tasks, and domains.
Glossary
- Agentic reinforcement learning: Reinforcement learning in which an AI agent performs multi-step actions, often using tools, to accomplish a task. “agentic multi-turn software engineering environment”
- Autoregressive generation: Sequential generation in which each new token is conditioned on previously generated tokens. “we evaluate the feedback via autoregressive generation in this procedure”
- Base policy: The initial or reference policy from which training begins. “We assume access to a base model which defines a starting policy .”
- Behavioral support: The set of actions or behaviors that a policy can produce with nonzero probability. “if the actions that satisfy such criterion are not within the support of the base policy”
- Binary reward: A reward taking one of two values, typically indicating whether a criterion was satisfied. “each binary reward component can additionally define a textual feedback string”
- Conditional expert policy: A policy formed by conditioning a model on additional information, such as textual feedback. “The policy conditioned on the feedback string then becomes an expert to serve as a source of guidance signal”
- Convergence: The process by which an optimization procedure approaches a stable solution or policy. “it is less clear that such objectives result in stable convergence”
- Criterion gating: Restricting an optimization signal to cases in which a specified criterion is not satisfied. “the distillation objective is only evaluated on agent turns that contain a failed criterion”
- Distillation weight: A coefficient controlling the contribution of a distillation loss to the total training objective. “ is the distillation weight”
- Diversity collapse: A reduction in the variety of outputs generated by a model or policy. “reasoning shortening [31, 30, 48] or diversity collapse [28, 2]”
- Entropy: A measure of uncertainty or spread in a probability distribution, here describing the policy’s action probabilities. “We find that an early predictor of collapse when utilizing distillation signal is a sharp increase in policy entropy.”
- Expert distillation: Training a student policy to imitate the output distribution of an expert policy. “Expert distillation as approximate policy improvement.”
- Feedback-conditioned expert: An expert distribution produced by conditioning the same model on textual feedback. “a per-token KL loss against a feedback-conditioned expert policy”
- Forward KL: The Kullback–Leibler divergence computed in the direction that weights discrepancies according to the first distribution. “we found that forward-KL, Jensen-Shannon distance, and Rao-Blackwellized KL [4] performed similarly”
- Full-vocabulary KL loss: A divergence loss computed over the complete vocabulary rather than only sampled tokens. “we utilize a full-vocabulary KL loss computed entirely on the trainer side”
- GRPO: Group Relative Policy Optimization, a reinforcement-learning method that uses relative rewards among groups of sampled outputs. “we combine various style-optimization methodologies with a baseline GRPO algorithm”
- Hidden test cases: Evaluation examples whose inputs or expected results are not exposed during training. “as evaluated by hidden test cases”
- Inference-trainer mismatch: A discrepancy between the model used to generate training data and the model used to optimize it. “To reduce undesirable effects from inference-trainer mismatch”
- Interleaved feedback: Feedback applied at multiple points throughout a multi-turn trajectory rather than only at its end. “DOES TARGETED GUIDANCE REMAIN STABLE EVEN WHEN OPTIMIZING MULTI-TURN INTERLEAVED FEEDBACK?”
- Jensen–Shannon distance: A symmetric and bounded divergence measure comparing two probability distributions. “we found that forward-KL, Jensen-Shannon distance, and Rao-Blackwellized KL [4] performed similarly”
- Judge model: A model that evaluates an output against specified criteria and may provide a score or explanation. “each criterion is implemented as a call to judge LLM”
- Kullback–Leibler divergence: A measure of the difference between two probability distributions. “we minimize KL between the live policy and over the on-policy state distribution ”
- Likelihood-as-reward: A method that uses the probability assigned to an output as a reinforcement-learning reward. “LaTRO [10], a representative likelihood-as-reward method.”
- Markov decision process: A formal model of sequential decision-making defined by states, actions, transitions, and rewards. “We define a Markov decision process (MDP) by a state space , an action space ”
- On-policy reinforcement learning: Reinforcement learning that trains on trajectories generated by the current policy. “Naive on-policy RL is often bottlenecked by the capabilities of the base model”
- On-policy self-distillation: Distillation in which a policy learns from a feedback-conditioned version of itself using states generated by the current policy. “Our algorithmic setup builds on a rich body of prior work often referred to as on-policy self-distillation (OPSD) methods”
- Out-of-distribution behavior: Behavior that differs substantially from the examples or behaviors represented in the training distribution. “This is an out-of-distribution behavior that lies outside the support of the base model.”
- Policy collapse: A failure mode in which a learned policy loses useful behavior or becomes unstable. “Combining the approaches naively leads to some risk of policy collapse or stagnation.”
- Policy gradient: An optimization method that updates a policy in the direction of higher expected reward. “alongside the typical policy gradient loss”
- Privileged information: Information available to a teacher or evaluator but not ordinarily available to the student policy. “This judge is equipped with additional privileged information on the correct way to solve the problem”
- Rao–Blackwellized KL: A variance-reduced or analytically improved estimator of Kullback–Leibler divergence. “we found that forward-KL, Jensen-Shannon distance, and Rao-Blackwellized KL [4] performed similarly”
- Reasoning trace: A sequence of intermediate internal or textual reasoning steps generated by a model. “by applying distillation to internal thinking traces”
- Reverse KL: The Kullback–Leibler divergence computed with the student distribution as the first argument and the teacher distribution as the second. “The distillation loss in our setting is calculated via reverse KL distance between the student and the teacher.”
- Rollout: A complete sampled trajectory produced by an agent interacting with an environment. “If a given rollout or agent turn fails to satisfy a given reward criteria”
- Self-distillation: Training a model to imitate a related version of itself, often one provided with additional context or information. “we introduced a simple targeted guidance approach that combines textual feedback self-distillation with standard on-policy RL.”
- Stop gradient: An operation that prevents a tensor or distribution from receiving gradient updates during backpropagation. “The ‘sg‘ operator represents stop gradient.”
- Trajectory: A sequence of states, actions, and observations generated during an episode. “which combined with the MDP creates a distribution of trajectories ”
- Teacher policy: A policy whose outputs or probability distribution provide learning targets for another policy. “the teacher is used purely for logit-level guidance and does not require autoregressive generation.”
- Token-level distillation: Distillation performed separately on the probability distribution for each generated token. “Our main approach is to utilize a per-token distillation target to provide this directional signal”
- Tool-calling policy: A policy trained to invoke external tools using structured actions or arguments. “a supervised finetuning (SFT) phase to adapt it to the tool call setting”
- Trust-region policy optimization: A reinforcement-learning approach that limits policy updates to remain close to the current policy. “We base our algorithmic considerations on classical policy improvement arguments [29, 55, 1].”
- Zero-shot ability: The ability to perform a task without task-specific examples or additional training. “we rely on the zero-shot ability of the policy to process this information”