Repository navigation
Conversation
…setup Every SGLang refit invalidates the KV cache before the weight transfer, so async_rl.recompute_kv_cache_after_weight_updates=false was silently ignored on the SingleController path. SGLangGeneration.validate_settings now rejects it before anything builds, like the Megatron backend does for its kv_cache_management_mode mismatch. The in_place pause rejection now gives the same reason. Closes NVIDIA-NeMo#3747 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Pa8JdzpuUd2BVbxJ8Anoba Signed-off-by: Shubhankar Tripathy <[email protected]>
…pute-kv Signed-off-by: Shubhankar Tripathy <[email protected]> # Conflicts: # nemo_rl/models/generation/sglang/sglang_generation.py
…pute-kv Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Pa8JdzpuUd2BVbxJ8Anoba Signed-off-by: Shubhankar Tripathy <[email protected]>
…pute-kv Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Pa8JdzpuUd2BVbxJ8Anoba Signed-off-by: Shubhankar Tripathy <[email protected]>
Contributor
Author
|
@terrykong @youngeunkwon0405 this is the fix for #3747, which terrykong filed and youngeunkwon0405 is assigned. Every SGLang refit flushes the KV cache, so I merged main at 2437f37. Could you review and post |
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.
What and why
Every SGLang refit invalidates the KV cache before the weight transfer (
_SGLangWeightSynchronizer._refit), whateverasync_rl.recompute_kv_cache_after_weight_updatessays. A SingleController run with the SGLang backend and the flag set tofalsetherefore got recompute behaviour with no warning (#3747).Following the issue's second option and the Megatron precedent (
MegatronGeneration.validate_settingsrejects a flag that disagrees withkv_cache_management_mode), this PR rejects the setting at setup instead of ignoring it:SGLangGeneration.validate_settingsraisesValueErrorwhen the flag isfalse. SC setup calls the backend'svalidate_settingsbefore it builds anything.pause_generation_mode='in_place'rejection now gives the same reason (in_place keeps KV from the previous weights, and the SGLang refit always recomputes it) instead of calling it "unsafe".docs/guides/single-controller.md: the flag's row says SGLang supports onlytrue.sglang_recompute_opt_outcase intest_invalid_config_fails_before_setup_factories, next tomegatron_recompute_mismatch. It fails without the fix.The default is
true(since #3929), and no shipped config or test script setsfalsewith SGLang, so only runs that setfalseexplicitly change: they now fail at setup. Async GRPO v1 already rejects the SGLang backend, so the v1 path is untouched.Honouring
falseon SGLang instead (the issue's first option) would need someone who has run SGLang async to confirm that skipping the flush is safe; that can follow as its own change. The vLLM remote-sparse synchronizer has the same defect (#3746) and is left alone here because another contributor has claimed it.Issues
Closes #3747
Convergence / perf / functionality proof
N/A: only a config combination that was already ignored now raises at setup; the default path and every shipped config behave as before. Locally at 2437f37 (main merged at fdef76c):
tests/unit/single_controller/test_setup.py,tests/unit/weight_sync/, andtests/unit/models/generation/sglang/test_sglang_generation.py+test_config.pypass (900 tests); ruff and pyrefly 1.4.0 are clean on the changed files.Needs upstream changes
None
PR commands and CI
CI:Lfast: the default for most PRs. Runs a fast test subset.CI:L1: dependency or container changes (pyproject.toml,uv.lock,Dockerfile) or broad core changes. Builds a new image and runs unit and functional tests.CI:docs: docs-only changes. Runs doc tests only./ok to test <full-commit-sha>: start CI for that commit. Post again after each push./review: automated review comments. Addmode=strictfor a stricter review,reset=truefor a fresh full review./resolve-conflict: Autobot mergesmaininto this PR and resolves the conflicts. PRs from forks must allow edits by maintainers./review-pr-team <pr-number>for a team review before you ask for human review.🤖 Generated with Claude Code
https://claude.ai/code/session_01Pa8JdzpuUd2BVbxJ8Anoba