Repository navigation
[RLlib] Advance weights version after unversioned module state updates - #67131
lindicaphxag-tech wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request ensures that unversioned module-state updates (where weights_seq_no is 0) increment the learner's weights sequence number, preventing EnvRunners from skipping these weights during synchronization. A unit test was also added to verify this behavior. Feedback suggests addressing an existing inconsistency in set_state where the sequence number can be downgraded to an older value even when the module state update is skipped.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 89eec46. Configure here.
|
I narrowed this PR to the generic Learner/LearnerGroup state-version invariant and removed the SelfPlay callback sync hunk to avoid overlapping with #67103. The remaining scope is: (1) an unversioned COMPONENT_RL_MODULE mutation advances WEIGHTS_SEQ_NO; (2) stale versioned state cannot downgrade the current sequence; (3) regression tests exercise actual NumPy-backed module state and LearnerGroup propagation. The separate callback PR should own the ordering/installation guarantee for newly cloned opponent modules. I pushed the scope reduction to fork head |
5881c97 to
3f9ab4b
Compare
|
Correction to my previous update: I replaced the unsigned scope-reduction commit with a signed-off equivalent to preserve the DCO requirement. Current head is |
Signed-off-by: Zhibo Zhang <[email protected]>
3f9ab4b to
1901f0b
Compare
|
Follow-up: I consolidated the branch into one DCO-signed commit while preserving the exact three-file PR diff and based it directly on the current |
Signed-off-by: Zhibo Zhang <[email protected]>
Signed-off-by: Zhibo Zhang <[email protected]>
Signed-off-by: Zhibo Zhang <[email protected]>
Distinguish an explicit version-zero checkpoint restored on a fresh
Learner from a versionless manual weight mutation. Keep version monotonic
when an explicit zero state overwrites already newer parameters.
Actual Learner.set_state source AST: baseline red, revised green.
Ray 2.59.0 native Learner with development method: green.
Evidence: github.com/lindicaphxag-tech/ray/actions/runs/39955155935
github.com/lindicaphxag-tech/ray/actions/runs/39955479007
Signed-off-by: Zhibo Zhang <[email protected]>
…ts, bounded game-server startup (#67594) Before this PR: - The `learning_tests_appo_footsies_*` postmerge tests time out often. Each Learner update takes `4096 * num_env_runners` = 81,920 env steps at `lr=1e-4`, but the game server answers one env step per 60 FPS frame (~57 steps/s per EnvRunner). The policy gets its first gradient update after ~3 minutes, and the target network never updates. Against the frozen copy the training win rate stays at 0.5, so the test passes only when a 10-episode eval happens to exceed 0.8 (e.g. eval 0.81 at training win rate 0.49). - `MixManagerCallback` initializes each new frozen opponent with `Algorithm.set_state()`. The EnvRunners skip those weights because the weights version doesn't change (#67131 fixes that in the Learner). The training EnvRunners therefore play the opponent's random init, while evaluation uses the real copy. - If a game server never gets ready, `FootsiesBinary.start_game_server()` polls forever (no deadline, no liveness check, no gRPC timeout), and setup hangs until the 900 s timeout. In a stress test, 3 of 240 concurrent server starts never got ready. After this PR: - 2048 env steps per Learner update, minibatches of 256, `lr=5e-4`, `target_network_update_freq=0.5`. - `MixManagerCallback` pushes the copied weights to all (eval) EnvRunners. An eval round without a decisive episode no longer raises a `KeyError`. - The game server gets 120 s to get ready (5 s gRPC timeouts, process liveness check); otherwise it's killed and relaunched, up to 3 times. Validation on Anyscale (nightly image + this PR's three files, no #67131), each seed the CI test's args in a fresh driver with a 900 s cap including startup: | CI target | hardware | passed | wall time | |---|---|---|---| | `learning_tests_appo_footsies_single_gpu` | 4×L4, 48 vCPU | 10/10 | 174–419 s | | `learning_tests_appo_footsies_multi_gpu` | 4×L4, 48 vCPU | 10/10 | 239–422 s | | `learning_tests_appo_footsies_single_gpu_no_aggregator_actors` | 4×L4, 48 vCPU | 10/10 | 174–418 s | | `multi_gpu` args, 2 Learners on 2 nodes (1×L4 each) + CPU EnvRunner nodes | 4 nodes | 10/10 | 217–357 s | Stock master on a 1×L4 node passed 1 of 1 attempt by eval luck, and `+#67131` alone failed in 1,500 s. A 4 h run on the 4-node cluster kept Learner, aggregator, EnvRunner and Algorithm memory flat. The game-server launcher fix started 360/360 servers in a stress test, relaunching one server twice. `pre-commit run --files` passes on all three files. Not a duplicate: no open PR touches the footsies example. #67131 fixes the weights-version root cause in `Learner.set_state`, and #67103 only fixes the league-based self-play callback; this PR doesn't depend on either. AI assistance (Claude Code) was used for the investigation, the experiments and the change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Artur Niederfahrenhorst <[email protected]> Signed-off-by: Artur Niederfahrenhorst <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
641454c to
b845e62
Compare
|
Converting to draft: the same Buildkite Microcheck gate that blocks #67103 applies here, its traceback is not readable from this account, and no maintainer has responded since the PR opened. The diff itself is green on DCO/Release. |

Summary
Related to #61960. This PR fixes the generic Learner/LearnerGroup state-version invariant; the self-play callback publication/order fix is in #67103.
An unversioned
COMPONENT_RL_MODULEupdate changes Learner parameters without advancingWEIGHTS_SEQ_NO. EnvRunners using pull-if-newer synchronization can therefore retain stale weights and skip the update.Scope is intentionally limited to the generic Learner/LearnerGroup state-version invariant:
Regression coverage
set_statepath and verifies the version advances.Validation (2026-10-23; current head)
b845e62f77bc9fc6dc4e66f5093274e0c5933384.