fix(delta-sync): surface failed engine apply results instead of silently discarding them#2119
Open
tanishkasinghhh wants to merge 1 commit into
Open
Conversation
…rding them _finalize_sync() called ray.get(object_refs) and discarded the (success: bool, msg: str) tuples returned by each SGLang receiver engine. A failed delta-weight apply (checksum mismatch, I/O error, decode error) was therefore completely silent: ray.get(object_refs) # return values dropped — issue THUDM#2104 self._pending_publishes.clear() Because the sender advances its pinned-CPU snapshot *before* flushing to the receiver, a silently-failed apply leaves the sender snapshot ahead of the receiver. All subsequent diffs are computed against the (already- advanced) snapshot, so the missed updates are never re-sent. The drift persists for the rest of the run. Fix: extract check_apply_results() into a dependency-free module (_apply_result_check.py) and call it immediately after ray.get(): results = ray.get(object_refs) check_apply_results(results) # logs + raises on any (False, msg) The helper is in its own module so it can be unit-tested without torch, ray, megatron, or any GPU runtime. The SGLang receiver already catches every exception and returns (False, error_msg) rather than propagating; the only gap was that slime never checked the return value. Closes THUDM#2104
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.
Summary
_finalize_sync()inupdate_weight_from_distributed_delta.pycallsray.get(object_refs)but discards the(success: bool, msg: str)tuplesreturned by each SGLang receiver engine (via
update_weights_from_disk/update_weights_from_distributedwithload_format="delta").A failed apply — from a checksum mismatch, I/O error, or decode error — is
therefore completely silent.
Why this matters
The sender advances its pinned-CPU snapshot before flushing to the
receiver (
update_snapshot_asyncruns ahead of the bucket flush in_enqueue_chunk). A silently-failed apply therefore leaves the sendersnapshot permanently ahead of what the receiver actually holds. All
subsequent diffs are taken against the (already-advanced) snapshot, so the
missed weight updates are never re-sent. The drift persists until a
full broadcast reseed (process restart).
The SGLang receiver already catches all exceptions internally and returns
(False, error_msg)— the only gap was that slime never checked the returnvalue.
Fix
Extracts
check_apply_results()into a lightweight, dependency-free module(
_apply_result_check.py) and calls it immediately afterray.get():Separating the helper into its own module keeps it unit-testable without
torch / ray / megatron / GPU.
Changes
slime/backends/megatron_utils/update_weight/_apply_result_check.pycheck_apply_results()helper with full docstringslime/backends/megatron_utils/update_weight/update_weight_from_distributed_delta.pyray.get()tests/test_delta_sync_check_apply.pyTests
Closes #2104
Prepared with AI assistance (Claude Code). Every change reviewed and understood line-by-line.