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/32-step5-native-calibration-20261108
branch
from
November 9, 2026 09:56
9ff6e90 to
a832519
Compare
Qubitium
reviewed
Nov 9, 2026
Qubitium
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed against current main.
The Step-5 adapter adds loading/observation boundaries without reimplementing attention, which is the right split:
step5_corepins the revision, reuses the GLM corecapture_linear_input/reconstruct_projection/validate_projection, and adds only the Step-5 Hessian and projection stages.accumulate_hessian_fp32validates square FP32 storage, an integer1..128product bound, finite floating activations with a matching last dimension, and accumulatesaddmm_in bounded chunks.DenseRawHessian.addincrementscountonly after the accumulation succeeds, so invalid observations cannot inflate the dense sample count (covered by the parameterized tests).quantize_projectionkeeps the same fresh-Hessian/geometry/metric validation as the GLM path while allowing the Step-5 K4/K5/K6 rates.- Tests cover unsafe/non-integer product bounds, non-incrementing invalid observations, FP32-storage enforcement, and the bounded product behavior.
Cleanup only: unused imports, import ordering, dict(...) → literals, and semicolon-split lines in the test harness.
Validation: ruff check clean; pytest tests/test_step5_core.py reports 36 passed.
Qubitium
marked this pull request as ready for review
November 9, 2026 09:56
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 Step-5 source/reference loading, bounded fused-expert reads, actual-row covariance products, functional indexer W input observation without extra GEMMs, explicit stage replay, and MTP alignment. Preserve the reviewed source config instead of mutating its document.
This is layer 32/36, extracted from an already-used fork for initial maintainer feedback. It depends on #3611. Review only this feature; the cross-fork Files changed view is cumulative because the PR targets upstream
main.Incremental change: 4 files, +890/−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["Step5BF16Source"] M0_0["Step5BF16Source.__init__"] M0_1["Step5BF16Source.materialize_block"] M0_2["Step5BF16Source.load_block"] S1["capture_inputs"] S2["staged_forward"] S3["load_mtp"] E["ValueError"] S0 -. "exposes" .-> M0_0 S0 -. "exposes" .-> M0_1 S0 -. "exposes" .-> M0_2 S0 -->|"raises on rejected input/state"| E S1 -->|"raises on rejected input/state"| E S3 -->|"raises on rejected input/state"| E style E fill:#fee,stroke:#b22gptqmodel/utils/step5_core.py:148:Step5BF16Sourcegptqmodel/utils/step5_core.py:380:capture_inputsgptqmodel/utils/step5_core.py:372:staged_forwardgptqmodel/utils/step5_core.py:498:load_mtpCommitted reference: docs/step5-native-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:
tests/test_step5_core.pyThis 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.