Skip to content

feat(training): support selective checkpoint contexts for frozen projections - #962

Closed
jiapingW wants to merge 1 commit into
mainfrom
codex/pr942-06-projection-checkpointing
Closed

jiapingW wants to merge 1 commit into
mainfrom
codex/pr942-06-projection-checkpointing

Conversation

@jiapingW

@jiapingW jiapingW commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Add an optional context_fn to checkpointed_chunk_reduce and a DFlash-family selective checkpoint policy that retains eligible frozen vocabulary-projection outputs during recomputation.

This PR only supplies the shared API and policy; no training algorithm enables projection caching here. Existing chunking/checkpoint behavior remains unchanged. The PR targets main directly and does not depend on the earlier stacked changes.

Validation

38 targeted tests passed on H20 after rebuilding on main:

CUDA_VISIBLE_DEVICES=1 OMP_NUM_THREADS=4 python -m unittest \
  tests.test_utils.test_chunking \
  tests.test_utils.test_dflash_losses -q

Coverage includes context integration, frozen/trainable-head gradient parity, chunk reduction, and existing loss behavior. Black/isort and git diff --check passed.

Performance scope

This change does not establish an end-to-end performance benefit. The usefulness of projection caching should be evaluated after the logits-loss refactor in #961, separately from chunk size and the checkpoint boundary. Chunking and checkpointing are still coupled in the existing API; this PR has not yet addressed that review suggestion.

@jiapingW
jiapingW requested a review from FrankLeeeee as a code owner October 14, 2026 03:27
@jiapingW jiapingW changed the title [6/11] feat(training): support selective checkpoint contexts for frozen projections [6/10] feat(training): support selective checkpoint contexts for frozen projections Oct 14, 2026
yushengsu-thu added a commit to yushengsu-thu/SpecForge that referenced this pull request Oct 15, 2026
…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>

@maocheng23 maocheng23 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same cmt with PR 961, here shall we refactor the loss function first, then decide if we need this selective checkpoint?

Also, I think we need to split the checkpoint with chunking. Not sure if that is still beneficial.

@jiapingW
jiapingW force-pushed the codex/pr942-05-dflash-fused-head branch from a7e88e7 to 903d860 Compare October 22, 2026 00:46
@jiapingW jiapingW changed the title [6/10] feat(training): support selective checkpoint contexts for frozen projections feat(training): support selective checkpoint contexts for frozen projections Oct 22, 2026
@jiapingW
jiapingW force-pushed the codex/pr942-06-projection-checkpointing branch from f85e6ae to f5b38c6 Compare October 22, 2026 00:58
@jiapingW
jiapingW changed the base branch from codex/pr942-05-dflash-fused-head to main October 22, 2026 00:58
@jiapingW

Copy link
Copy Markdown
Collaborator Author

It has a small gain about 1-2% speedup compared to checkpoint.

@jiapingW jiapingW closed this Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants