feat(orchestrator): RAE — role-conditioned advantage estimation for self-play envs (SPIRAL)#3136
Open
hallerite wants to merge 1 commit into
Open
feat(orchestrator): RAE — role-conditioned advantage estimation for self-play envs (SPIRAL)#3136hallerite wants to merge 1 commit into
hallerite wants to merge 1 commit into
Conversation
hallerite
marked this pull request as ready for review
July 24, 2026 13:44
…ion for self-play envs Add the `rae` algorithm (SPIRAL, arXiv:2506.24119): each trainable agent keeps an EMA baseline of its own rewards, and every trace's advantage is its reward minus its agent's pre-update baseline. Group-relative baselines mis-credit multi-agent self-play — in a zero-sum game the group mean is ~0 whatever the policy does, and centering both agents against it turns any structural asymmetry (first-mover edge) into permanent credit. Baselines are keyed per (env, agent) — the paper's per (game, role) — and any group_size works, including 1. configs/debug/algo/rae.toml runs shared-policy Kuhn poker self-play (kuhn-poker-v1, both agents late-bound to the run's model). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
hallerite
force-pushed
the
feat/rae-self-play-advantage
branch
from
July 24, 2026 14:16
85a016a to
469a5b3
Compare
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
Adds the
raealgorithm — SPIRAL's role-conditioned advantage estimation (arXiv:2506.24119) — as a namedAlgorithmfor multi-agent self-play envs likekuhn-poker-v1:RAEAlgorithm(algo/rae.py): each trainable agent keeps an EMA baseline of its own rewards; every trace's advantage isreward − baseline, scored against the pre-update baseline (the reference implementation's unbiased order), then folded in atdecay(SPIRAL's α, default 0.95). Baselines are keyed byagent_nameon a per-env instance — the paper's per (game, role). No normalization, andgroup_sizeis free (RAE needs no sibling rollouts;group_size = 1is fine).RAEAlgoConfig(type = "rae",decay) in the discriminated union.configs/debug/algo/rae.toml— shared-policy Kuhn poker self-play (both agents late-bound to the run's own model).algorithms.mdincl. a "Self-Play Advantage (RAE)" section,training.md) and the configs skill updated.Stacked on #3137 (verifiers bump — brings
kuhn-poker-v1and the interleaving-agentsInteractionAPI); this PR carries only the RAE change.Why
Group-relative baselines assume the group is exchangeable attempts by one agent. A self-play episode yields one trace per agent, all trainable, and in a zero-sum game the rewards sum to ~0 whatever the policy does — the group mean carries no information, and centering both agents against it converts structural asymmetries (the first-mover edge) into permanent credit for one agent. SPIRAL's ablations show self-play without role baselines collapses (thinking collapse, gradient spikes); per-agent EMA baselines measure each agent against its own expected reward.
This is the "named
Algorithm" that #3108's single-trainable-agent gate points multi-agent envs toward — the two compose:grpokeeps refusing mixed-agent groups,raeis the estimator that handles them.Test plan
uv run pytest tests/unit/orchestrator tests/unit/test_configs.py -q— 204 passed, including 3 new RAE tests (zero-init baselines, per-agent separation + persistence across groups, pre-update scoring order).uv run rl @ configs/debug/algo/rae.toml --max-steps 3— 3 orchestrator steps with both seats training and 3 clean trainer steps, exit 0.🤖 Generated with Claude Code