Manuscript Offprint

arXiv:2611.12232

ECOS: Environment-Calibrated On-Policy Self-Distillation for Language Agents

Chenhao Zhang, Zhongan Wang, Mingxuan Li, Hehe Fan, Zheng Zhu, Ming Li

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

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:

  1. 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.

  2. 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.

  3. 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.

References (35)