Repository navigation
fix: support natural document lengths in V4.1 packed CP compression - #1250
Merged
liuchongming74 merged 1 commit intoOct 30, 2026
Merged
liuchongming74 merged 1 commit into
liuchongming74 merged 1 commit into
Conversation
xuxl1008
requested review from
liuchongming74,
suteng,
yangzhenzhang02 and
yaoyifanx
as code owners
October 20, 2026 12:03
xuxl1008
force-pushed
the
fix/v41-natural-document-compression
branch
from
October 20, 2026 12:24
1455a36 to
564b026
Compare
Contributor
Author
|
/check-pr |
Contributor
Author
|
/retest |
|
|
This was referenced Oct 21, 2026
xuxl1008
force-pushed
the
fix/v41-natural-document-compression
branch
from
October 28, 2026 16:21
564b026 to
df3d3de
Compare
Contributor
Author
|
/retest |
|
|
@xuxl1008, your gate pipeline failed at the code check stage. You can configure some code check tools locally following the (pre-push quick guide), to enable automatic checking when you push your code every time. Tools included are: Check_CMakelint, Check_Codespell, Check_Cpplint, Check_Lizard, Check_Pylint, Check_ClangFormat, Check_ShellCheck. |
xuxl1008
force-pushed
the
fix/v41-natural-document-compression
branch
from
October 28, 2026 16:55
df3d3de to
a61d9b2
Compare
Contributor
Author
|
已修复本次 Check_Lizard 失败:整理两个 validation builder 的参数换行,保留完整说明、接口和逻辑(AST 不变)。按 CI 的 Lizard 1.17.19、 |
Contributor
Author
|
/retest |
|
|
xuxl1008
force-pushed
the
fix/v41-natural-document-compression
branch
from
October 29, 2026 15:41
a61d9b2 to
2b98154
Compare
xuxl1008
force-pushed
the
fix/v41-natural-document-compression
branch
from
October 29, 2026 15:47
2b98154 to
51c330f
Compare
Contributor
Author
|
/retest |
|
|
yangzhenzhang02
approved these changes
Oct 30, 2026
yaoyifanx
approved these changes
Oct 30, 2026
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.
Paired: GitHub #1250 ↔ GitCode !1811
What type of PR is this?
/kind bug
What does this PR do / why do we need it:
Fix the
packed sample boundaries must align with the CSA2 compression ratioerror when the standard TopK training path for DeepSeek-V4.1 receives packed/TND data containing odd-length documents. Also disable the post-training candidate pool by default in the validation/cropped builders so that the default validation model uses standard causal TopK selection.The previous implementation derived compressed K coordinates by dividing global token positions by the compression ratio, so simply removing the alignment check would be incorrect. For example, two documents of lengths 3 and 5 should produce 1 and 2 compressed keys respectively at ratio 2, with compressed boundaries
[0, 1, 3]. The last token of the first document must not be grouped with the first token of the second document.Changes:
floor(document_length / ratio)keys. Trailing tokens that do not form a complete block still participate in Q, SWA, and the training loss.Natural-document compression requires no additional configuration. It uses the existing document boundaries in
packed_seq_params; fused and reference implementations share the same document compression plan. CP still requires the packed total length to be evenly divisible by the CP size and a micro-batch size of 1. Individual documents no longer need even lengths in the standard TopK path. The post-training candidate-pool path retains its compression-alignment requirement.Changes accompanying the data interface introduced in #1188: the three V4.1 VLM examples use
sample_alignment_size: 1, removing per-document padding to even lengths. Two older examples also replace the removedsequence_alignmentargument and explicitly settraining_mode: sft/sample_format: messages. Optional sample padding, the collator's TP×CP alignment of the complete batch, and the separate ignored padding tail are retained. Image-patch/SP alignment constraints are unchanged. Explicit candidate configurations still require compression-aligned data.The validation/cropped builders add
enable_candidate_pool: falseas the default: set the candidate source to -1 and candidate TopK blocks to 0, and disable layer-role remapping used only for candidate smoke tests. The default four-layer crop no longer changes a released Reuse layer into Reindex solely for this test. The released Full/Reindex/Reuse relationships in the 40-layer configuration are preserved. Settingenable_candidate_pool: trueexplicitly restores candidate validation behavior;exercise_post_training_indexercontrols candidate smoke-test remapping only when the candidate pool is enabled. This setting does not modify the original released checkpoint configuration or add candidate-pool support to the fused Indexer.Algorithm references:
Which issue(s) this PR fixes:
Fixes #1261
Related to #1143. This PR independently fixes data ingestion for natural document lengths; it does not close or update the original PR.
Test Plan and Test result:
Rebased onto master
96143af9, which includes dataset PR #1188. The upstream Base attention interface and merged KV-stride fixes are preserved.git diff --checkalso passed.Previously established independent accuracy references:
This PR makes no new performance claims.
Code review checklist: