Repository navigation
feat(attention): validate draft direction and record resume semantics - #960
Conversation
…yers 1-7 of the sgl-project#942 split), matching the dense-1/8 branch The combined PR sgl-project#942 merge was reverted in the previous commit; this takes the split stack instead (sgl-project#957 streaming-read fixes, sgl-project#958 DDP sync once per accumulation window, sgl-project#959 no implicit qwen3-instruct system prompt, sgl-project#960 is_causal, sgl-project#961 fused DFlash head, sgl-project#962 selective checkpoint contexts, sgl-project#963 shared flatten_vocab_projection / cache_vocab_projection), so the MoE arm carries exactly the same upstream code as the dense-1/8 arm. Conflicts in specforge/training/backend.py and controller.py resolved in the stack's favour. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
The current PR is related to #960. Compatibility needs to be considered. @maocheng23 |
This is PR 960 right? |
| def resolve_dflash_causal_block(config) -> Optional[bool]: | ||
| """Read the direction override; None preserves the legacy per-layout defaults.""" | ||
|
|
||
| value = getattr(config, "is_causal", None) |
There was a problem hiding this comment.
self.is_causal = False
self.causal_block = resolve_dflash_causal_block(config)
kwargs["is_causal"] = False
If they are all the same, shall we just use the same param?
There was a problem hiding this comment.
nit, shall we move the mask related code to common/dflash_family_model, so other draft models can work as well
There was a problem hiding this comment.
Yes, it can be also used in eagle class models. So I think it's need to be designed in a DraftModelConfig class.
There was a problem hiding this comment.
For the sake of simplicity, I will handle the configuration and masks in a separate PR.
Sorry, this is a misunderstanding. |
afcacbe to
4a3802c
Compare
maocheng23
left a comment
There was a problem hiding this comment.
Todo: Move the mask code later
Validate nullable
is_causal, record explicit attention overrides in resume metadata, and reject bidirectional sliding-window exports in the SGLang normalization gate until that serving path is validated.Reuse main's shared training/inference masks and per-layer direction defaults. Sliding windows bound both context and draft tokens, including when
is_causalis unset. The older duplicate mask builders and inference-mask implementation are removed from this PR. Tests cover direction/window visibility, gradient isolation, cached inference, DSpark, configuration round-trips, and resume/export contracts.Stack: main → #960 → #961 → #963 → #965. One attention-only commit on current main.
Validation on H20 (Python 3.12, PyTorch 2.14.1+cu130): 115 tests passed, 1 FlashAttention 2 test skipped on this layer. Full-stack validation on H20 (Python 3.12, PyTorch 2.14.1+cu130, Liger 0.8.5): 285 tests passed, 3 skipped (FlashAttention 2 unavailable and two Blackwell-only tests). Black 24.10.0, isort 5.13.2, and
git diff --checkpassed. No full-model training or end-to-end benchmark was run.