Repository navigation
feat(deepseek): carry V4.1 main-input and dSpark replay adapters - #3616
Merged
Qubitium merged 1 commit intoNov 9, 2026
Merged
Conversation
This was referenced Nov 8, 2026
Extract the existing working fork feature for first maintainer feedback. Preserve carried code and tests; limit validation to lightweight structural checks. See the linked mechanism reference for actual API/call and failure paths.
Qubitium
force-pushed
the
upstream/36-v41-dspark-replay-20261108
branch
from
November 9, 2026 10:02
2e2e3e4 to
0153028
Compare
Qubitium
reviewed
Nov 9, 2026
Qubitium
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed against current main.
The input adapters are bounded and keep tokenizer/sampling policy out of the source layer:
V41MainInputowns only the token embedding, small hash/rotary state, and mapped PLE handles.preparerequires nonempty integer[batch, sequence]ids, expands the embedding to thehc_multstream shape, sets the stream-zero pre flag, buildsmain/compressrotary state and position ids, and copies hidden/rotary/PLE rows to owned CPU storage before returning the replay batch.close()closes every mapped table.V41DSparkInput.forwardprojects the target-layer history throughmain_norm(main_proj(...))and embeds the known token followed by noise;prepare_jointrequires one source prompt, sorted distinct in-range anchors, and a shared target prefix, and returns a sharedmain_xprefix with one draft block per anchor.prepareslices future main features away before projection and substitutes the corpus next token for the main model's sampled token, leaving later draft positions as noise.- Both return
V41ReplayBatchwith owned CPU tensors, so downstream capture/checkpoint code never retains GPU state from these adapters.
Validation: no in-tree tests for this layer, so I exercised the shape contracts directly — prepare(position=3) yields hidden [1,4,2,8] and main_x [1,4,8]; prepare_joint(positions=[2,4]) yields hidden [2,4,2,8] with the shared main_x [1,5,8]. Modules import cleanly; cleanup was one dict(...) literal.
No blocking issues found.
Qubitium
marked this pull request as ready for review
November 9, 2026 10:02
8 tasks done
Qubitium
added a commit
that referenced
this pull request
Nov 29, 2026
…ers (#6408) ds4rt is deprecated and is being refactored into method-agnostic features. The per-model calibration adapters it added (#3606-#3616) have no production caller: nothing in gptqmodel/ or scripts/ imports them, MODEL_MAP reaches none of them, and only their own doc pages and unit tests cite them. Delete 14 adapter utils plus exl3_hessian.py (its only user was kimi_k31): kimi_k3, kimi_k3_core_format, kimi_k3_core_stream, kimi_k31, glm5_core, glm5_mtp, glm5_flash_core, glm5_flash_mtp, step5_core, v41_capture, v41_checkpoint, v41_mixed_replay, v41_recovery and v41_routed_batch, with their 9 dedicated test files, their 9 doc pages and the index links. This also removes two policy violations that lived only in this code: step5_core.py ran an external families/step5/golden.py through exec_module with no trust_remote_code / GPTQ_BYPASS_SAFETY_CHECKS gate, and glm5_flash_core.py replaced chunk_kimi_delta_attention on the vendored glm5_next port module. The GPTQMODEL_KIMI_K3_UTILS env var in test_kimi_k3_support.py, which exec'd an arbitrary file, goes too. Kept: - ple_mmap.py: used by the deepseek_v41_flash port and definitions/deepseek_v41. - v41_source, v41_replay, v41_inputs, v41_dspark, v41_native: imported by tests/test_deepseek_v41_local_port.py, test_v41_checkpoint_mapped_ple.py and (v41_native) ports/deepseek_v41. They go with the separate ports/deepseek_v41 removal. - Tests of live code that lived in deleted files move to test_exl3_bitstream_oracle.py (ExllamaV3TorchLinear bitstream decode) and test_exllamav3_padded_output.py (ExllamaV3Linear padded output crop). The Kimi K3 definition, auto.py, kimi_linear.py and docs no longer point at the deleted "bounded KimiK3Source runner"; the NotImplementedError types and the substrings the tests match are unchanged. Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Summary
Carry native text input preparation without decoder allocation, grouped teacher-forced draft anchors, shared main-prefix projection, dSpark continuation and explicit joint-ring state.
This is layer 36/36, extracted from an already-used fork for initial maintainer feedback. It depends on #3615. Review only this feature; the cross-fork Files changed view is cumulative because the PR targets upstream
main.Incremental change: 4 files, +180/−0 lines, including carried tests and the mechanism reference. No merge is automatic. Review value and API shape first; substantial rework can follow that feedback.
Flow and existing-code boundary
flowchart TD S0["V41DSparkInput"] M0_0["V41DSparkInput.__init__"] M0_1["V41DSparkInput.forward"] M0_2["V41DSparkInput.prepare_joint"] S1["V41MainInput"] M1_0["V41MainInput.__init__"] M1_1["V41MainInput.prepare"] E["ValueError"] S0 -. "exposes" .-> M0_0 S0 -. "exposes" .-> M0_1 S0 -. "exposes" .-> M0_2 S0 -->|"raises on rejected input/state"| E S1 -. "exposes" .-> M1_0 S1 -. "exposes" .-> M1_1 S1 -->|"raises on rejected input/state"| E style E fill:#fee,stroke:#b22gptqmodel/utils/v41_dspark.py:9:V41DSparkInputgptqmodel/utils/v41_inputs.py:9:V41MainInputCommitted reference: docs/v41-dspark-replay.md, linked from README. Class entry points/calls and rejected-state paths describe code present in this branch, rather than planned integrations.
Validation
Carried test files: No standalone test file existed in the fork for this helper; retained original implementation and documented the structural checks.
This packaging pass checked Python parsing, whitespace, dependency order and balanced Mermaid blocks. The author reports successful prior use of these features. Per the requested resource limit and feedback-first scope, existing model quantization, GPU/ROCm tests, heavyweight CPU workloads and full model benchmarks were not rerun; no new performance or model-accuracy claim is made. Tests accompanying earlier stack layers retain their previously reported results.
V4.1 remains an explicit native calibration/replay API and is not added to MODEL_MAP. The source requires its native/reference implementation; upstream inventory documentation alone does not provide that runtime.