feat: ECHO env-token world modeling (RFC 010 + two runnable examples)#819
Merged
burtenshaw merged 2 commits intoJun 17, 2026
Merged
Conversation
Add RFC 010 and two runnable reference examples so an OpenEnv trajectory can carry per-token role masks (action / env_output / warning) and the optimizer seam can take a world_model_coeff. Purely additive: world_model_coeff = 0 drops the env term, leaving the existing action-token objective unchanged. During agent RL we usually mask out the environment's reply tokens and train only on the agent's actions. ECHO keeps that half with a small cross-entropy loss that makes the policy predict the environment's observation tokens. Those logits are already computed when the policy conditions on them, so the signal needs no extra rollouts and no teacher. L = L_GRPO(action tokens) + lambda * CE(observation tokens) - rfcs/010-echo-env-token-world-model.md: the proposal. Part A adds the role masks (extends RFC 009); Part B adds the world_model_coeff knob on the optimizer seam (extends RFC 007). - examples/echo_world_model/: a self-contained CPU reference that trains a small model on the environment's own observation tokens (verifier-free), with adapter notes for SkyRL, Tinker, and Foundry Fine-Tuning. Held-out env-token CE drops from 6.18 to 0.27 nats/token (echo_run.png). 6 tests. - examples/echo_on_agent_world_model/: the same role masks on the Agent World Model env (huggingface#428), with 10 CPU tests over a captured episode. 89% of the learnable tokens are environment observations that standard agent-RL discards. The Agent World Model env is AgentWorldModel-1K from Snowflake AI Research and UNC-Chapel Hill (CC-BY-4.0, arXiv:2602.10090). The ECHO objective is from microsoft/echo-rl (arXiv:2605.24517). Signed-off-by: Govind Kamtamneni <gok@microsoft.com>
Collaborator
|
Really nice example. Looking forward to a blog post or video on this. |
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
This was referenced Jun 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR adds to OpenEnv
rfcs/010-echo-env-token-world-model.md): a small, additive amendment so a trajectory can carry per-token role masks (action/env_output/warning) and the optimizer seam can take aworld_model_coeff. This is the one thing OpenEnv is missing to train on environment tokens.examples/echo_world_model/: a CPU reference that trains a small model on the environment's own tokens (verifier-free), with adapter notes for SkyRL, Tinker, and Foundry Fine-Tuning.examples/echo_on_agent_world_model/: the same masks on the Agent World Model env, showing its observations already carry the roles.Purely additive.
world_model_coeff = 0drops the env term entirely, so the trainer's existing action-token objective is unchanged.ECHO, crisply
During agent RL we mask out the environment's reply tokens and train only on the agent's actions. ECHO keeps that half: a small cross-entropy loss that makes the policy predict the environment's observation tokens. Those logits are already computed when the policy conditions on them, so the signal needs no extra rollouts and no teacher (about free).
The gap it closes. OpenEnv trajectories are message-level today, so a trainer cannot tell, per token, which tokens are actions and which are observations. RFC 010 Part A adds the masks (extends RFC 009); Part B adds the
world_model_coeffknob on the optimizer seam (extends RFC 007).Results
The CPU reference trains a small model to predict the environment's own observation tokens, verifier-free (no grader, no teacher). Held-out env-token cross-entropy drops from 6.18 to 0.27 nats/token in about 40s on a laptop, reproducible with
python train_echo.py --steps 60 --seed 0:Beyond the toy:
forward_backward+optim_stepon Foundry Fine-Tuning; not reproducible from this PR): plain GRPO degraded held-out env-CE (10.08 -> 21.16, +110%) while ECHO learned it (10.08 -> 7.69, -24%). Config, seed, and logs available on request.Production rollouts can be isolated in ACA Sandboxes (#793, not part of this PR); the CPU demos here run in-process. Training adapters: SkyRL (open reference), Tinker, Foundry Fine-Tuning. Trained task-reward numbers (about 2.3x faster RL, TerminalBench-2.0 pass@1 about doubles) are in
microsoft/echo-rland arXiv:2605.24517.Verify
Credits
The real-env demo builds on the upstream Agent World Model env (
agent_world_model_env, #428) from Snowflake AI Research and UNC-Chapel Hill: AgentWorldModel-1K, CC-BY-4.0, arXiv:2602.10090. The ECHO objective is frommicrosoft/echo-rl(arXiv:2605.24517). Full citations in the example READMEs.DCO signed.
cc @burtenshaw