Repository navigation
Conversation
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/34-v41-routed-calibration-20261108
branch
from
November 9, 2026 09:59
e34b9c8 to
dbf2f72
Compare
Qubitium
reviewed
Nov 9, 2026
Qubitium
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed against current main.
The routed-capture layer is correctly separated from post-quantization propagation:
V41RoutedBatchis an owned CPU frontier (hidden,logits,weights,indices) andvalidatechecks matrix geometry, finite floating values, expert-index bounds, and duplicate assignments per row.from_replayregisters a gate hook, copies the gate output throughowned_tree, then raises a privateCapturedexception to stop the block before any expert GEMMs; the hook is removed infinallyand the frontier must be captured exactly once. That keeps every expert subset on identical normalized FFN inputs and natural routes.v41_capture,v41_recovery, andv41_mixed_replaycarry the adjacent-recovery and mixed-tier replay pieces without duplicating the source or replay modules.
Validation note: this layer adds no tests of its own. All four modules import cleanly on the installed stack, and cleanup was limited to dict(...)/dict.fromkeys style.
No blocking issues found.
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 bounded expert Hessian and natural-route capture, validated routed calibration batches, adjacent-router recovery, phase-specific frontier reuse, and packed selected-projection replay.
This is layer 34/36, extracted from an already-used fork for initial maintainer feedback. It depends on #3613. Review only this feature; the cross-fork Files changed view is cumulative because the PR targets upstream
main.Incremental change: 6 files, +419/−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["V41Capture"] M0_0["V41Capture.__init__"] M0_1["V41Capture.__enter__"] M0_2["V41Capture.capture_routed"] S1["V41Recovery"] M1_0["V41Recovery.__init__"] M1_1["V41Recovery.__enter__"] S2["V41RoutedBatch"] M2_0["V41RoutedBatch.validate"] S3["install_projection"] E["Captured, RuntimeError, 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 S2 -. "exposes" .-> M2_0 S2 -->|"raises on rejected input/state"| E S3 -->|"raises on rejected input/state"| E style E fill:#fee,stroke:#b22gptqmodel/utils/v41_capture.py:11:V41Capturegptqmodel/utils/v41_recovery.py:15:V41Recoverygptqmodel/utils/v41_routed_batch.py:10:V41RoutedBatchgptqmodel/utils/v41_mixed_replay.py:10:install_projectionCommitted reference: docs/v41-routed-calibration.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.