Skip to content

feat(deepseek): persist authenticated typed V4.1 frontiers - #3615

Merged
Qubitium merged 1 commit into
ModelCloud:mainfrom
tpurtell:upstream/35-v41-durable-frontiers-20261108
Nov 9, 2026
Merged

Qubitium merged 1 commit into
ModelCloud:mainfrom
tpurtell:upstream/35-v41-durable-frontiers-20261108

Conversation

@tpurtell

@tpurtell tpurtell commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Carry atomic content-bound V4.1 frontier and routed-batch storage, typed tree encoding, exact provenance validation, and nested quantizer metric preservation.

This is layer 35/36, extracted from an already-used fork for initial maintainer feedback. It depends on #3614. Review only this feature; the cross-fork Files changed view is cumulative because the PR targets upstream main.

Incremental change: 3 files, +197/−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["save_frontier"]
    S1["load_frontier"]
    S2["save_routed_batch"]
    S3["load_routed_batch"]
    E["ValueError"]
    S0 -->|"raises on rejected input/state"| E
    S1 -->|"raises on rejected input/state"| E
    S2 -->|"raises on rejected input/state"| E
    style E fill:#fee,stroke:#b22
Loading
Before this extraction layer Carried implementation
API absent in the previous stack layer (path/symbol checked) gptqmodel/utils/v41_checkpoint.py:131: save_frontier
API absent in the previous stack layer (path/symbol checked) gptqmodel/utils/v41_checkpoint.py:138: load_frontier
API absent in the previous stack layer (path/symbol checked) gptqmodel/utils/v41_checkpoint.py:152: save_routed_batch
API absent in the previous stack layer (path/symbol checked) gptqmodel/utils/v41_checkpoint.py:161: load_routed_batch

Committed reference: docs/v41-durable-frontiers.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.

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
Qubitium force-pushed the upstream/35-v41-durable-frontiers-20261108 branch from f8b4aa7 to 72824f7 Compare November 9, 2026 10:00

@Qubitium Qubitium left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed against current main.

The durable-frontier format is atomic and authenticated end to end:

  • _save_state snapshots tensors to owned contiguous CPU storage, encodes the state into a JSON manifest stored in safetensors metadata, writes to a mkstemp sibling, fsyncs, then os.replaces and fsyncs the directory. The returned SHA-256 is computed over the published bytes, and the caller is expected to journal it only after save returns.
  • Provenance is mandatory and must round-trip through json.dumps/json.loads unchanged, which rejects tuples, integer keys, and NaN before they can be silently normalized.
  • _load_state verifies the journal digest first, then keeps the same inode open through /proc/self/fd so an atomic replacement cannot swap the file between checksum and mapping. It enforces manifest version, kind (with old snapshots defaulting to replay), exact provenance, and rejects aliased or unreferenced tensors.
  • save_frontier/load_frontier and save_routed_batch/load_routed_batch type-check the batch, validate geometry, and never treat a frontier as a completed block commit.

Validation: no in-tree tests for this layer, so I exercised it directly — save/load round-trip for a V41ReplayBatch and a V41RoutedBatch, plus checksum-mismatch and provenance-mismatch rejection all behaved as intended. Module imports cleanly; cleanup was import ordering and one dict(...) literal.

No blocking issues found.

@Qubitium
Qubitium marked this pull request as ready for review November 9, 2026 10:00
@Qubitium
Qubitium merged commit ca3fbed into ModelCloud:main Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants