Write, Execute, Refine: From Skill Followers to Skill Optimizers via Reinforcement Learning from Execution Feedback

Kang Peng, Zhiwei Zhang, Yichen Zhang, Zezhong Wang, Yiming Du, Geng Tu, Baojun Wang, Bin Liang, Ruifeng Xu, Kam-Fai WongarXiv 2026

TL;DR

Large Language Models (LLMs) are surprisingly good at following procedural "skills," but they are notoriously bad at writing them. The WER (Write, Execute, and Refine) framework bridges this gap by training a dedicated Skill Optimizer using Reinforcement Learning from execution feedback, allowing a small 4B model to outperform massive off-the-shelf models in generating effective agent instructions.

What Problem Does This Paper Address?

In the world of AI agents, "skills" are compact, natural-language instructions that guide a model on how to use tools—like a mini-manual for a specific task. While expert-written skills can boost performance by nearly 20 points, skills written by agents themselves often perform worse than using no skill at all.

Current solutions usually involve "inference-time loops," where a model drafts a skill, sees it fail, and tries to fix it. However, this is a temporary patch; it doesn't actually teach the model how to be a better skill-writer for the next task. The authors identify a fundamental capability gap: the ability to follow instructions is distinct from the ability to diagnose execution failures and translate them into reusable procedural guidance.

Methods

The authors introduce WER, a multi-phase training framework designed to turn a base LLM into a specialized Skill Optimizer.

Figure 1: The Skill Optimizer remains outside the environment and observes execution. It writes a skill for a frozen agent and revises the skill from the resulting trajectory.

The framework operates with a clear separation of roles:

  1. The Skill Optimizer ($\pi_\theta$): A trainable model (e.g., Qwen3-4B) that generates and refines skill documents.
  2. The Executor ($\pi_A$): A larger, frozen model (e.g., GPT-4o) that actually performs the task in a sandbox environment using the provided skill.
  3. The Verifier: A deterministic program that scores the executor's performance based on the final environment state.

The Training Loop

WER uses Group Relative Policy Optimization (GRPO). For a given task, the optimizer proposes $K$ candidate skills. The frozen executor runs each skill multiple times. The verifier then provides rewards, and the optimizer is updated based on how much better or worse a specific skill performed relative to the group average.

Figure 2: Training loop. A refinement state is assembled from the task context, interaction history, and current skill, from which the Skill Optimizer samples K candidate skills (§3.1). A frozen skill-conditioned agent executes each candidate in the sandbox, producing trajectories and verifier outcomes (§3.2). The outcomes provide group-relative advantages for updating πθ (§3.3), while the skills and trajectories enter the experience buffer to assemble next-phase states (§3.4). As illustrated on the left, retained skills seed the candidates of the next round, forming a revision tree across phases. For clarity, the figure shows binary verifier rewards; the actual reward also includes the format and length terms in Eq. 4.

A key innovation is Phase-Wise Self-Bootstrapping. Instead of training on static data, WER builds a "revision tree." It specifically retains "mixed-outcome" records—cases where the same skill led to both a success and a failure. By comparing these trajectories, the optimizer learns exactly which procedural ambiguity caused the failure, progressively teaching itself to handle increasingly subtle edge cases across multiple training phases.

Datasets

The framework was evaluated on two challenging benchmarks for long-horizon tool use:

  • BFCL v4 (Berkeley Function Calling Leaderboard): Focuses on multi-turn tasks involving file systems, trading, travel, and vehicle control.
  • $\tau^2$-bench: Evaluates conversational agents in complex, stateful environments like Airline, Retail, and Telecom domains.

Key Insights and Ideas

  • Reflection is a Trainable Skill: The ability to look at a log of errors and write a "lesson learned" is a specific capability that standard pre-training doesn't optimize. WER treats this as a reinforcement learning problem.
  • Relative Credit Assignment: Because absolute task difficulty varies wildly, comparing multiple skill candidates for the same task (Group Relative) is essential to isolate the quality of the skill document from the difficulty of the environment.
  • Diagnostic Pairing: The most informative training data comes from "near misses"—trajectories where a skill almost worked. By pairing a successful run with a failed run of the same skill, the model receives a clear signal on what specific instruction was missing.
  • Small Models, Big Impact: A specialized 4B parameter optimizer can outperform general-purpose models like GPT-4o or Claude 3.5 Sonnet when it comes to this specific task of procedural refinement.

Key Results

WER demonstrated significant improvements across the board:

  • Performance Boost: On BFCL v4, WER improved the average Pass@1 rate by 7.80 points over the no-skill baseline. On $\tau^2$-bench, it saw a 3.85 point gain.
  • Optimizer Superiority: The trained 4B optimizer reached 76.63% on BFCL v4, outperforming the same backbone without training by nearly 10 points and beating all evaluated off-the-shelf models (including GPT-5.5 and Claude 4.6) used in the same role.
  • Saturation Point: The authors found that refinement gains typically saturate after two rounds of revision. Adding a third round sometimes even slightly decreased performance, suggesting a "sweet spot" for iterative refinement.
Figure 3: BFCL v4 performance trends across refine- ment depths.

Limitations and Future Work

While powerful, WER currently relies on programmatic verifiers to provide ground-truth rewards. This makes it difficult to apply to open-ended tasks where "success" is subjective or hard to code.

Additionally, the framework currently passes full, verbatim trajectories to the optimizer. As tasks become longer and more complex, these trajectories could exceed context window limits. Future work will likely explore how to summarize these execution logs or manage large skill repositories without losing the diagnostic details necessary for effective refinement.

Summary updated

BibTeX
@misc{peng2026write,
  author = {Kang Peng and Zhiwei Zhang and Yichen Zhang and Zezhong Wang and Yiming Du and Geng Tu and Baojun Wang and Bin Liang and Ruifeng Xu and Kam-Fai Wong},
  title = {{Write, Execute, Refine: From Skill Followers to Skill Optimizers via Reinforcement Learning from Execution Feedback}},
  year = {2026},
  eprint = {2608.17587},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2608.17587},
}
Figure