Repository navigation
fix(gigpo): match anchor states within each task - #637
Open
flyingdoubleG wants to merge 1 commit into
Open
flyingdoubleG wants to merge 1 commit into
flyingdoubleG wants to merge 1 commit into
Conversation
GiGPO's step-level advantage compares discounted returns of steps that reach the same anchor state within one group of trajectories of the same task (build_step_group in the reference implementation groups by episode group first, then by observation). GiGPOAdvantageFn bucketed steps by env_state_hash over the whole batch, so identical observations from different tasks, e.g. ALFWorld's "Nothing happens." (the hash is taken over the formatted observation), were normalized together although their returns refer to different goals. Key the anchor buckets by (task id, state hash) and add a test with the same observation in two tasks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Description
Problem. GiGPO's step-level advantage compares the discounted returns of steps that reach the same anchor state within one group of trajectories of the same task. The reference implementation (
build_step_groupingigpo/core_gigpo.pyof verl-agent) first groups by episode group (index), then clusters identical observations inside each group.GiGPOAdvantageFn.processbuilds the anchor buckets over the whole batch, keyed only byinfo["env_state_hash"]:The ALFWorld workflow hashes the formatted observation text, so generic observations such as
Observation: Nothing happens.(or "On the countertop 1, you see nothing.") get the same hash in every task. Steps from different tasks, whose returns refer to different goals and horizons, are then normalized together, and theirA^Sdepends on which other tasks happen to be in the batch.Change. Key the buckets by
(eid.tid, state_hash), i.e. match anchor states within each task group as in GiGPO. Docstring updated accordingly.Tests.
tests/algorithm/test_gigpo_advantage.py::test_anchor_states_are_not_shared_across_tasks: the same hash appears once in each of two tasks (one run succeeds after it, the other fails); there must be no anchor group of size > 1 and the advantages must equal the episode-only ones (omega=0). It fails before the change; the file passes after (10 tests, CPU).Checklist
🤖 Generated with Claude Code