Repository navigation
Conversation
Apply the inclusive bidirectional window to local layers in serial and TP graphs while preserving global padding masks. Normalize legacy and materialized window settings and reject invalid graph bounds. Signed-off-by: JiaxinD <djx2048@gmail.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
Contributor
Author
|
@yifeif-nv Could you please run protected premerge for current head 9ea5577? Community CPU / Required, Stable, and Dev passed. |
Signed-off-by: JiaxinD <djx2048@gmail.com>
Add pinned-checkpoint long-input cases for serial and TP validation, retaining the existing parity threshold. Reject vacuous or oversized reference inputs before reference CUDA setup and add CPU attention-value leakage checks. Signed-off-by: JiaxinD <djx2048@gmail.com>
This branch has not been deployed
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.
Background
ModernBERT serial and TP builders select local RoPE settings but pass only the padding mask to every layer. Tokens beyond the local window therefore remain visible. Short sequences hide this error. Found during compatible Granite embedding source audit; no originating issue.
Exit Criteria
Local layers enforce inclusive bidirectional half-window boundaries together with padding; global layers retain padding-only attention. Both config layouts/builders are covered, with long official-checkpoint workloads registered for serial and TP validation.
Implementation
local_attention // 2and materializedsliding_window, rejecting invalid values and half-windows outside the graph INT32 range.Change categories
Validation
Commands and Results
python -m pytest families/modernbert/tests/test_attention_contract.py families/modernbert/tests/test_local_attention.py families/modernbert/tests/test_checkpoint_loading.py families/modernbert/tests/test_parallel_contract.py families/modernbert/tests/test_optimized_checkpoint_guards.py families/modernbert/tests/test_e2e_window_contract.py tools/tests/test_architecture.py tools/tests/test_pr_metadata.py tools/tests/test_family_impact.py -qpython -m ruff check families/modernbert/config.py families/modernbert/graph/model.py families/modernbert/model.py families/modernbert/parallel.py families/modernbert/tests/test_attention_contract.py families/modernbert/tests/test_local_attention.pypython -m tools.model_ci validate;python tools/test_impact.py --validate;python tools/legal_headers.py --check;git diff --checkInitial mask regression: 25 failed, 9 passed. Window-bound regression: 2 failed, 18 passed. New E2E workload guards: 9 failed before, 9 passed after. CPU tests cover actual builders, dynamic lengths, TP2, aliases, padding, all-global networks, and attention-value exclusion of distant/padded tokens across FP32/FP16/BF16.
Hardware, Environment, and Revisions
Windows CPU, Python 3.13, NumPy and ml_dtypes; head
359d13d671e7b90dc8e3e4665b699f8f35556f7e, basec3481588. Reference semantics: Transformers77cfe272, inclusiveabs(q-k) <= sliding_window. Synthetic weights, no downloaded checkpoint.Not Run / Remaining Gaps
Native TensorRT build, GPU inference, checkpoint parity, TP communication, memory, and performance are unrun because authorized H200s are fully assigned. Full-builder tests stub RoPE/attention/collectives; separate numerical tests execute production attention helpers over a NumPy IAttention simulation. Six GPU E2E cases remain skipped; the new long prompts have not been proven to reject the old implementation at 0.995. No GPU or performance claim. Serial BF16 integration remains separate in #1846.
Contributor Self-Review
Independent follow-up: 68 focused passes, 134 family passes and 6 GPU skips; no blocker. Earlier overflow finding resolved.
Notes For Future Readers
Review config/mask/routing, then E2E workload guards. Upstream checkpoint guards retained by a history-preserving merge. No merge dependency on #1846; revalidate serial BF16 after combining. Dense mask storage is quadratic: one FP32 mask at 8192 tokens is 256 MiB before intermediates. Target-runtime resource qualification remains necessary.
Risk level
Long-input attention intentionally changes to the published local contract, with an additional dense mask and unmeasured runtime resource cost.