Manuscript Offprint
arXiv:2611.12232ECOS: Environment-Calibrated On-Policy Self-Distillation for Language Agents
Abstract
On-policy self-distillation lets a language agent act as its own Teacher by conditioning on privileged context such as skills written from its own trajectories. Its guidance, however, is weighted by how much this context shifts token likelihoods rather than by whether it improves behavior, so errors in self-written skills return through later updates. We propose environment-calibrated on-policy self-distillation, which uses environmental outcomes to decide how much to trust the Teacher's current guidance and which self-written skills to reinforce. Command-level advantages, estimated by comparing commands executed at similar observations, scale each Teacher preference and reward reflections and skills whose induced preferences favor higher-advantage commands. Without skills at inference, 3B and 7B agents reach 90.5% and 93.3% macro success on seen ALFWorld tasks and 75.5% and 80.5% success on WebShop. On unseen ALFWorld tasks, they outperform GRPO under the same protocol by 11.0 and 7.6 points. Supervising only executable commands rather than the Actor's full response raises 3B WebShop success from 52.3% to 75.0%.
1 Introduction
Large language model agents solve multi-step tasks by issuing commands and reading the resulting observations [1; 2]. Reinforcement learning (RL) trains such agents from environmental rewards, but sparse and delayed rewards say little about which intermediate decisions produced an outcome [21; 3]. On-policy distillation (OPD) adds token-level Teacher preferences along trajectories generated by the policy itself [5]. On-policy self-distillation (OPSD) obtains these preferences without a separate Teacher model: the policy acts as its
own Teacher when its context contains privileged information, such as feedback or skills summarized from earlier attempts [7; 8; 9]. When a model generates skills from its own trajectories, every update supplies supervision for subsequent learning. This creates an iterative learning loop. The performance of this loop relies on whether the self-generated supervision is reliable.
In standard OPSD, however, nothing checks whether this supervision is correct: each sampled token is weighted by how much the privileged context changes its likelihood [7], whether or not the change favors better behavior. This weighting can fail for agents in three ways. The task may exceed what the Teacher knows, and an erroneous Actor prefix may steer a capable Teacher toward the same mistake [30; 31]. Teacher reasoning may also rely on privileged information that the Actor never observes, so imitating it can weaken reasoning grounded in the Actor's own observations [32]. When the policy writes its own skills, a mistaken reflection can enter a skill and return through the next policy update.
Calibration methods regulate the local signal, align decision contexts, or tie Teacher weights to returns and policy influence [18; 12; 6; 13; 35]. Their assessment, however, does not reach the process that generates the guidance. Methods that adapt this process [14; 2; 10; 11] do not train it on whether the resulting guidance favors commands with better environmental outcomes. This raises a question for skill-based self-distillation: can a single environment-grounded criterion decide how much to trust the current Teacher and also train the analysis that builds the next one?
Our method uses command-level environmental advantages both to weight current Teacher guidance and to train the analysis that produces the next Teacher. Figure 1 illustrates the central con-
*Corresponding author: Ming Li (ming.li@u.nus.edu).

Figure 1: Environmental outcomes help check an agent's own advice. (a) Self-generated advice can carry useful lessons and mistakes into later training. (b) Our method uses observed outcomes to give useful advice more influence and conflicting advice less influence. These outcomes also train the generation of future advice. The comparison concerns how advice is assessed during training.
trast: using environmental outcomes to check self-generated advice. After supervised initialization on externally annotated reflections and skills, a single model acts in the environment (Actor), writes reflections and a consolidated skill for each trajectory group (Analyzer), and serves as the Teacher when conditioned on that skill. The advantages compare commands executed at similar observations and therefore do not depend on the Teacher. The Analyzer earns credit when its skill induces preferences for higher-advantage commands, so the Teacher's task knowledge is learned rather than assumed.
In the Actor update, each Teacher preference is scaled by its agreement with the advantage; guidance misled by an erroneous prefix loses weight without being reversed. Direct Teacher supervision covers only executable commands, so the Actor never imitates reasoning that depends on the skill, and RL trains the full response.
We evaluate on ALFWorld and WebShop with Qwen2.5-3B and 7B backbones. Across three evaluation seeds, the trained agents without skills or online analysis at inference reach 90.5% and 93.3% macro success on seen ALFWorld tasks and 75.5% and 80.5% success on WebShop. On unseen ALF-World tasks, they outperform GRPO under the same protocol by 11.0 and 7.6 points. In 3B ablations, supervision scope has the largest effect: extending Teacher supervision from commands to the
full response lowers WebShop success from 75.0% to 52.3%, and removing environmental feedback from both updates lowers ALFWorld success by 6.5 points. At the end of training, only 47–53% of the raw Teacher weight agrees with trajectory outcomes, and modulation raises this share to 57–74%. Our contributions are as follows:
-
We formulate skill-based self-distillation as a closed loop in which the policy writes the skills that condition its own Teacher, and argue that one environmental criterion should both weight current Teacher guidance and train the analysis that produces future guidance.
-
We instantiate this criterion with command-level advantages: they modulate Teacher preferences in the Actor update and reward reflections and skills in the Analyzer update, while Teacher supervision is restricted to executable commands.
-
Experiments on ALFWorld and WebShop with 3B and 7B backbones show that the trained agents outperform GRPO on unseen tasks without using skills at inference, and ablations show that command-only supervision and environmental feedback each contribute.
On-policy distillation and experience-based self-improvement. Experience-based self-improvement introduces a complementary problem: how should previous interactions become reliable guidance for later behavior? Reflection memories and reusable insights retain experience in context [24; 26]; iterative revision and trained self-correction modify subsequent responses or policy behavior [25; 27]. OPD and skill-conditioned OPSD transfer guidance along policy-generated sequences [5; 7; 9]. Shared Actor and Analyzer parameters let the policy and its analysis evolve together, as in SEED [10]. Errors in that analysis can nevertheless re-enter later updates, and models may struggle to recognize errors in their own feedback without reliable external evidence [19; 20]. We further optimize the reflections and skills according to the environmental value of the Teacher preferences they produce.
Calibration of self-generated supervision. Calibration concerns what guidance is transferred and what evidence justifies its influence. Decision-level semantic rewards can weight a full response [34]; our direct Teacher loss instead covers only executable command content. Local signal regulation, step-aware supervision, and aligned decision contexts control where and how strongly Teacher preferences enter learning [18; 12; 17; 6]. Environmental returns and objective influence provide criteria for judging their usefulness [13; 35]. For training the source of guidance, GRSD evaluates reflection quality through external assessment [14]. Our R/S credit instead evaluates a skill through agreement between its induced Teacher preferences and environmental command advantages.
3 Method
Our method jointly trains an acting policy (Actor) and a trajectory-analysis role (Analyzer). Direct Teacher supervision covers executable commands, and environmental command advantages determine its strength. Agreement between these advantages and skill-induced preferences also provides training credit for reflection and skill generation.
As shown in Figure 2, offline supervised fine-tuning (SFT) initializes reflection and skill generation in the model shared by the Actor and Analyzer. During online training, the Actor collects trajectory groups, and the Analyzer generates one reflection per trajectory and one consolidated skill per group. The skill conditions the pre-update model to form the Teacher. Joint Actor and Analyzer optimization updates the shared parameters for the next iteration.
3.1 Preliminaries and shared-policy setup
Let denote task and the shared model parameters at iteration . Each update collects task groups, with trajectories sampled from the Actor . At interaction step , the Actor generates response from history . Its executable command specifies action , after which the environment returns observation . We use for a response-token index.
GRPO derives group-relative advantages from recorded episode rewards [22]. Let contain the valid generated Actor-token indices . The likelihood ratio is
The clipped policy component of the GRPO objective is
where and sg denotes stop-gradient [16]. This token-mean objective trains the complete generated response, including reasoning. We use for this policy loss plus a frozen-reference KL penalty with coefficient 0.01 and minus an entropy bonus with coefficient 0.001. Appendix B gives the optimization settings.
The Analyzer uses the same parameter snapshot under reflection and skill-generation prompts, de-

Figure 2: Environmental feedback connects acting with Teacher construction. Offline annotations initialize reflection and skill generation through SFT. Online, reflections produce a skill , which conditions the pre-update policy to score Actor-sampled tokens. Token gaps are summed into raw command gaps ; the mean determines a shared modulation multiplier, which scales each command token's own gap. Environmental advantages calibrate this guidance and supply shared credit for reflection and skill generation. Panel (a) omits group and trajectory indices: is the observation returned after action .
noted by and . Reflection generation produces one text from each trajectory and its recorded outcome . Skill generation consolidates these reflections into one text :
For task group , the skill-conditioned Teacher is the pre-update policy evaluated with :
Both branches score the same Actor-sampled token under the same reasoning prefix. Their token-level log-probability gap is
In the sampled-token policy-gradient formulation of OPSD, the uncalibrated coefficient is the likelihood gap itself [5; 7]:
This coefficient measures how privileged context changes token support. It does not explicitly calibrate that support using the environmental value of the corresponding command.
3.2 Environmental command credit
GRPO assigns the same trajectory-level advantage to every command in an episode, so it cannot distinguish useful decisions within a failed trajectory. We estimate a separate command-level advantage by comparing commands executed at similar observations.
Commands are compared within states formed by representation-based observation grouping [23]. Within each task group, we use frozen-reference embeddings and require identical admissible-action sets. A visit joins the nearest normalized-centroid cluster within cosine distance 0.1, or creates a new cluster. Recorded commands connect these clusters through their observed successor states and rewards.
For transition , let and denote its current and successor clusters, with transition reward . We initialize from the mean observed return-to-go and apply empirical Bellman backups [33]:
where contains the recorded visits to s and . Terminal and horizon successors have value zero. The backups propagate observed downstream consequences into the values used for local comparisons.
The temporal-difference residual is
Along each recorded trajectory, generalized advantage estimation [15] propagates these residuals:
with a zero tail value. Group standardization yields the auxiliary command advantage . It supplies Teacher modulation and Analyzer credit, whereas supplies the primary GRPO update. Appendix A.2 gives the solver and normalization details.
3.3 Environment-calibrated self-distillation
Privileged skills can support executable decisions even when their associated reasoning targets are unavailable to the Actor. We therefore restrict direct Teacher supervision to command content. Let contain the positions in that encode the executable command for action , excluding delimiter tags, and let . We retain the raw summed gap for R/S credit:
The mean command gap used to compute the modulation multiplier is
with for empty command spans.
Environmental credit and the mean command gap determine a shared modulation multiplier:
(13)
with and . The multiplier lies in . Matching signs of and strengthen the guidance, and conflicting signs attenuate it without reversing individual token-gap directions. When , recovers the unmodulated token gaps. Each command shares this multiplier across its content tokens, while each token retains its own gap.
The group mask is one in ALFWorld. In WebShop, it is zero when all eight trajectories succeed and one otherwise. The resulting weights combine command-only supervision, a shared command-level multiplier, and token-specific gaps.
For likelihood ratio and signed weight w, define the clipped token loss
Using the Actor token-mean reduction, the calibrated OPSD objective is
The weights select command content, while the primary GRPO objective continues to train the complete response. Appendix A derives the modulation properties.
3.4 Credit for reflection and skill generation
Command calibration evaluates a given Teacher signal. Training the Analyzer additionally requires evaluating the reflections and skill that produced it. We assign credit according to whether the skill shifts support toward higher-advantage commands.

Figure 3: An empirical transition graph provides environmental command credit. Recorded observations are grouped into comparable state clusters, and executed commands connect them through observed transitions. Bellman evaluation estimates state values; temporal-difference residuals then enter GAE and group standardization to obtain command advantages. Colors identify observation clusters.
at comparable observations. The reflection and skill prompts are provided in Appendix B.
Within task group , let contain the deduplicated transitions with valid command spans, and write . Let be the number of represented trajectories and the number of eligible transitions in trajectory . We use
Each trajectory receives equal total weight, divided among its eligible transitions. State centering gives . This comparison measures relative command value within a cluster rather than differences in the average advantage of visited states.
The raw and bounded group credits are
Here is a weighted within-state covariance between environmental advantage and the raw summed Teacher preference . Positive credit re-inforces analysis whose Teacher relatively supports higher-advantage commands; negative credit discourages the reverse association.
Because the skill consolidates the full reflection group, all reflections and the skill receive the
same reward . For an analysis response generated under prompt , define
Let contain its valid generated-token positions. The response-sequence mean loss uses the same clipped form:
The Analyzer objective is
Reflection and skill generation each receive half of the total Analyzer weight.
3.5 Joint optimization and iterative updates
The shared model is optimized with
The GRPO term trains task behavior from environmental outcomes, the OPSD term transfers calibrated command preferences, and the R/S term trains the analysis producing those preferences. Actor and Analyzer gradients accumulate at shared optimizer steps. Teacher gaps, advantages, modulation weights, and group credits remain fixed during optimization. Appendix B gives the coefficients and optimizer settings.
The updated parameters generate the next trajectories, reflections, and skills:
(22)
Each iteration therefore updates both the acting policy and the analysis used to construct its subsequent Teacher. Algorithm 1 in Appendix A.1 summarizes the update. At inference time, the Actor uses only the ordinary interaction history.
4 Experiments
We evaluate agent performance across two environments and model sizes, followed by generalization to unseen tasks. We then examine how environmental feedback calibrates Teacher supervision and evaluates the reflections and skills that construct it. The ablation study considers initialization, supervision scope, and the two feedback paths with the 3B backbone.
4.1 Experimental setup
Benchmarks and metrics. We evaluate on ALF-World [28] and WebShop [29], which test sequential interaction in household and shopping environments. ALFWorld contains six task categories: object placement, inspection, cleaning, heating, cooling, and two-object placement. We use all 140 seen and 134 unseen evaluation tasks and report category success and its unweighted macro average. Each WebShop evaluation uses 128 tasks sampled without replacement from the 500-task held-out test set. We report exact task Success and mean normalized environment Score on a 0–100 scale.
Models and training. We use Qwen2.5-3B-Instruct and Qwen2.5-7B-Instruct as our backbones. For SFT, we collect eight trajectories for each of 200 training tasks. WebShop collection uses a policy trained for 40 GRPO updates to obtain sufficient successful and failed trajectories. GPT-6.1 sol annotates each task group with eight reflections and one consolidated skill. We fine-tune reflection and skill generation for three epochs, then train the shared Actor and Analyzer for 150 online updates. In matched-batch profiling with the 3B model, our method took approximately 30% longer than GRPO. Appendix B gives the initialization details and training hyperparameters.
Baselines. We compare training-free prompting (Vanilla and Skill-Prompt*), reward-based learning (GRPO and Skill-GRPO), and distillation-based learning (OPSD, GRPO+OPSD, Skill-SD, RLSD, SDAR, and AlignOPSD). An asterisk denotes skill-conditioned inference. Published results come from AlignOPSD Table 1 [6]; local measurements are identified separately. Published ALFWorld averages retain their source reporting conventions. Appendix C.1 describes each method.
Evaluation protocol. We evaluate our models and ablation variants at the final checkpoint after 150 online updates. The Actor receives the ordinary interaction history, without skill retrieval or online reflection and skill generation. Training uses a fixed random seed throughout. For the main and unseen-task comparisons, we evaluate each trained checkpoint under three evaluation seeds and report means and sample standard deviations. Each seed uses temperature 0.4 and one trajectory per task. ALFWorld permits at most 30 actions with history length five; WebShop permits at most 15 actions with history length two. Appendix C specifies the task panels, inference settings, and reporting conventions.
4.2 Overall agent performance
Table 1 compares the two backbones across the two environments. Our method achieved ALFWorld macro success of 90.5% and 93.3% for 3B and 7B, respectively, ranking first at both scales. WebShop Success reached 75.5% and 80.5%, ranking first at 3B and second at 7B.
The full method improves performance over GRPO. Our full training scheme combines R/S SFT initialization with online Actor and Analyzer optimization. Relative to the published GRPO baseline, this scheme improved performance at both scales and in both environments. WebShop Success increased by 12.2 and 7.9 percentage points for 3B and 7B, respectively. On ALFWorld, the improvements covered five categories at 3B and all six at 7B.
Training-time skill guidance supports deployment with ordinary histories. Skill-Prompt
Table 1: Comparison with published methods. ALFWorld reports category success and Avg.; WebShop reports Score and Success (Succ.), all on a 0–100 scale. Ours reports mean ± standard deviation over three seeds. yellow and blue mark the best and second-best results within each model size, including ties.
| Method | ALFWorld | WebShop | |||||||
|---|---|---|---|---|---|---|---|---|---|
| Pick | Look | Clean | Heat | Cool | Pick2 | Avg. | Score | Succ. | |
| Qwen2.5-3B-Instruct | |||||||||
| Vanilla | 44.4 | 11.1 | 6.2 | 15.4 | 28.6 | 12.5 | 21.9 | 6.7 | 0.8 |
| Skill-Prompt* | 51.7 | 66.7 | 48.4 | 0.0 | 4.3 | 10.0 | 28.9 | 1.2 | 0.8 |
| OPSD | 48.8 | 41.7 | 16.7 | 0.0 | 15.8 | 16.7 | 28.1 | 11.3 | 3.1 |
| GRPO | 91.2 | 62.5 | 96.2 | 61.9 | 65.0 | 47.4 | 75.0 | 79.8 | 63.3 |
| Skill-GRPO | 88.9 | 71.4 | 58.8 | 70.6 | 40.7 | 29.2 | 60.2 | 77.3 | 60.9 |
| Skill-GRPO* | 94.3 | 57.1 | 100.0 | 66.7 | 73.1 | 57.1 | 80.5 | 76.3 | 66.4 |
| GRPO+OPSD | 100.0 | 82.4 | 85.7 | 75.0 | 70.0 | 60.0 | 81.2 | 77.8 | 66.4 |
| Skill-SD | 88.2 | 50.0 | 96.2 | 52.4 | 65.0 | 57.9 | 73.4 | 75.9 | 64.0 |
| RLSD | 87.9 | 75.0 | 90.9 | 75.0 | 73.1 | 68.4 | 79.7 | 84.4 | 66.4 |
| SDAR | 94.6 | 66.7 | 68.2 | 50.0 | 60.0 | 80.0 | 74.2 | 70.7 | 57.8 |
| AlignOPSD [6] | 88.6 | 54.5 | 90.3 | 81.8 | 82.6 | 58.8 | 80.5 | 86.8 | 68.8 |
| Ours | 99.0 ± 1.6 | 82.1 ± 4.4 | 95.1 ± 2.1 | 97.9 ± 3.6 | 82.7 ± 10.1 | 86.1 ± 6.4 | 90.5 ± 1.0 | 85.5 ± 2.6 | 75.5 ± 1.9 |
| Qwen2.5-7B-Instruct | |||||||||
| Vanilla | 36.1 | 22.2 | 3.1 | 0.0 | 0.0 | 0.0 | 12.5 | 5.9 | 1.6 |
| Skill-Prompt* | 51.7 | 50.0 | 32.3 | 5.3 | 4.3 | 0.0 | 23.4 | 1.7 | 0.8 |
| OPSD | 50.0 | 60.0 | 22.7 | 21.4 | 17.6 | 9.5 | 32.8 | 4.5 | 2.3 |
| GRPO | 91.2 | 87.5 | 96.2 | 81.0 | 65.0 | 57.9 | 81.2 | 80.9 | 72.6 |
| Skill-GRPO | 88.5 | 66.7 | 65.2 | 61.1 | 57.7 | 73.1 | 69.5 | 80.4 | 71.9 |
| Skill-GRPO* | 100.0 | 83.3 | 96.4 | 83.3 | 75.0 | 78.9 | 88.4 | 87.0 | 81.2 |
| GRPO+OPSD | 91.4 | 61.5 | 100.0 | 87.5 | 76.5 | 52.2 | 80.4 | 86.8 | 76.5 |
| Skill-SD | 93.9 | 93.8 | 90.9 | 100.0 | 69.2 | 68.4 | 85.1 | 86.1 | 76.5 |
| RLSD | 100.0 | 87.5 | 92.3 | 58.8 | 80.0 | 65.2 | 82.0 | 87.4 | 77.3 |
| SDAR | 94.7 | 75.0 | 100.0 | 86.7 | 68.2 | 78.9 | 85.9 | 83.6 | 74.2 |
| AlignOPSD [6] | 70.8 | 81.8 | 100.0 | 100.0 | 76.5 | 70.8 | 89.1 | 87.9 | 78.9 |
| Ours | 100.0 | 94.9 ± 4.4 | 100.0 | 95.8 ± 3.6 | 81.3 ± 2.3 | 87.5 ± 4.2 | 93.3 ± 0.9 | 88.3 ± 1.3 | 80.5 ± 1.4 |
Published values are quoted from Table 1 of AlignOPSD [6].
supplies strategies as inference context; our Actor instead learns from skill-conditioned Teacher preferences during training. The Actor exceeded Skill-Prompt* on all six aggregate comparisons and Skill-GRPO* on five. These comparisons support transferring useful guidance into a policy evaluated with ordinary interaction histories, without skill retrieval or online analysis. The exception was 7B WebShop Success, where skill-conditioned Skill-GRPO* remained stronger.
The gains extend to unseen task instances. The unseen split tests transfer to new task instances within the same six ALFWorld categories. We retain the original interaction protocol and compare with the GRPO baseline in Table 2.
The 3B and 7B Actors improved unseen macro success over their respective GRPO baselines by 11.03 and 7.62 percentage points. The 3B model remained below GRPO on Pick and Cool and matched it on Clean. The 7B model remained below GRPO on Pick and Clean. These results suggest that training supports reusable behavioral strategies that transfer to unseen tasks. The 7B macro average was 0.74 percentage points above 3B.
4.3 Mechanistic analysis
We examine how environmental feedback shapes Actor supervision and the analysis used to construct its Teacher. Figure 4 shows how modulation redistributes Teacher weight and how R/S credit relates to the usefulness of skill-induced preferences.
Modulation shifts Teacher weight toward reward-supported directions. Reward alignment is , where is the raw or modulated Teacher weight and is the trajectory-level GRPO advantage associated with command . We count each command once. The two conditions use the same pre-update commands
Table 2: Unseen-task generalization on ALFWorld. Category success and six-category macro success (%) on all 134 unseen tasks.
| Model | Method | Pick | Look | Clean | Heat | Cool | Pick2 | Macro |
|---|---|---|---|---|---|---|---|---|
| 3B | GRPO | |||||||
| 3B | Ours | |||||||
| 7B | GRPO | |||||||
| 7B | Ours |


(c) ALFWorld

(d) WebShop

Figure 4: Environmental feedback calibrates Actor supervision and evaluates Teacher construction. (a,b) Reward alignment of Teacher supervision before and after modulation. (c,d) Return concordance of skills grouped by each task's median R/S credit.
with . The stored GRPO advantages are obtained by standardizing episode outcomes, including the 0.1 invalid-command penalty, within each task group.
We recorded nine snapshots per environment. Raw alignment on ALFWorld declined over training, but modulation maintained higher alignment at every recorded snapshot in both environments (Figure 4(a,b)). At update 150, modulation raised alignment from 47.34% to 57.16% on ALFWorld
and from 53.46% to 73.52% on WebShop, gains of 9.82 and 20.06 percentage points. The multiplier preserved preference signs and placed greater relative weight on guidance consistent with observed rewards.
R/S credit favors skills with return-consistent Teacher preferences. Return concordance compares raw Teacher–Actor command gaps with observed returns-to-go. We paired distinct commands across trajectories with identical Actor prompts and admissible-action sets. Teacher scoring retains the reasoning prefix sampled in each response. Concordant and discordant orderings score one and zero; preference ties score one-half, and return ties are excluded. The metric averages pairs within each skill and weights skills equally. Pooling saved snapshots after update 1 yielded 135 eligible ALF-World skills and 88 WebShop skills. We split each task at its median R/S credit and assigned median ties to the lower-credit group. Figure 4(c,d) shows individual skills, group means, and interquartile ranges.
Higher-credit skills achieved 65.41% concordance versus 57.83% on ALFWorld, and 55.54% versus 37.13% on WebShop. Higher R/S credit was associated with skills whose Teacher preferences better distinguished commands by their returns. Across training, success increased and interactions shortened at both model scales. Appendix D.3 presents the separate 3B and 7B curves together with modulation coverage and positive-credit skill fractions.
4.4 Ablation study
We examine SFT initialization, Teacher supervision scope, and environmental feedback with the 3B backbone on ALFWorld and WebShop. Table 3 compares the variants with the full method and the published GRPO baseline values quoted in Table 1. Our branches report seen-category macro success on ALFWorld and Score and Success on WebShop. Appendix C.5 gives the branch configurations and evaluation settings.
Table 3: Ablation study on ALFWorld and WebShop with the 3B backbone. Our ALFWorld branches report six-category macro success (140 tasks); GRPO retains the published Avg. from Table 1.
| Variant | ALFWorld | WebShop | |
|---|---|---|---|
| Macro/Avg. | Score | Success | |
| GRPO | 75.0 | 79.8 | 63.3 |
| Full method | 91.54 | 85.01 | 75.00 |
| (a) w/o SFT | 82.14 | 81.89 | 69.53 |
| (b) Full-response supervision | 89.88 | 75.62 | 52.34 |
| (c) w/o modulation and R/S loss | 85.00 | 82.10 | 72.65 |
SFT provides a useful starting point for online analysis. Variant (a) tests whether the online loop can learn effectively without initial trajectory-analysis SFT. The no-SFT variant still exceeded GRPO on WebShop by 6.23 percentage points
in Success. SFT provided further gains: the full method exceeded this variant by 9.40 percentage points on ALFWorld and 5.47 on WebShop Success. The residual gain without SFT and the further gain with SFT suggest that initialization and online guidance contribute at different stages.
Command-only supervision outperforms full-response matching. Variant (b) tests whether matching Teacher reasoning adds value beyond supervising executable commands. Extending the loss to the full response reduced ALFWorld macro success by 1.66 percentage points and WebShop Success by 22.66 percentage points. The Teacher's reasoning uses privileged skills unavailable to the Actor, so these additional targets can impose context-specific preferences. The comparison favors transferring executable decisions through the Teacher objective and retaining environmental RL for the Actor's complete response.
Environmental feedback improves skill-guided learning. Variant (c) retains command-only Teacher supervision and online reflection and skill generation in both environments. It removes only environmental modulation and the direct R/S objective. It reached 85.00% ALFWorld macro success and 72.65% WebShop Success, with a WebShop Score of 82.10. The full method improved macro success and WebShop Success by 6.54 and 2.35 percentage points, respectively. This joint ablation supports the combined value of environmental modulation and R/S learning.
5 Discussion
The skill diagnostics provide a second view of improvement beyond final task success. Higher-credit skills induced preferences that better distinguished commands by their returns in both environments. This association supports evaluating a generated lesson through the decisions it favors. It also motivates tracking the usefulness of self-generated advice as the policy and its experience change over training.
Evaluation without skills and the supervision-scope ablation show that useful behavior can transfer from privileged experience to an Actor operating with ordinary observations. The gap between command-only and full-response supervision was larger on WebShop than on ALFWorld. This difference suggests that the choice of supervision targets matters across environments. The results favor transferring decisions that remain executable with the information available to the Actor at deployment.
6 Conclusion
We introduced ECOS to connect agent learning with the supervision generated from its own interaction experience. The approach transfers skill-conditioned guidance through executable commands and retains reinforcement learning over the complete response. Environmental feedback links the weighting of Teacher preferences to the optimization of reflection and skill generation. Experiments on ALFWorld and WebShop show improvements over reward-based baselines at both model scales, together with transfer to unseen ALFWorld tasks. The evaluated Actor requires no privileged skills or online analysis at deployment. Mechanistic diagnostics show improved reward alignment of supervision and more return-consistent guidance among higher-credit skills. Within the tested settings, environmental outcomes provide a shared criterion for policy improvement and the generation of future supervision.
Limitations
Our environmental credit depends on estimated command values and comparisons between observations. Sparse rewards or imperfect state matching can bias both Actor and Analyzer updates. The current diagnostics characterize agreement on recorded experience and do not independently establish improvements in Teacher capability or reasoning quality. SFT initialization relies on annotations from an external model. Evaluation covers two text-based environments and Qwen2.5 backbones at 3B and 7B. Transfer to substantially longer self-improvement runs remains untested. Reflection and skill generation, together with Teacher rescoring, also introduce training overhead. Independent skill evaluations and longer controlled runs would clarify whether improved task performance accompanies sustained improvements in the supervision the model produces.
References
[1] Zhentao Zhang et al. State-OPD: State-Grounded On-Policy Distillation for Multi-Turn Agents. arXiv:2610.13238, 2026. Reference version: v1, 9 October 2026. https://arxiv.org/abs/2610.13238v1.
[2] Hangxi Guo, Fengyuan Liu, Yue Wang, Yuhua Qi, Haoyi Xiong, Fei Sun, and Mengnan Du. Environmental Feedback Modeling Matters: Rethinking Feedback Treatment in Agentic Hindsight Self-Distillation. arXiv:2610.11384, 2026. https://arxiv.org/abs/2610.11384.
[3] Lang Feng, Zhenghai Xue, Tingcong Liu, and Bo An. Group-in-Group Policy Optimization for LLM Agent Training. arXiv:2505.10978, 2025. Reference version: v3, 28 October 2025. https://arxiv.org/abs/2505.10978v3.
[4] Yuyao Zheng et al. PGPO: Potential-Guided Policy Optimization for Multi-Turn Agentic Tasks. arXiv:2609.02236, 2026. Reference version: v1, 2 September 2026. https://arxiv.org/abs/2609.02236v1.
[5] Rishabh Agarwal, Nino Vieillard, Yongchao Zhou, Piotr Stanczyk, Sabela Ramos, Matthieu Geist, and Olivier Bachem. On-Policy Distillation of Language Models: Learning from Self-Generated Mistakes. International Conference on Learning Representations, 2024. https://arxiv.org/abs/2306.13649.
[6] Mingju Chen, Can Lv, Jinrong Liu, Huan Zhang, Heng Chang, and Shiji Zhou. Beyond Timestamps: Decision-Aligned On-Policy Distillation for Long-Horizon Agents. arXiv:2609.33391, 2026. Reference version: v1, 27 September 2026. https://arxiv.org/abs/2609.33391v1.
[7] Siyan Zhao, Zhihui Xie, Mengchen Liu, Jing Huang, Guan Pang, Feiyu Chen, and Aditya Grover. Self-Distilled Reasoner: On-Policy Self-Distillation for Large Language Models. arXiv:2601.18734, 2026. https://arxiv.org/abs/2601.18734.
[8] Jonas Hübotter et al. Reinforcement Learning via Self-Distillation. arXiv:2601.20802, 2026. https://arxiv.org/abs/2601.20802.
[9] Hao Wang et al. Skill-SD: Skill-Conditioned Self-Distillation for Multi-turn LLM Agents. arXiv:2604.10674, 2026. https://arxiv.org/abs/2604.10674.
[10] Jinyang Wu et al. SEED: Self-Evolving On-Policy Distillation for Agentic Reinforcement Learning. arXiv:2607.14777, 2026. Reference version: v1, 16 July 2026. https://arxiv.org/abs/2607.14777.
[11] Yinghui He et al. Self-Distillation Zero: Self-Revision Turns Binary Rewards into Dense Supervision. arXiv:2604.12002, 2026. https://arxiv.org/abs/2604.12002.
[12] Chunji Lv, Yangguang Wei, Junlin Liu, Yang Gao, Ming Liu, Xinming Wang, Jinyang Wu, Guoren Wang, and Changsheng Li. PCSD: Persistent Consistency for Self-Distillation in Agentic Reinforcement Learning. arXiv:2608.01837, 2026. https://arxiv.org/abs/2608.01837.
[13] Ranxu Zhang et al. Agentic Reinforcement Learning with Self-Distilled Reward Shaping. arXiv:2608.03223, 2026. https://arxiv.org/abs/2608.03223.
[14] Binbin Zheng, Zijun Xie, Guanqun Zhao, Enlei Gong, Xing Ma, Xiaoliang Fu, and Zeyu Chen. Group-Reflective Self-Distillation for Agentic Reinforcement Learning. arXiv:2607.28076, 2026. Reference version: v2, 3 August 2026. https://arxiv.org/abs/2607.28076.
[15] John Schulman, Philipp Moritz, Sergey Levine, Michael Jordan, and Pieter Abbeel. High-Dimensional Continuous
Control Using Generalized Advantage Estimation. arXiv:1506.02438, 2015. https://arxiv.org/abs/1506.02438.
[16] John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal Policy Optimization Algorithms. arXiv:1707.06347, 2017. https://arxiv.org/abs/1707.06347.
[17] Yanfei Zhang, Xu Lin, and Chenglin Wu. StepOPSD: Step-Aware Online Preference Self-Distillation for Agent Reinforcement Learning. arXiv:2605.27140, 2026. Reference version: v2, 26 August 2026. https://arxiv.org/abs/2605.27140v2.
[18] Zhengxi Lu et al. Self-Distilled Agentic Reinforcement Learning. arXiv:2605.15155, 2026. Reference version: v1, 14 May 2026. https://arxiv.org/abs/2605.15155.
[19] Jie Huang, Xinyun Chen, Swaroop Mishra, Huaixiu Steven Zheng, Adams Wei Yu, Xinying Song, and Denny Zhou. Large Language Models Cannot Self-Correct Reasoning Yet. International Conference on Learning Representations, 2024. https://arxiv.org/abs/2310.01798.
[20] Dongwei Jiang, Jingyu Zhang, Orion Weller, Nathaniel Weir, Benjamin Van Durme, and Daniel Khashabi. SELF-[IN]CORRECT: LLMs Struggle with Discriminating Self-Generated Responses. Proceedings of the AAAI Conference on Artificial Intelligence, 2025. https://ojs.aaai.org/index.php/AAAI/article/view/34603.
[21] Jose A. Arjona-Medina, Michael Gillhofer, Michael Widrich, Thomas Unterthiner, Johannes Brandstetter, and Sepp Hochreiter. RUDDER: Return Decomposition for Delayed Rewards. Advances in Neural Information Processing Systems, 2019. https://arxiv.org/abs/1806.07857.
[22] Zhihong Shao et al. DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models. arXiv:2402.03300, 2024. https://arxiv.org/abs/2402.03300.
[23] Hanyang Wang, Weijieying Ren, Yuxiang Zhang, Ding Cao, Zhizhao Zeng, Ke Zeng, and Tianxiang Zhao. BiPACE: Bisimulation-Guided Policy Optimization with Action Counterfactual Estimation for LLM Agents. arXiv:2606.25556, 2026. https://arxiv.org/abs/2606.25556.
[24] Noah Shinn, Federico Cassano, Ashwin Gopinath, Karthik Narasimhan, and Shunyu Yao. Reflexion: Language Agents with Verbal Reinforcement Learning. Advances in Neural Information Processing Systems, 2023. NeurIPS 2023 proceedings.
[25] Aman Madaan et al. Self-Refine: Iterative Refinement with Self-Feedback. Advances in Neural Information Processing Systems, 2023. https://arxiv.org/abs/2303.17651.
[26] Andrew Zhao, Daniel Huang, Quentin Xu, Matthieu Lin, Yong-Jin Liu, and Gao Huang. ExpeL: LLM Agents Are Experiential Learners. Proceedings of the AAAI Conference on Artificial Intelligence, 2024. https://ojs.aaai.org/index.php/AAAI/article/view/29936.
[27] Aviral Kumar et al. Training Language Models to Self-Correct via Reinforcement Learning. International Conference on Learning Representations, 2025. https://arxiv.org/abs/2409.12917.
[28] Mohit Shridhar et al. ALFWorld: Aligning Text and Embodied Environments for Interactive Learning. International Conference on Learning Representations, 2021. https://arxiv.org/abs/2010.03768.
[29] Shunyu Yao et al. WebShop: Towards Scalable Real-World Web Interaction with Grounded Language Agents. Advances in Neural Information Processing Systems, 2022. https://arxiv.org/abs/2207.01206.
[30] Kaixiang Zhao et al. Recovering Reliable Supervision via Critique-Guided On-Policy Distillation. arXiv:2610.20572, 2026. Reference version: v1, 14 October 2026. https://arxiv.org/abs/2610.20572v1.
[31] Siqi Zhu, Xuyan Ye, Hongyu Lu, Weiye Shi, and Ge Liu. The Many Faces of On-Policy Distillation: Pitfalls, Mechanisms, and Fixes. arXiv:2605.11182, 2026. https://arxiv.org/abs/2605.11182v1.
[32] Samyak Shrestha and Alexander Tessier. Rethinking Privileged Information in On-Policy Self-Distillation. arXiv:2608.18271, 2026. https://arxiv.org/abs/2608.18271v1.
[33] Hongxi Yan, Ziyue Huang, Shichao Fan, and Qingjie Liu. Gated-BEPO: Confidence-Gated Bellman Credit Assignment for Large Language Model Agents. arXiv:2608.06861, 2026. https://arxiv.org/abs/2608.06861.
[34] Huining Yuan et al. ActionOPD: Distilling Decisions, Not Tokens. arXiv:2610.19820, 2026. Reference version: v1, 14 October 2026. https://arxiv.org/abs/2610.19820v1.
[35] Qizhen Lan et al. Trust Is Not Enough: Influence Calibration for On-Policy Self-Distillation in Agentic RL. arXiv:2608.14945, 2026. https://arxiv.org/abs/2608.14945.
Appendix
The supplementary material follows the main paper's evidence chain: method details (Appendix A), implementation and prompts (Appendix B), evaluation protocol (Appendix C), and mechanistic analyses and training dynamics (Appendix D).
A Supplementary method details
A.1 Training algorithm
Algorithm 1 summarizes offline initialization and the recurring online update. One pre-update snapshot supplies the Actor, reflection generator, skill generator, and skill-conditioned Teacher. The environmental estimator is detailed in Appendix A.2.
Algorithm 1 ECOS training
Require: Initial policy ; offline R/S annotations ; task sampler and environments; frozen reference encoder; group size ; estimator and optimization settings
Ensure: Trained Actor for inference with ordinary interaction histories
1: Initialize shared parameters by R/S SFT on .
2: for each online iteration do
3: Freeze snapshot ; sample task batch ; set .
Construct experience, Teacher guidance, and credit without gradients.
4: for each task do
5: Collect trajectories using .
6: Record histories, responses, commands, rewards, outcomes, and old token log probabilities.
7: Compute the outcome-based GRPO advantages within task group .
8: Sample reflections for all .
9: Sample one skill .
10: Record R/S prompts and pre-update log probabilities of their sampled responses.
11: Cluster observations using reference embeddings and identical admissible-action sets.
12: Build the transition graph; obtain by Bellman evaluation, GAE, and normalization.
13: Compute on the same response and Actor prefix, with/without (Equation 6).
14: Parse command positions ; set .
15: Set and ; use zero for empty spans.
16: Set for an all-success WebShop group and otherwise.
17: .
18: .
19: Compute transition weights and state means (Equation 16).
20: .
21: Assign to all reflections and the skill; add the group's records to .
22: end for
Update the shared Actor and Analyzer.
23: Form on all valid Actor tokens and on commands using .
24: Form from credits , with equal total weight for R and S (Equation 20).
25: (Equation 21).
26: Optimize over scheduled minibatches with accumulated Actor and Analyzer gradients.
27: end for
28: return using ordinary histories at inference.
All old log probabilities, advantages, Teacher gaps, modulation weights, and R/S credits remain fixed during optimization. The next iteration regenerates experience and analysis using the updated parameters.
A.2 Environmental advantage estimation
The estimator uses the representation-based grouping and empirical Bellman evaluation described in Section 3.2 [23; 33]. Visits are processed in trajectory and turn order after duplicate padding rows are removed. Only visits with identical sorted admissible-action sets can share a cluster. Normalized frozen-reference embeddings join the nearest normalized-centroid cluster at cosine distance at most 0.1; otherwise they form a new cluster.
Recorded commands define graph edges and retain the successor observation and environmental reward. Rewards include the configured invalid-action penalty of 0.1. Initial values are mean observed returns-to-go within each cluster. Equation 8 uses and runs for at most twenty backups, stopping when the largest value change is below . Terminal and horizon successors have value zero.
The TD residuals enter the GAE recursion in Equation 10, with . After conversion to float32, group normalization subtracts the mean and divides by the standard deviation plus . Groups with standard deviation at most receive zero auxiliary advantage. Clusters require at least two distinct observed commands to contribute command credit. This estimator supplies the auxiliary calibration and Analyzer terms; trajectory-level GRPO retains its own outcome advantage.
A.3 Modulation and state-centered credit
For and , Equation 13 satisfies
For , the multiplier exceeds one when and is below one when . A zero environmental advantage gives . Command-level agreement therefore amplifies token-level guidance, while command-level conflict attenuates it. The shared nonnegative multiplier does not reverse individual token-gap directions.
Let and let be the corresponding weighted mean of the raw summed command gaps. Since the centered advantages sum to zero within a cluster,
The credit therefore rewards relative support for higher-advantage commands within comparable states. Adding the same constant to all command gaps in a cluster leaves unchanged. A cluster with no advantage variation contributes zero. Each trajectory has equal total weight, and its eligible commands divide that weight equally. Clipping to gives the reward used by both analysis stages.
B Implementation and training
B.1 Stage 1: supervised initialization of reflection and skill generation
Stage 1 trains the policy to produce reflections and reusable skills before entering the online loop. It consists of offline trajectory collection, annotation, and supervised fine-tuning.
Offline trajectory collection. Each task-specific dataset contains 200 training tasks with eight sampled trajectories per task, giving 1,600 trajectories. We retain the task instruction, executed commands, observations, and recorded outcome of each attempt. ALFWorld uses the corresponding Qwen2.5 instruction-tuned backbone for both collection and SFT initialization. For WebShop, we collect trajectories from RL40 policies to obtain sufficient successful and failed examples for SFT. The 3B run starts SFT from Qwen2.5-3B-Instruct, whereas the 7B run uses its GRPO40 policy for both fresh trajectory collection and SFT initialization.
Reflection and skill annotation. An external annotator reads each task and its recorded interaction, then writes a reflection grounded in the actions, observations, and outcome. Successful and failed attempts provide examples of useful decisions and mistakes to correct, respectively. The eight reflections are then supplied together with the task to produce one consolidated skill. This yields 1,600 reflection targets and 200 skill targets per dataset. All offline annotations use GPT-6.1 sol with maximum reasoning effort. Appendix B.3 shows the R/S prompt structure and recorded examples.
Supervised examples and optimization. Each task group contributes nine input-target pairs. A reflection input contains the task and one recorded trajectory with its outcome; the target is that trajectory's annotated reflection. The skill input contains the task and all eight annotated reflections; its target is the consolidated skill. We apply the backbone's chat template and train with teacher forcing over the saved target tokens. Task instructions and interaction histories supply conditioning context, while the loss covers the reflection or skill target.
For a target sequence with input , let denote its mean autoregressive negative log-likelihood. For task group , the offline reflection and skill targets are and . The task-group objective is
Thus the eight reflections jointly receive half of the group weight and skill synthesis receives the other half. Gradients from all nine examples accumulate before one optimizer update. We fine-tune all parameters for three epochs, shuffling task groups each epoch, for a total of 600 updates. The resulting SFT600 weights initialize the shared Actor and Analyzer in Stage 2. Table B.1 summarizes the optimization settings.
Table B.1: Stage 1 SFT settings, shared across the four task/model configurations.
| Hyperparameter | Value |
|---|---|
| Training tasks / trajectories per task | 200 / 8 |
| Supervised targets | 1,600 reflections and 200 skills |
| Batch per optimizer update | 1 task group: 8 reflections and 1 skill |
| Reflection / skill loss weights | 0.5 / 0.5 |
| Epochs / optimizer updates | 3 / 600 |
| Trainable parameters | Full model |
| Optimizer | AdamW |
| Learning rate | |
| Adam () / | |
| Weight decay / gradient norm limit | 0 / 1.0 |
| Learning-rate schedule / warmup | Constant / 0 steps |
| Parameter and optimizer precision | FP32 |
| Forward-pass precision | BF16 autocast |
| Training seed | 0 |
B.2 Stage 2: online optimization
The SFT-initialized policy collects new trajectories and generates its own reflections and skills at each online update. Environmental command credit calibrates Teacher supervision and supplies the R/S reward; Actor and Analyzer gradients accumulate in the shared optimizer. Table B.2 consolidates the checkpoint, optimization, Teacher, and R/S settings for both model sizes.
Table B.2: Online-training hyperparameters for the 3B and 7B models.
| Shared optimization | |
|---|---|
| Parameter | Value |
| Online updates (final checkpoint) | 150 |
| Task groups per update | 16 |
| Rollouts per group | 8 |
| Optimizer | AdamW |
| Learning rate | |
| Adam () | (0.9, 0.999) |
| Adam | |
| Weight decay | 0.01 |
| Gradient norm limit | 1.0 |
| Learning-rate schedule | Constant |
| Warmup steps | 0 |
| PPO epochs | 1 |
| PPO clipping ratio | 0.2 |
| Reference KL coefficient | 0.01 |
| Entropy coefficient | 0.001 |
| Actor loss reduction | Token mean |
| Teacher and R/S learning | |
|---|---|
| Parameter | Value |
| Teacher coefficient | 0.01 |
| Supervised tokens | Command content |
| Modulation strength | 1 |
| Modulation temperature | 0.5 |
| Multiplier range | [0, 2] |
| Discount factor | 0.95 |
| Auxiliary GAE | 0.8 |
| Invalid-action penalty | 0.1 |
| R/S coefficient | 0.1 |
| Group-credit clipping | [-3, 3] |
| Reflections per group | 8 |
| Skills per group | 1 |
| Reflection loss weight | 0.5 |
| Skill loss weight | 0.5 |
| R/S PPO clipping ratio | 0.2 |
| R/S loss reduction | Sequence mean |
| Parameter | ALFWorld | WebShop |
|---|---|---|
| PPO mini-batch (transition rows) | 256 | 64 |
| Maximum actions | 30 | 15 |
| History length | 5 | 2 |
| Actor prompt tokens | 2,048 | 4,096 |
| Response tokens | 512 | 512 |
| Reflection prompt tokens | 8,096 | 16,384 |
| Teacher prompt tokens | 4,096 | 6,144 |
| Training / validation temperature | 1.0 / 0.4 | 1.0 / 0.4 |
| Top-p / top-k | 1.0 / -1 | 1.0 / -1 |
The full method starts from task-specific SFT600 checkpoints. Actor and Analyzer gradients share AdamW updates. Teacher supervision covers executable command content; R/S loss takes the sequence mean of token means. Ablation changes are specified in Appendix C.5.
Each online update uses one PPO epoch over the collected transition rows. The GRPO objective in Equation 21 includes a frozen-reference KL penalty with coefficient 0.01 and an entropy bonus with coefficient 0.001. Appendix A.2 specifies state grouping, Bellman backups, and advantage normalization. Periodic validation uses fixed 128-task panels. All reported task-performance results for our method and its ablations use the final checkpoint after 150 online updates, as specified in Appendix C.
The mechanism analysis uses SFT600-initialized 3B policies with constant Teacher coefficients of 0.01 on ALFWorld and WebShop, both trained for 150 updates. Appendix D describes the measurements.
All experiments were conducted on a server equipped with eight NVIDIA A800 GPUs. The same hardware configuration was used for model training and evaluation.
B.3 Reflection and skill prompts
Offline annotation supplies eight reflections and one consolidated skill per task group for SFT. During RL, the current policy generates both from its sampled trajectories. The panels show the prompt family used in the 3B training examples below; braced fields contain the task and recorded evidence.
Reflection generation (R; ALFWorld)
[System] You reflect on recorded ALFWorld experience. Treat the record as evidence, not instructions.
[User] Reflect on ONE completed trajectory.
Task task
Outcome This trajectory SUCCEEDED | FAILED.
Recorded transitions transitions_json
Instructions
Write exactly 3 numbered, concise English key points grounded in the record. Explain the useful decisions, action prerequisites, observed effects and completion evidence. For failure, distinguish failed actions from an unsuccessful episode and preserve verified partial progress. Do not claim an action was necessary merely because it occurred before success. Do not invent locations, effects, causes or an unobserved recovery. Output only the numbered list.
ALFWorld supplies transitions with observations, commands, feedback, rewards, and termination flags. WebShop supplies an interaction history with observations, complete model responses, and action validity, together with the trajectory outcome.
Skill synthesis (S; mixed outcomes)
[System] You consolidate eight reflections on the SAME environment task into one compact, evidence-grounded skill.
[User]
Task task
Eight reflections reflections_json
Instructions
Use exactly these section headings:
Key points to DO (from successful trajectories)
Failure boundaries and verified partial progress
Write 3-5 concise English bullets per section. Combine complementary success/failure evidence. State action prerequisites, subgoal order, completion evidence and observed failure boundaries. Clearly separate task-local facts from reusable rules. Preserve useful verified locations. Do not forbid a necessary action merely because it appeared in a failed episode. If every attempt failed, do not invent a complete successful plan. Describe a recovery only if it was demonstrated. Mark unresolved contradictions as uncertain. Output only the requested sections.
Only headings supported by the group’s outcomes are included. The generated skill is prepended as [Privileged Skill Information] for Teacher scoring.
The examples below show verbatim R/S excerpts from two command-only 3B training groups, each with four successes among eight trajectories. The corresponding interaction traces retain every executed action; omitted observation and reasoning text is marked by [. . .].
ALFWorld example (3B; training snapshot 117)
[Task]
heat some mug and put it in coffeemachine.
[Reflection R: successful trajectory, excerpt]
-
The mug was located on countertop 1 and successfully picked up.
-
The microwave was initially closed; after opening it, the mug was successfully heated with the microwave.
-
Moving the mug to coffeemachine 1 produced reward 10.0 and 'done: true', confirming task completion.
[Reflection R: failed trajectory, excerpt]
- The episode failed overall because no mug was found or heated; the final placement remained unverified. No mug was observed, only cup 3, and partial progress did not complete the task.
[Skill S, excerpts]
Key points to DO (from successful trajectories)
-
Task-local: find and take mug 1 from countertop 1.
-
Task-local: go to microwave 1, open it if closed, then heat the held mug.
-
Task-local: go to coffeemachine 1, and move the heated mug there.
Failure boundaries and verified partial progress
- Cup 3 was successfully heated in a microwave, but it is not a mug and did not complete the task.
WebShop example (3B; training snapshot 120)
[Task]
Find me women's dresses with polyester spandex for daily wear with color: red, and size: large, and price lower than 40.00 dollars.
[Reflection R: successful trajectory, excerpt]
-
The agent combined women's, polyester/spandex, dress, daily use, red, large, and <$40 into a targeted search.
-
The valid "Buy Now" action is followed by the task-validated SUCCEEDED outcome; no checkout details or unobserved purchase confirmation are claimed.
[Reflection R: failed trajectory, excerpt]
- Polyester-spandex composition, daily wear suitability, and a qualifying large-red price below $40 were never verified. The detail page described the item as a tunic T-shirt dress, with colors and sizes listed but no evidence either was selected.
[Skill S, excerpts]
Key points to DO (from successful trajectories)
-
Task-local: search with the combined attributes, then open B08ZRR3DZT; its displayed price was 27.99, below $40.
-
Reusable: verify product or feature text for material and use, then select red and large before checkout.
Failure boundaries and verified partial progress
-
B09M63B87V was only a targeted candidate lead, not evidence of met constraints.
-
Polyester-spandex, daily-wear suitability, and a qualifying large-red price below $40 were never visibly confirmed.
Figures B.1 and B.2 show the successful interactions behind the R/S examples above.
| ALFWorld trajectory (3B; training snapshot 117) |
|---|
| Task: heat some mug and put it in coffeemachine.[Step 1]Observation: [...] You are in the middle of a room. Looking quickly around you, you see [...] a coffeemachine 1, a countertop 2, a countertop 1, [...] a microwave 1, [...]Reasoning: [...] To proceed, the agent must first locate and take a mug; then it may use a tool such as the microwave to heat it.Action: go to countertop 1[Step 2]Observation: You arrive at countertop 1. On the countertop 1, you see [...] a mug 1, [...]Reasoning: [...] The order is: take mug 1, go to microwave 1, heat mug, go to coffeemachine 1, and put mug in it.Action: take mug 1 from countertop 1[Step 3]Observation: You pick up the mug 1 from the countertop 1.Reasoning: [...] We have already taken mug 1 from countertop 1; now it is in inventory. [...] Next, we need to heat the mug. [...]Action: go to microwave 1[Step 4]Observation: You arrive at microwave 1. The microwave 1 is closed.Reasoning: [...] First, open the microwave: the appliance should be opened before placing the mug inside. [...]Action: open microwave 1[Step 5]Observation: You open the microwave 1. The microwave 1 is open. In it, you see nothing.Reasoning: [...] The required heating action is 'heat mug 1 with microwave 1', which is admissible. [...]Action: heat mug 1 with microwave 1[Step 6]Observation: You heat the mug 1 using the microwave 1.Reasoning: [...] The microwave was then successfully used to heat mug 1. The next required action is to put this heated mug into coffeemachine 1. [...]Action: go to coffeemachine 1[Step 7]Observation: You arrive at coffeemachine 1. On the coffeemachine 1, you see nothing.Reasoning: [...] The coffeemachine was reached and confirmed empty, so it is a logical target for the heated mug.Action: move mug 1 to coffeemachine 1[Final environment feedback]You move the mug 1 to the coffeemachine 1.Recorded outcome: SUCCEEDED; reward = 10.0; done = true. |
Figure B.1: ALFWorld training trajectory. The Actor locates a mug, heats it, and places it in the coffeemachine. The environment confirms completion after seven actions.
WebShop trajectory (3B; training snapshot 120)
Task: Find me women's dresses with polyester spandex for daily wear with color: red, and size: large, and price lower than 40.00 dollars.
[Step 1]
Observation: 'Search'
Reasoning: [...] Let's open a search first and refine the query: 'women's polyester/spandex dress daily red large under $40'. This generates a focused search and is the appropriate next action.
Action: search[women's polyester/spandex dress daily red large under $40]
[Step 2]
Observation: [...] 'Page 1 (Total results: 50)' [...] 'B08ZRR3DZT' [SEP] 'SheIn Women's Sexy One Shoulder Sleeveless Cutout Mini Club Pencil Bodycon Dress' [SEP] '27.99' [...]
Reasoning: [...] This confirms a promising candidate, whose price range is below $40. The click needs to open this product page before making further judgments.
Action: click[b08zrr3dzt]
[Step 3]
Observation: [...] 'size' [SEP] [...] 'large' [SEP] [...] 'color' [SEP] [...] 'red' [SEP] [...] 'Price: 27.99' [...] 'Buy Now'
Reasoning: [...] The admissible actions mention red and large, so one of those is still appropriate.
Action: click[large]
[Step 4]
Observation: [...] 'size' [SEP] [...] 'large' [SEP] [...] 'color' [SEP] [...] 'red' [SEP] [...] 'Price: 27.99' [...] 'Buy Now'
Reasoning: [...] It needs to select large and red as required variants before checkout. The only action taken was choosing large, so only action options are available.
Action: click[red]
[Step 5]
Observation: [...] 'size' [SEP] [...] 'large' [SEP] [...] 'color' [SEP] [...] 'red' [SEP] [...] 'Price: 27.99' [...] 'Buy Now'
Reasoning: You have already selected Large and Red on the SheIn dress, and the agent checks the displayed range of 27.99, which is below $40. [...] The observation contains Large and Red elements, so it supports the size and color selection, but the displayed price needs further confirmation.
Action: click[buy now]
[Final environment feedback]
Thank you for shopping with us! [...] Purchased [SEP] asin [SEP] B08ZRR3DZT [SEP] options [SEP] {"color": "red", "size": "large"} [...] Your score (min 0.0, max 1.0) [SEP] 1.0 [...]
Recorded outcome: SUCCEEDED; reward = 10.0; done = true.
Figure B.2: WebShop training trajectory. The Actor searches for a dress, opens a product, selects large and red, and purchases it. The terminal feedback records the selected options and a score of 1.0.
B.4 Token masks and joint optimization
Command-content masks select the parsed command span, excluding reasoning, delimiter tags, observations, and padding. The primary policy loss and regularization use all valid generated response tokens. Teacher scoring retains the Actor's sampled reasoning prefix. Only command tokens receive the direct OPSD term. The mean command gap determines a shared modulation multiplier, which scales each command token's own gap , with the same token-mean loss reduction.
Analyzer credit uses raw summed command gaps before modulation. Equation 20 gives equal total weight to reflection and skill generation and averages each generated sequence over its own valid tokens. Zero-credit groups remain in the fixed group denominator. Actor and Analyzer gradients share the scheduled AdamW updates, with no additional R/S optimizer steps.
C Baselines, benchmarks, and evaluation setting
C.1 Baseline details
Table 1 compares Qwen2.5-3B-Instruct and Qwen2.5-7B-Instruct models. We summarize the baseline variants reported by AlignOPSD [6]. An asterisk denotes retrieved-skill access at inference; unmarked methods receive only the task prompt and interaction history.
-
Vanilla. The instruction-tuned backbone acts directly in the environment without additional task-specific training.
-
Skill-Prompt*. A retrieved task-relevant skill is added to Vanilla’s context at validation and test time.
-
GRPO [22]. Terminal rewards are normalized within each task group to obtain trajectory advantages, which supervise the sampled response tokens without a learned critic.
-
Skill-GRPO / Skill-GRPO*. Both variants condition GRPO training on retrieved skills. Evaluation removes the skills for Skill-GRPO and retains them for Skill-GRPO*.
-
OPSD [7]. A privileged-context Teacher re-scores tokens from student-generated trajectories, providing detached token-level supervision. The student learns to reproduce these preferences using its ordinary interaction context.
-
GRPO+OPSD. A joint objective combines terminal-reward GRPO advantages with token-level supervision from the privileged-context Teacher.
-
Skill-SD [9]. Skills condition the Teacher alone, and importance-weighted distillation transfers its guidance to the acting policy.
-
RLSD. Teacher–Student information produces a bounded scaling coefficient for GRPO updates. The outcome advantage determines the direction of each scaled update.
-
SDAR [18]. A gate regulates an auxiliary self-distillation loss alongside GRPO, while the original environmental advantage estimate is retained.
-
AlignOPSD [6]. Cross-rollout decision correspondence rectifies Teacher supervision, while adaptive decision spans and hierarchical credit assignment allocate the resulting guidance.
-
Ours. Task-specific R/S SFT initializes a shared Actor and Analyzer. Environmental command advantages calibrate signed Teacher preferences on executable command tokens. State-centered credit trains reflections and skills, linking Teacher construction to subsequent policy updates. Inference uses the trained Actor with the ordinary task prompt and interaction history.
The published baseline values are taken from AlignOPSD Table 1 [6]. Appendix B specifies our initialization and training settings; the following subsections describe our task panels, inference settings, and reporting conventions.
C.2 Task panels and metrics
ALFWorld evaluation covers all 140 seen and 134 unseen tasks. Table C.1 gives the six category sizes. If of tasks succeed in category , macro success is . Each category therefore contributes equally. Success is determined by the first terminal environment outcome.
Table C.1: ALFWorld evaluation tasks by category.
| Split | Pick | Look | Clean | Heat | Cool | Pick2 | Total |
|---|---|---|---|---|---|---|---|
| Seen | 35 | 13 | 27 | 16 | 25 | 24 | 140 |
| Unseen | 24 | 18 | 31 | 23 | 21 | 17 | 134 |
WebShop uses 128 goals sampled without replacement. Our repeated evaluations draw a 128-goal panel for each evaluation seed; methods using the same seed share the panel. The catalogue seed remains 0, with the training-compatible search index of 1,000 products. Success is the percentage of tasks completed fully. Score is the mean normalized terminal environment reward multiplied by 100, capturing partial satisfaction of the requested product attributes.
C.3 Inference settings
Evaluation uses temperature 0.4, top-, top-, and one trajectory per task. The Actor receives the ordinary task prompt and interaction history, without appended skills or online R/S generation. ALFWorld allows at most 30 actions with history length five; WebShop allows at most 15 actions with history length two. Prompt and response limits follow Appendix B. Infrastructure errors are recorded separately from completed task failures.
C.4 Reporting conventions
All task-performance results for our method and its ablations use the final checkpoint after 150 online updates. The 134-task unseen split is used only for final evaluation.
All training runs use a fixed random seed. After training, each checkpoint is evaluated under three evaluation seeds, and we report the mean and standard deviation in Tables 1 and 2.
The local GRPO baselines in Table 2 use the same initialization, task sampling, rollout budget, Actor optimization settings, and evaluation protocol as the full method in Table B.2. Their online updates optimize alone, including the same reference-policy KL penalty and entropy bonus, for 150 updates. They are evaluated on the same unseen task panel with the same inference settings as our models.
The GRPO row in Table 3 repeats the published baseline values quoted in Table 1. Published baseline numbers come from Table 1 of AlignOPSD [6] and retain their source aggregation.
C.5 Ablation configurations and evaluation
Table C.2 specifies the full method and the three 3B ablation variants. All variants generate eight reflections and one skill per task group during online training. Variant (a) omits R/S SFT and starts from Qwen2.5-3B-Instruct. Variant (b) extends direct Teacher supervision to the complete response, including reasoning. Variant (c) retains command-only supervision and online R/S generation in both environments; it sets the modulation multiplier to one and removes the direct R/S objective. The remaining settings follow Table B.2.
Full-response supervision in variant (b). At each interaction turn, we compute the modulation multiplier from the executable command's mean gap and environmental advantage using Equation 13. This multiplier is broadcast to all valid generated tokens in the same Actor response, including reasoning and command content. Each token retains its own Teacher–Actor gap, giving
The loss uses the clipped token objective in Equation 14. Both supervision scopes use the Actor token-mean denominator in Equation 15, Teacher coefficient , and PPO clipping ratio 0.2. The full-response branch applies these token-level Teacher terms throughout the sampled response under the command-derived multiplier.
Table C.2: Training components used in the ablation study. Scope denotes the tokens covered by direct Teacher supervision. Online R/S denotes reflection and skill generation during training.
| Variant | SFT | Scope | Mod. | R/S loss | Online R/S |
|---|---|---|---|---|---|
| Full | Yes | Command | Yes | Yes | Yes |
| (a) | No | Command | Yes | Yes | Yes |
| (b) | Yes | Response | Yes | Yes | Yes |
| (c) | Yes | Command | No | No | Yes |
Each branch trains for 150 online updates and is evaluated at its final checkpoint. ALFWorld evaluation uses all 140 seen tasks, at most 30 actions, and history length five. WebShop evaluation uses the fixed 128-task panel, at most 15 actions, and history length two. Both environments use temperature 0.4 and one trajectory per task. We report six-category macro success for ALFWorld and Score and Success for WebShop. The GRPO row contains the published baseline values described above.
D Mechanistic analysis and training dynamics
D.1 Paired measurement of Teacher weight
The analysis in Figure 4(a,b) uses recorded command spans, likelihood gaps, modulation weights, and primary policy advantages from the two 3B runs specified in Appendix B.2. We recorded nine snapshots per environment. Duplicate padding rows are removed, and each executed command contributes one observation. We retain commands with an active Teacher span and a primary advantage satisfying . The same commands are used before and after modulation.
The raw command coefficient is the summed Teacher–Actor gap . The final command coefficient is the mean saved coefficient over the command’s content tokens. These command-level values enter the reward-alignment statistic in Section 4.3. Each condition is normalized by its own total absolute coefficient mass. This comparison includes both command-length normalization and environmental modulation. The shaded region in Figure 4(a,b) shows the paired percentage-point difference.
The reference advantage comes from the primary policy objective: the recorded outcome includes the configured invalid-command penalty and is standardized within the task group. The auxiliary graph advantage determines modulation. The primary advantage provides the outcome-derived reference for the measurement, and the auxiliary advantage controls the Teacher multiplier.
D.2 Return concordance of skill-induced preferences
For each skill, we pair distinct commands from different trajectories when their stored Actor prompts and admissible-action sets match exactly. Teacher scoring retains the reasoning prefix sampled in each response. Let be the difference in raw command gaps and the difference in recorded returns-to-go. Pairs with are omitted. With , the pair score is
Concordance is 100 times the mean pair score within a skill. Skills with at least one eligible pair enter the analysis. We then give each skill equal weight, so skills with more observed command pairs do not dominate the comparison.
The pooled analysis uses the saved snapshots after the initial update. Within each task, the median bounded R/S credit separates the higher- and lower-credit groups; median ties belong to the lower-credit group. Figure 4(c,d) displays individual skills, group means, and interquartile ranges. The complete measurements underlying the figure accompany the supplementary data.
D.3 Training dynamics
Figures D.1 and D.2 show the 3B and 7B command-only runs over 150 updates. Success and interaction length summarize 128 trajectories per update; positive-credit fractions count all sixteen skills, including zero-credit groups. Modulation coverage retains the logged training-batch rows and active-Teacher mask.

Figure D.1: Training dynamics of the 3B agents. Columns show ALFWorld and WebShop; rows show training success, modulated-action coverage, the fraction of skills receiving positive R/S credit, and mean interaction length. Light curves show individual updates; dark curves show trailing ten-update means, using available updates at the start. Success rises and episodes shorten while environmental feedback continues to select and modulate supervision.

Figure D.2: Training dynamics of the 7B agents. Columns and rows follow Figure D.1, with the same axis ranges and moving-average convention. Both tasks show increasing success and shorter interactions. Modulation coverage remains active on ALFWorld and declines on WebShop.