Repository navigation
Propose opt-in Qwen4-Exp ngram/main split contract - #776
titaiwangms with Copilot wants to merge 4 commits into
Conversation
|
|
Co-authored-by: titaiwangms <18010845+titaiwangms@users.noreply.github.com>
Performance Comparison
|
There was a problem hiding this comment.
🟡 Changes recommended
The proposed seam and persistence behavior conflict with parent requirements and current package key handling.
2 open findings
What changed in this PR
Documents a proposed opt-in Qwen4-Exp ngram/main split while preserving the unsplit default.
Changes:
- Defines component APIs, tensor/state ABI, and ownership.
- Specifies weight routing, persistence, and MTP interaction.
- Proposes qualification and roundtrip tests.
| File | Description |
|---|---|
docs/design/qwen4-exp-text-core.md |
Adds the split-component contract proposal. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
titaiwangms
left a comment
There was a problem hiding this comment.
Static design review: changes requested
Reviewed head: 0e8b4d1bcdb7269b2697e8ce44a81a8279dfdd10.
Source baseline: Mobius 954e8f1053d64d377d8893e5c700d1b8380d584a.
This is the synthesis of a Copilot-assisted, five-role static review of this PR and companion #777. It assesses the proposed contract against the pinned source and #767-#775, not an implemented split. No tests, builds, model execution, or source changes were performed. The recommendation below concerns the document; neither merging it nor this review constitutes semantic approval to start N1.
1. Major: singleton save/load does not yet preserve the proposed component identity
Location: docs/design/qwen4-exp-text-core.md:449-455,473-480,520-521
Confidence: High
The proposal permits independently building or saving only main or ngram, selecting loads by those canonical keys, and preserving split keys through a filtered roundtrip. However, the existing persistence mechanism does not recover those keys for a singleton:
_ComponentSaveLayout.uses_subdirectoriesuses component subdirectories only when more than one component is selected.- The save loop writes a singleton to the root
model.onnx. - Flat-directory loading derives the key from the filename, yielding
model, notmainorngram.
Thus, preserving the existing save behavior is insufficient to establish the proposed canonical-key roundtrip. This is a source-proven design gap, not a claim that an unimplemented split was executed and failed.
Minimal revision: Specify the narrow identity/layout extension: for example, split-only named directories, canonical-key recovery metadata, or explicitly different flat-load semantics. Preserve legacy defaults and distinguish singleton builds, a full package filtered to one component, and direct loading of a component subdirectory.
Other findings: Minor
| Location in this document | Finding | Minimal revision |
|---|---|---|
299,352-359 |
Adding attention_mask[B,P+S] moves masked-ID-to-EOS substitution into the ngram graph, whereas #767 specifies a mask-free lookup graph and host substitution. The alternative is not inherently invalid, but the parent/child boundary differs. |
Either retain host preprocessing or explicitly identify this as a proposed contract change requiring approval and synchronization with #767. |
255-256 |
The target EP is not defined, so the supported scope and behavior of split_ngram=True on other profiles are unspecified. |
Name the supported export profile(s) and the explicit rejection or pending-decision policy for other profiles; do not imply an unapproved fallback. |
514-525 |
The proposed test locations do not match #770/#771's mandatory entry points. The mapping plan also does not explicitly require value-based binding and proof that unrelated payloads are not accessed. | Align with src/mobius/models/qwen4_exp_split_test.py, the relevant src/mobius/integrations/transformers/_qwen4_exp_weights_test.py cases, and src/mobius/models/qwen4_exp_split_generation_test.py. Include same-shape/different-value sentinels and unrelated-source access assertions. Proposed tests need not already exist in this docs-only PR. |
366-368 |
Saying the mask suppresses the PLE contribution can imply that the entire PLE output is zero at a masked position. In the pinned implementation, the mask zeros the current gated value and convolution input before the stateful convolution; historical convolution state can still contribute. | Explicitly preserve that ordering and avoid implying an additional post-convolution mask. See qwen4_exp.py:635-641. |
538-540 |
Some pinned source ranges do not point to the claimed behavior. Main mask/EOS processing is at 1337-1359, VLM source ownership at 1930-1939, and the PLE citation should include the mask/convolution logic through 641. |
Correct the source ranges. This is a traceability correction, not a finding that the underlying broad claims are false. |
Findings ledger and minority positions
These are synthesis decisions, not unanimous reviewer agreement:
| Issue | Raised by | Disposition |
|---|---|---|
| Singleton component identity | Code and Critical | Confirmed Major; directly checked against the pinned save/load branches. |
| Parent versus proposed mask boundary | Readability: Major; Deep: open choice; Integration: permissible refinement | Confirmed Minor, downgraded by the lead. The unacknowledged boundary change is real, but does not prove an invalid graph. |
| Cross-root/nested-MTP sharing mechanism | Readability: Major; Code and Integration: open question | Rejected as an established merge blocker, retained below as an implementation-readiness question. Ordinary text/VLM owners are listed, and companion #777 explicitly gates sharing integration. |
| Instance-level manifest/source-name/selected-buffer extensions | Integration: Major | Rejected as an established merge blocker, retained below. This proposal already allows narrow ownership and selected-binding extensions; missing implementation details alone do not invalidate a proposed API. |
| Verification target locations | Integration: Major; Code: Minor | Confirmed Minor, downgraded by the lead. Required entry points need alignment; proposed files not already existing is not itself a defect. |
Open decisions before implementation
- Readability / Code / Integration: Define how shared token-table/head identities span the root manifest and nested
mtp_head, including selected binding. Current same-manifest endpoint constraints do not by themselves establish cross-package coordination. - Integration / Code: Specify instance-level manifest/source renames and selection-aware deterministic-buffer validation, including supported checkpoint formats and existing FP8 limitations.
- Readability: Settle cold-start, zero-length chunk, EOS-list, and non-binary-mask behavior. Do not collapse per-layer history without proof and approval.
- Critical: Decide whether component compatibility includes checkpoint/hash-config semantic identity, beyond matching ABI, layer order, dimensions, and dtype.
- Integration: State whether the opt-in is intentionally Python-only, and how saved/reloaded split packages remain recognizable to metadata/runtime consumers when config is not restored.
- Readability: Clarify selector-key/module-attribute/role mapping, non-
Noneselection in unsplit mode, retainedple_input_idsbookkeeping, and the future main-tap request contract coordinated with #777.
Exclusions: No runtime numerical parity, fault-injection/rollback behavior, memory/performance measurements, official-weight qualification, quantization execution, native GenAI execution, or Olive validation. Existing QSA cutoff-tie limitations and the BF16 vision restriction remain unchanged. These documentation changes introduce no executable trust boundary; no new vulnerability claim is made.
Apply the reviewed contract corrections for the opt-in text-component design, including the standard-only example and the explicit approval boundary. Preserve the unsplit default and keep all proposed interface choices clearly gated for review. Validation: documentation-only change; git diff --check passed and only the intended document was staged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2d24442a-b68c-452f-8538-12f34b5bc4ea Signed-off-by: titaiwang <titaiwang@microsoft.com>
02a50f0 to
5674408
Compare
|
Addressed the documentation review in 5674408.
The second full static review identified the missing EP arguments in the revised examples; those were corrected and directly checked without starting a third review round. The PR-description example is aligned too. Validation: These are proposal/documentation fixes, not implemented loader or split behavior. Cross-package MTP sharing, semantic checkpoint/hash pairing, the main-tap selector, transaction semantics, predecessor gates, and explicit maintainer approvals remain open where previously required. |

Defines a proposed, opt-in contract for independently loadable Qwen4-Exp ngram and main components, while preserving unsplit defaults. The proposal makes the seam, state ownership, component selection, weight routing, and persistence behavior explicit for review.
[L,B,S,D]embedding layout.All new interface choices remain proposals pending explicit maintainer approval.