Repository navigation
feat(training): enable opt-in Liger kernels for Domino and DSpark - #963
Conversation
d19a88d to
f8b7482
Compare
…ck merge Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… to exp_read.me Same base as the dense-1/8 branch (PR sgl-project#942 stack sgl-project#957-sgl-project#963 merged there, DDP-wrapped draft lookup for MoE metrics, managed-local NCCL port pin); the experiment log is exp_read.me like on dense-1/8. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…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 <noreply@anthropic.com>
…ense-1/8 branch Taking the stack's side of the merge conflicts had dropped this branch's own changes to specforge/training/backend.py and controller.py: the MoE checkpoint state-dict naming conversion (to_checkpoint_state_dict / from_checkpoint_state_dict), the fsdp_replicate_when_frozen candidates, the SPECFORGE_FSDP_SHARDED_GRAD_ACCUM path and the perf/mem_* allocator metrics. The files are now the dense-1/8 versions (base + PR stack sgl-project#957-sgl-project#963), plus dense-1/8's launch_plan.py fix pinning each capture server's --nccl-port, so specforge/ is identical across the two arms. Recipe: flatten_vocab_projection / cache_vocab_projection (the sgl-project#963 names), save_interval 1196 with 12 checkpoints kept (9 per epoch, the 9th on the epoch boundary), in-flight window 264/132 and no consumer_dispatch override, all as on dense-1/8. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…l-project#963 + sgl-project#966) into the MoE experiment branch The same upstream content was already merged here independently; this records the fork branch's current head as an ancestor. The two MoE config files that spark-Qwen3-8B also carries are kept in this branch's version (the one the running experiment uses). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Two suggestions here:
|
f85e6ae to
f5b38c6
Compare
f8b7482 to
554a0f1
Compare
Setup: H20, Qwen3-8B , a 5-layer draft model, BF16, FlexAttention, frozen LM head, Liger disabled, and objective chunk size fixed at 128. DSpark: batch=1, seq_len=3072, anchors=512. Domino: batch=2, seq_len=3072, anchors=256. Timing covers draft forward, loss, backward, and optimizer step, excluding teacher inference, data loading, and distributed communication. Throughput changes are relative to each model's baseline with checkpointing, projection cache, and flatten all disabled. All configurations produced identical losses and trainable parameter gradients to the baseline. The flatten has no gain and the projection cache is a medium status between using checkpoint and not using checkpoint. This is not a necessary optimization. I will update this PR to include only the Liger kernel. |
45b7c51 to
8c0a361
Compare
6d7b8c9 to
158cfdd
Compare
8c0a361 to
c0fef19
Compare
maocheng23
left a comment
There was a problem hiding this comment.
LGTM, merge after 961 please
planning.py rejects model.use_liger_kernel=true for dspark: on main only the dflash algorithm wires Liger kernels into its draft. The exp branch could set it because it merged sgl-project#963. The first online smoke of this recipe failed on it.
…omino-optimizations
…omino-optimizations
…suite Replace tests/test_training/test_domino_dspark_liger.py with two CPU tests in test_liger_kernel.py: Domino and DSpark constructors forward the injected kernel factories, and their providers resolve Liger only for an explicit `model.use_liger_kernel: true`. tests/test_training is not a package, so `unittest discover` never collected the old module, while CI runs test_liger_kernel explicitly. The backbone's Liger numerics are already covered by the DFlash/DFlash2 parity tests, and the Domino/DSpark heads contain no Liger modules. Drop the Domino/DSpark Liger section from training/DESIGN.md; examples/configs/README.md documents the flag. This also resolves the conflict with the consumer-dispatch section on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DSpark accepts use_liger_kernel since sgl-project#963. Liger replaces the draft's RMSNorms; the MoE FFN keeps its grouped_mm experts, which Liger does not cover yet. A 10-step offline run of a Liger-built MoE DSpark draft trained with finite loss, bias and counts.
Domino and DSpark can opt into the existing Liger RMSNorm/SwiGLU kernels with
model.use_liger_kernel: true. Their defaultnulland explicitfalseretain native kernels. Providers and constructors reuse the DFlash kernel bundle and its platform, activation, and dependency validation; preflight follows the same opt-in behavior.Parameter layouts remain compatible, and the implementation does not globally patch Transformers.
Stack: main → #960 → #961 → #963 → #965. One Liger-only commit on #961; projection caching, flattened projections, and selective checkpoint contexts are excluded.
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. Coverage includes BF16 loss/gradient parity, opt-in/native defaults, configuration, and model loading.