Repository navigation
chore(writer): delete the save-state overlay contract (no implementer since #6435) - #6667
Merged
Merged
Conversation
… since #6435) The save-state overlay was a hook for an attached auxiliary model to replace tensor prefixes during save. Its only implementer, DeepSeekV4QModel.save_state_overlay, was deleted with the unreachable DeepSeek-V4 MTP calibration stack in #6435; `git grep` plus an AST string/attribute scan over gptqmodel/ (including ports/), tests/, docs/ and examples/ finds no other provider, and the hook is not documented as an out-of-tree extension point. Delete the contract: the provider lookup, the three validators, the tensor-storage merge, the passthrough/state-dict application, and the tests that only exercised the overlay. The EXL3 publication guard and checkpoint passthrough (normal save paths) stay; save_quantized calls them without an overlay. The native-checkpoint-export reference page is updated accordingly. No behavior change: with no provider the removed calls were no-ops. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Qubitium
force-pushed
the
refactor/save-state-overlay
branch
from
December 1, 2026 16:32
f41eef2 to
49f7ad3
Compare
Qubitium
marked this pull request as ready for review
December 1, 2026 17:43
5 tasks done
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
The save-state overlay was a writer hook for an attached auxiliary model to replace tensor prefixes during save (built for the DeepSeek-V4 MTP stack). Its only implementer,
DeepSeekV4QModel.save_state_overlay, was deleted with the unreachable DeepSeek-V4 MTP calibration stack in #6435. Currentorigin/mainhas zero implementers, so this PR deletes the contract instead of polishing its validators.No behavior change: with no provider, every removed call was a no-op.
Zero-implementer verification
git grep -n "save_state_overlay"over the whole repository: onlygptqmodel/models/writer.py(the provider lookup),tests/test_writer_state_overlay.py(the test_Owner),tests/test_docs_contract_refs.py(the citation entry) anddocs/native-checkpoint-export.md(the call map)..pyfile undergptqmodel/(includingmodels/ports/),tests/,docs/,examples/for the attribute name, string literals andgetattrstrings: no other production reference.git grepoverAGENTS.md,contracts/anddocs/finds no out-of-tree extension-point contract for the hook.docs/native-checkpoint-export.mddocuments the writer's internal call map, not a definition API; it is updated by this PR.What Changed
gptqmodel/models/writer.py(+8/−270):_validated_save_state_overlayand its two field validators (_validated_save_state_overlay_suffixes,_validated_save_state_overlay_removals)._apply_save_state_overlay(state-dict prefix replacement) and_build_exllamav3_tensor_storage_for_save(its only purpose was merging overlay EXL3 storage;save_quantizednow callsbuild_exllamav3_tensor_storage(self.model)directly).validated_overlayparameters and overlay branches from_validate_exllamav3_publication_modulesand_build_exllamav3_checkpoint_passthrough_state_dict, and the overlay call/args insave_quantized.Tests (only the contract): deleted
_Ownerand 9 tests / 11 nodes fromtests/test_writer_state_overlay.py:test_save_state_overlay_replaces_only_declared_prefixestest_save_state_overlay_removes_checkpoint_alias_prefixestest_save_state_overlay_removal_fails_closed_on_missing_source_suffixtest_save_state_overlay_fails_closed_on_missing_prefixtest_save_state_overlay_fails_closed_on_tensor_contracttest_save_state_overlay_rejects_ambiguous_prefix_contract(3 params)test_save_tensor_storage_includes_exact_overlay_modulestest_save_tensor_storage_fails_closed_on_missing_overlay_moduletest_save_tensor_storage_fails_closed_on_tensor_contractKept the 8 normal-path tests (EXL3 publication guard, checkpoint passthrough, prefixed state collection).
Docs:
docs/native-checkpoint-export.mdretitled and de-overlayed; the_validated_save_state_overlaycitation removed fromtests/test_docs_contract_refs.py; link text and the offload-directory note updated.Tests
Save A/B
The same 8-config writer harness from #6666 (
meta_ab.py, kept out of the repo) on main vs branch:gptq_default,gptq_gptaq,gptq_foem,gptq_jointq,awq,gguf,paro,exl3. Each case savesconfig.json,quantize_config.jsonandmodel.safetensors; the dump records the sha256 of every file plus themetakey order.The two DeepSeek-V4 save tests (the ex-overlay consumer's family) pass on both trees.
Measured Impact
Not applicable: no runtime, memory or accuracy change; the deleted calls returned immediately without a provider.
Model Support / Module Plan
Not applicable: no
MODEL_MAP, module-tree, plan or definition change.AWQ onboarding safety
Not applicable: no AWQ grouping, search, replay or fold change; AWQ appears only as a save A/B case.
Logic Flow Documentation
Removed path:
save_quantized->_validated_save_state_overlay(provider lookup) -> overlay validation/application -> EXL3 storage merge. With no provider, the lookup returnedNoneand every consumer returned unchanged.flowchart LR A[save_quantized] --> B{provider?} B -->|none| C[normal save] B -->|contract| D[validated overlay] D --> E[apply overlay / merge EXL3 storage] style D fill:#fee,stroke:#b22 style E fill:#fee,stroke:#b22_validated_save_state_overlay,_validated_save_state_overlay_suffixes,_validated_save_state_overlay_removals_validate_exllamav3_publication_modules_apply_save_state_overlay_build_exllamav3_checkpoint_passthrough_state_dict_build_exllamav3_tensor_storage_for_save(overlay merge wrapper)build_exllamav3_tensor_storage(called directly)validated_overlay=parameters and branches_exllamav3_checkpoint_passthrough_plan,_exllamav3_owned_native_source_namesNo docs page is needed for a deletion; the updated
docs/native-checkpoint-export.mdcovers the remaining passthrough flow.Review Requirements
Kernel Accuracy Requirements
Not applicable: no kernel, dispatch or fusion change.
Notes
save_quantizednow callsbuild_exllamav3_tensor_storage(self.model)directly; the deleted wrapper did exactly that when no overlay existed.docs/native-checkpoint-export.mdis a proposed-feature reference page; it now documents only the passthrough it still ships.split_by="layer"writer was left untouched.🤖 Generated with Claude Code