Skip to content

chore(deepseek_v4): delete the unreachable DeepSeek-V4 MTP calibration stack - #6435

Merged
Qubitium merged 1 commit into
mainfrom
refactor/drop-mtp-calibration-stack
Nov 29, 2026
Merged

Qubitium merged 1 commit into
mainfrom
refactor/drop-mtp-calibration-stack

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Summary

This deletes the DeepSeek-V4 integrated MTP (dSpark) calibration stack from gptqmodel/models/definitions/deepseek_v4.py. Nothing in the tree calls it. The maintainer approved the deletion; it came out of the debloat audit (ds4rt map, row 16).

Nothing in the definitions, the looper, the writer, scripts/ or the CLI calls build_mtp_quantization_model, DeepSeekV4MTPQuantizationModel.from_target_model / from_auxiliary, attach_mtp_quantization_model, set_mtp_target_tap_sink or configure_mtp_activation_store. Only tests did. So a default quantize never builds the MTP shell, never installs a target-tap sink and never attaches a save overlay.

What happens to MTP modules is unchanged, and this is how it works today. The DeepSeek-V4 target model has no mtp module: the port ignores mtp.* on load through _keys_to_ignore_on_load_unexpected. The mtp.* checkpoint tensors are never quantized. The writer republishes them byte-for-byte through DeepSeekV4QModel.out_of_model_tensors ("prefixes": ["mtp", ...]), which this PR leaves alone. A new CPU test pins this, and the quantize A/B below shows it on a checkpoint that carries mtp.* tensors.

What Changed

Deleted from deepseek_v4.py (about -2,320 lines of production code):

  • The MTP checkpoint-key contract (expected_/validate_deepseek_v4_mtp_checkpoint_keys, deepseek_v4_mtp_target_layer_ids, MTP_BLOCK_COUNT), deepseek_v4_mtp_module_tree, deepseek_v4_mtp_checkpoint_mapping_reversed, MTP_ROUTED_EXPERT_MODULE_PATTERN and the MTP_REPLAY_* keys.
  • DeepSeekV4MTPAuxiliaryShell / DeepSeekV4MTPAuxiliary and their heads, the DeepSeekV4MTPReplay* dataclasses, DeepSeekV4MTPTargetTapEvent, DeepSeekV4TargetAnchorResolver, DeepSeekV4MTPPrefixRuntime, DeepSeekV4MTPReplay and the per-block replay forward.
  • These DeepSeekV4QModel members:
    • mtp_auxiliary_module_tree;
    • the mtp.* branch of exllamav3_checkpoint_module_candidates, plus deepseek_v4_mtp_source_projection_prefix;
    • attach_mtp_quantization_model and save_state_overlay;
    • set_mtp_target_tap_sink and its quantization_layer_output_required / receive_quantization_layer_outputs overrides;
    • build_mtp_auxiliary, build_mtp_quant_source_module, build_mtp_prefix_runtime, build_mtp_quantization_model and materialize_mtp_replay_submodule.
  • _DeepSeekV4MTPPreparedDataset / _DeepSeekV4MTPInputProvider / _DeepSeekV4MTPInputView, and every member of DeepSeekV4MTPQuantizationModel except zero_route_recovery_context: class attributes, the AWQ no-op, after_model_load, the factories, configure_mtp_activation_store, the MTP output writer, input capture, prepare_dataset, build_quantization_input_cache, run_input_capture, pre_quantize and post_quantize.

Why each deletion leaves live behavior unchanged:

  • With no sink installed, the deleted quantization_layer_output_required override returned False. That is exactly what the BaseQModel default (base.py:5762) returns, and the structural A/B shows the same answers on every layer. receive_quantization_layer_outputs is only called when that hook returns True.
  • The target model never has mtp.* EXL3 modules, so the deleted mtp.* branch of exllamav3_checkpoint_module_candidates was only reachable through the attached-adapter overlay.
  • save_state_overlay returned None unless an adapter was attached. The writer (writer.py:1576) treats a missing provider the same way.

Kept on purpose. Each of these is live or out of scope:

  • zero_route_recovery_context (680 lines) stays on DeepSeekV4MTPQuantizationModel, byte-for-byte unchanged. DeepSeekV4QModel, Dots3NoteQModel, GlmMoeDsaQModel and Glm5NextQModel call it as an unbound method, and looper/stage_subset.py calls it. Moving it belongs to the separate route-recovery refactor. Only the class docstring changes, to say the class now only hosts that method. Keeping the class name avoids touching the three trampolines.
  • The MTP_CAPTURE_* input-capture hooks (begin_input_capture_example, end_input_capture_example, capture_first_layer_input_kwargs, prepare_layer_replay_kwargs) run on every DSv4 quantize. They reject labels that do not match input_ids with ValueError, and they add then pop capture metadata. That is live behavior, so they stay.
  • GLM-5.3 Flash (glm5_next.py) integrated MTP is live and untouched. Glm5NextQuantizationLoader always appends Glm5NextMTPDecoderLayer as layer 45, and the ordinary layer traversal quantizes its routed experts. glm_moe_dsa.py (layer 78 passthrough) and dots3_note.py (MTP excluded) only declare out_of_model_tensors and have no calibration code, so they are untouched too. No step5 definition exists in-tree.
  • configure_base_replay_store and the target-layer create_quantization_layer_output_writer are not MTP, so they stay.

Docs and tests:

  • Removed docs/deepseek-v4-mtp-replay.md and its index line.
  • Trimmed three sentences that cited the deleted code, in multi_gpu_quantization.md, torch-compile-fallback.md and vlm-calibration-input-normalization.md.
  • Removed the tests of the deleted API: 18 nodes in tests/test_deepseek_v4_support.py, 1 in tests/test_lazy_turtle_conversion_mapping.py, and 1 assertion in tests/module_tree/test_deepseek_v4_local_port.py.
  • test_lazy_turtle_conversion_mapping.py used a module-level try/except ImportError: pytest.skip(...) around the MTP imports. It is now a plain import, so deleting those symbols cannot silently skip the whole file.

No public API changes outside the deleted MTP symbols. No numerics or checkpoint-format changes.

Diff (git diff --shortstat origin/main...HEAD): 9 files changed, 160 insertions(+), 3383 deletions(-), of which gptqmodel/ is 107 insertions(+), 2419 deletions(-). Git's default Myers diff mis-aligns two hunks. With --diff-algorithm=histogram the totals are 59 insertions(+), 3282 deletions(-), and gptqmodel/ is 6 insertions(+), 2318 deletions(-): the import trim plus the new docstring.

Out of scope. These have no provider or caller in-tree after this PR, and each belongs to another refactor:

  • The quantization_layer_output_required / receive_quantization_layer_outputs base hooks and their looper/stage_layer.py call sites (:951, :1083, :1387).
  • The writer's save-state overlay plumbing (writer.py:1576, _apply_save_state_overlay, _build_exllamav3_tensor_storage_for_save).
  • EXL3CaptureFrontierStore.discard_through.
  • EXL3Config.module_include, which is public config API and was set in-tree only by the deleted from_auxiliary.

Tests

  • Unit tests have been executed and passed, or the reason they are not applicable is documented.
  • I added a new simple/fast unit test for this change, or documented why that is not applicable.

New test: tests/test_deepseek_v4_support.py::test_default_quantize_keeps_integrated_mtp_tensors_native. It runs a CPU RTN quantize and save of a tiny V4 checkpoint that carries mtp.* tensors. It asserts the model has no mtp module and that every mtp.* tensor is saved with the same dtype and values. It passes on both origin/main and this branch.

Pytest A/B, CPU, CUDA_VISIBLE_DEVICES="", PYTHONPATH=<tree>, python -P; gptqmodel.__file__ printed for each tree:

python -P -m pytest tests/module_tree tests/test_deepseek_v4_support.py tests/test_deepseek_v4_local_port.py \
  tests/test_awq_deepseek_v4_hash_moe_4880.py tests/test_awq_deepseek_v4_rotary_4695.py tests/test_awq_hash_moe_kept_rows_5015.py \
  tests/test_awq_scaling_groups.py tests/test_awq_shared_indexer_replay.py tests/test_auto_module_decoder.py \
  tests/test_glm5_next_support.py tests/test_glm5_next_upstream_support.py tests/test_glm_moe_dsa_support.py tests/test_glm_nope_config.py \
  tests/test_lazy_turtle_conversion_mapping.py tests/test_writer_state_overlay.py tests/test_out_of_model_tensors.py \
  tests/test_model_port_policy.py tests/test_docs_contract_refs.py tests/test_qwen4_exp_exl3_contracts.py tests/test_defuser_vendored_classes.py \
  tests/test_native_auto_registry.py tests/test_native_definition_loading_0.py tests/test_native_definition_loading_3.py \
  tests/test_kv_cache_estimate.py tests/test_offload_files.py tests/test_model_dequant_fp8.py tests/test_leapquant_models.py \
  tests/test_missing_tokenizer_6361.py tests/test_deepseek_v41_local_port.py tests/test_transformers_unpatched.py \
  tests/test_exl3_error_ledger.py tests/test_exl3_router_candidates.py
# origin/main 2fc316926: 4688 passed, 823 skipped, 2 xfailed
# branch:                4670 passed, 823 skipped, 2 xfailed
# 5494 common node ids: identical outcomes (0 differences). 19 nodes exist only on main (the deleted MTP tests listed above);
# 1 node exists only on the branch (the new pin test, passed). No failures or errors.

After rebasing onto a4471c53b, which touched test_lazy_turtle_conversion_mapping.py, utils/structure.py and a docs index, the affected set was rerun:

python -P -m pytest tests/test_deepseek_v4_support.py tests/test_lazy_turtle_conversion_mapping.py tests/test_docs_contract_refs.py \
  tests/module_tree/test_deepseek_v4_local_port.py tests/test_deepseek_v4_local_port.py tests/test_model_port_policy.py \
  tests/test_glm5_next_support.py tests/test_glm5_next_upstream_support.py tests/test_glm_moe_dsa_support.py \
  tests/module_tree/test_dots3_note_fork_plan.py tests/module_tree/test_registered_module_plans.py \
  tests/module_tree/test_flash_model_tree_consumption.py tests/test_writer_state_overlay.py tests/test_out_of_model_tensors.py \
  tests/test_transformers_unpatched.py
# origin/main a4471c53b: 929 passed; branch: 911 passed; 910 common nodes identical; -19 deleted, +1 new (passed)

Opt-in coverage, A/B: pytest tests/module_tree/test_moe_expert_coverage.py -m meta_coverage -k "deepseek_v4 or dots3_note or glm5_next or glm_moe_dsa". Both trees gave the same result: glm5_next passed, deepseek_v4 and glm_moe_dsa xfail (installed Defuser leaves the experts fused), and dots3_note skipped (same Defuser reason).

bash format/check.sh: All checks passed! (ruff 0.14.2).

Skips. They are the same 823 on both trees. All are CUDA/ROCm hardware gates, Marlin qualification, opt-in meta_coverage, or the registry's "not constructible offline" entries. In the touched files the only skips are 5 DeepSeek-V4.1 CUDA/SM80 tests in module_tree/test_deepseek_v41_flash.py, so the V4.1 CUDA paths are not verified here. This PR does not touch V4.1.

Structural A/B

The script (structural_dump.py, run on each tree with PYTHONHASHSEED=0, then diffed) checks the following:

  • It imports every gptqmodel.* module (1522). Import failures are identical (13, all from optional dependencies). The only module whose names change is definitions.deepseek_v4, which loses exactly the deleted symbols.
  • MODEL_MAP is identical (210 entries).
  • ModulePlan.from_tree(cls.module_tree).to_dict() is identical for all 186 MODEL_MAP definitions.
  • The BaseQModel subclass graph is identical. That includes DeepSeekV4MTPQuantizationModel(DeepSeekV4QModel).
  • It fingerprints every class member: source sha for callables, repr for data. Across all MODEL_MAP definitions, only DeepSeekV4QModel differs: the deleted members, the trimmed exllamav3_checkpoint_module_candidates, and the two output hooks now resolving to BaseQModel. Glm5NextQModel, GlmMoeDsaQModel and Dots3NoteQModel are identical.
  • For DeepSeek-V4 meta builds over all 3 attention types × 2 MLP types, module_plan().to_dict(), simple_layer_modules, the per-parameter plan owner/flags/roles, and the hook answers are identical. The hook answers checked: quantization_layer_output_required is False on every layer, the output writer is None, the save overlay is None, the target EXL3 candidates match, and there is no mtp module.

Quantize A/B (CPU; no GPU needed, and no GPU was used)

The source is a tiny random DeepSeek-V4 checkpoint (3 layers, hidden 64, 3 routed experts) with 5 native mtp.* tensors injected (BF16 and FP32). Both GPTQConfig(bits=4, group_size=-1, device="cpu") and RTNConfig(...) were run, each with GPTQModel.load → quantize(CalibrationConfig(4 fixed-seed rows)) → save. The runs used origin/main (2fc316926, then a4471c53b after the rebase) and this branch.

  • GPTQ: all 245 saved tensors (including the 5 mtp.*) are bit-identical. config.json, quantize_config.json, generation_config.json and the tokenizer files are identical. The quant_log.csv rows (layer, module, loss, samples, damp) are identical. Row order and the time column differ run to run; two runs of origin/main against itself differ the same way.
  • RTN: the same, bit-identical.

Measured Impact

Not applicable. This is a code deletion with bit-identical output.

Model Support / Module Plan

There are no new model types and no plan changes. Registry and model plans are proven identical by the structural A/B above, and tests/module_tree (the full directory) passes with identical outcomes.

Model test node IDs and results: see Tests. tests/module_tree/test_registered_module_plans.py, tests/module_tree/test_deepseek_v4_local_port.py and tests/module_tree/test_dots3_note_fork_plan.py all passed on both trees.

AWQ onboarding safety

Not applicable. No AWQ grouping, search, replay or fold changes. The deleted DeepSeekV4MTPQuantizationModel.awq_get_modules_for_scaling returned [] for an adapter nothing builds. The DSv4 target AWQ tests (test_awq_scale_folds_preserve_real_hyper_connected_layer_output, test_featureless_awq_quantizes_and_packs_all_supported_linears, tests/test_awq_deepseek_v4_*) passed on both trees.

Logic Flow Documentation

  • This change does not alter a major logic flow, or the required diagrams and docs page are included below.

Not applicable. It removes code no flow reaches and replaces no decision mechanism. The default DSv4 quantize flow (capture → layer loop → writer with out_of_model_tensors passthrough for mtp.*) is unchanged.

Review Requirements

  • Reviewed this PR.
  • Checked that the code matches existing project structure, APIs, and conventions.
  • Avoided unnecessary monkeypatching and used the project's normal extension points where possible.
  • Minimized and compacted the impacted code surface.
  • Considered and eliminated potential regressions.

Kernel Accuracy Requirements

Not applicable. No kernel changes.

Notes

  • DeepSeekV4MTPQuantizationModel stays only as the host of zero_route_recovery_context, so this PR is pure deletion and does not move 680 lines. The route-recovery refactor can turn it into a plain function and drop the class.
  • Removed public names (all MTP-only, none used in-tree): DeepSeekV4MTPAuxiliary, DeepSeekV4MTPAuxiliaryShell, DeepSeekV4MTPPrefixRuntime, DeepSeekV4MTPReplay*, DeepSeekV4MTPTargetTapEvent, DeepSeekV4TargetAnchorResolver, deepseek_v4_mtp_*, expected_/validate_deepseek_v4_mtp_checkpoint_keys, MTP_BLOCK_COUNT, MTP_REPLAY_*, MTP_ROUTED_EXPERT_MODULE_PATTERN, and the DeepSeekV4QModel.build_mtp_* / attach_mtp_quantization_model / set_mtp_target_tap_sink / save_state_overlay methods.

🤖 Generated with Claude Code

@Qubitium
Qubitium marked this pull request as ready for review November 29, 2026 20:09
…n stack

The DeepSeek-V4 integrated MTP (dSpark) calibration stack had no in-tree
caller. Nothing in the definitions, the looper, the writer, scripts or the
CLI calls build_mtp_quantization_model, from_target_model, from_auxiliary,
attach_mtp_quantization_model, set_mtp_target_tap_sink or
configure_mtp_activation_store, so a default quantize never built the MTP
shell, never installed a target-tap sink and never attached a save overlay.

Delete it from gptqmodel/models/definitions/deepseek_v4.py:
- the MTP checkpoint-key contract, the auxiliary module tree and the reversed
  checkpoint mapping;
- DeepSeekV4MTPAuxiliaryShell / DeepSeekV4MTPAuxiliary, the replay
  dataclasses, DeepSeekV4TargetAnchorResolver, DeepSeekV4MTPPrefixRuntime,
  DeepSeekV4MTPReplay and the per-block replay forward;
- the DeepSeekV4QModel MTP entry points (build_mtp_*, the replay leaf
  materializer, attach_mtp_quantization_model, save_state_overlay,
  set_mtp_target_tap_sink and its quantization_layer_output_required /
  receive_quantization_layer_outputs overrides) and the mtp.* branch of
  exllamav3_checkpoint_module_candidates;
- the lazy MTP dataset/input provider and every DeepSeekV4MTPQuantizationModel
  member except zero_route_recovery_context.

Default quantize behaviour is unchanged. The target model never has an `mtp`
module (the port ignores mtp.* on load), and out_of_model_tensors still
republishes every source mtp.* tensor byte-for-byte, so MTP stays in its
native checkpoint form as before. With no sink installed the deleted
quantization_layer_output_required override returned False, which is what the
BaseQModel default returns.

Kept on purpose:
- zero_route_recovery_context stays on DeepSeekV4MTPQuantizationModel,
  unchanged. DeepSeekV4QModel, Dots3NoteQModel, GlmMoeDsaQModel and
  Glm5NextQModel call it as an unbound method. Moving it belongs to the
  route-recovery refactor.
- The MTP_CAPTURE_* input-capture hooks are live on every DSv4 quantize:
  they validate labels and add/pop capture metadata.
- GLM5-Next layer 45 MTP is live (its loader appends the block and the normal
  traversal quantizes its routed experts), so glm5_next.py is not touched.
  The glm_moe_dsa and dots3_note MTP handling is only out_of_model_tensors
  passthrough/exclusion, so those files are not touched either.

Tests for the deleted API are removed. A new CPU test pins the default
behaviour: a quantize of a tiny V4 checkpoint republishes its mtp.* tensors
byte-for-byte. docs/deepseek-v4-mtp-replay.md is removed, and three doc
sentences that cited the deleted code are trimmed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Qubitium
Qubitium force-pushed the refactor/drop-mtp-calibration-stack branch from bd031c2 to 93ee0d8 Compare November 29, 2026 20:48
@Qubitium
Qubitium merged commit 89976ae into main Nov 29, 2026
6 checks passed
@Qubitium
Qubitium deleted the refactor/drop-mtp-calibration-stack branch November 29, 2026 21:26
Qubitium added a commit that referenced this pull request Nov 30, 2026
…source, not per-model run_input_capture stashes (#6495)

The capture stage passes the same moved example to begin_input_capture_example
and run_input_capture. BaseQModel already keeps it as
`_layer_type_replay_source` for exactly that span and clears it in
end_input_capture_example. Four definitions kept a private copy of that example
anyway:

- solar_open2, zdtaichu5 and mimo_v2 overrode run_input_capture only to set and
  restore a `_<model>_capture_*_mask` attribute around super(). Their capture
  hooks now read `_layer_type_replay_source` instead (with the same 2-D filter
  for solar_open2/zdtaichu5), and the overrides and `_CAPTURE_*_ATTR` constants
  are gone.
- glm5_next copied `input_ids` in its own begin/end pair. Its capture hook now
  reads and validates the source `input_ids`. The same RuntimeError/ValueError
  fire for a missing source or non-rank-2 ids; the ValueError is now raised in
  the layer-0 hook instead of before the forward.

solar_open2 and zdtaichu5 also rebuilt the full-attention and linear-attention
masks per layer in prepare_layer_replay_kwargs. Both configs declare
`layer_types` (ZDTaichu5's `text_config` property already resolves to
`llm_config`), so the base per-layer-type replay already built the same masks on
main and the definition overrides only overwrote them with equal tensors. Their
capture/replay mask code is deleted. Without a capture override, solar_open2 now
qualifies for the GPTAQ/FOEM first-capture reuse (#5831); its checkpoints are
bit-identical with and without the reuse.

deepseek_v4's begin/end pair is unchanged: it validates labels and derives the
MTP decode mask, which #6435 kept on purpose.

Tests that set the removed private attributes now go through
begin_input_capture_example, and a new solar_open2 test replays a left-padded
capture through every layer and checks each mask against the removed builders
and each output against the native forward.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Qubitium added a commit that referenced this pull request Dec 1, 2026
… fold-declaration variants (batch B)

Since #6480 a definition without `awq_groups_from_tree_order` plans its AWQ
groups from `awq_fold_declarations(layer)`. Its config-conditional
`awq_get_modules_for_scaling` post-filters become small variants of the
derived folds:

* llama: `awq_fold_declarations` returns `[]` for LongLLaMA, StableLM-Epoch,
  Yi and q/k-norm Cohere/StableLM, else `super()`.
* telechat2: drops the two norm folds in post-layernorm residual mode. The
  `key_value` filter is moved into the tree as `key_value:0:nosrc` (the
  derived folds never use it: it has no `v` role).
* hymba: drops a gateless (relu2) expert's `up_proj -> down_proj` and declares
  the input-norm fold's replay boundary as `mamba.in_proj` instead of
  rewriting `module2inspect`.
* k2_horizon: drops the input-norm fold on MoVA layers.
* gemma4, gemma4_unified (text and composite):
  `retarget_kv_shared_attention_groups(nodes)` becomes
  `kv_shared_attention_folds(layer, folds)`, which replays a KV-shared
  layer's input-norm fold on `self_attn.q_proj` alone.
* ovis2_6_moe: deleted. It only called `BaseQModel.awq_get_modules_for_scaling`
  past Ovis2_5QModel, which no longer overrides it.

`_awq_nodes_from_declarations` chose the empty-capture contract by class
identity (`type(self).awq_fold_declarations is BaseQModel...`), so any
variant would have moved a routed expert's empty `down` capture from the
processor's starved-member fallback (#4675) to a skip (#5995). That would
have changed Hymba's and Gemma 4's MoE layers, and it is why #6493 kept the
K2-Horizon and Gemma 4 node filters. The contract is now the
declared `awq_hand_declared_folds` flag, set by the two definitions that write
their own folds (PanGu, Inkling); a filter of the derived folds keeps the
derived contract.

Kept, because removing them changes behaviour or needs a maintainer decision:
bloom, chatglm, dbrx_converted, rw, ricursive and nemotron_h still plan from
the tree tracker and have drop:width groups (leaving the tracker drops them);
nanbeige stays on the tracker for its qk_layernorm tracker gap; kimi_k3's
NotImplementedError is a fail-closed guard, not a group filter; cohere_compass
re-prepares kwargs until PR 10. raon1_mini was converted in #6493 and the
deepseek_v4 MTP override was removed with #6435.

`tests/module_tree/awq_fold_inventory.py --check` reports no change for all 210
types; a stress and data-dependent A/B (MHA and coincident-width variants,
unrouted experts, absent and empty captures) is equal on all 210 types, and a
GPU AWQ A/B is bit-identical.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Qubitium added a commit that referenced this pull request Dec 1, 2026
… fold-declaration variants (batch B) (#6636)

Since #6480 a definition without `awq_groups_from_tree_order` plans its AWQ
groups from `awq_fold_declarations(layer)`. Its config-conditional
`awq_get_modules_for_scaling` post-filters become small variants of the
derived folds:

* llama: `awq_fold_declarations` returns `[]` for LongLLaMA, StableLM-Epoch,
  Yi and q/k-norm Cohere/StableLM, else `super()`.
* telechat2: drops the two norm folds in post-layernorm residual mode. The
  `key_value` filter is moved into the tree as `key_value:0:nosrc` (the
  derived folds never use it: it has no `v` role).
* hymba: drops a gateless (relu2) expert's `up_proj -> down_proj` and declares
  the input-norm fold's replay boundary as `mamba.in_proj` instead of
  rewriting `module2inspect`.
* k2_horizon: drops the input-norm fold on MoVA layers.
* gemma4, gemma4_unified (text and composite):
  `retarget_kv_shared_attention_groups(nodes)` becomes
  `kv_shared_attention_folds(layer, folds)`, which replays a KV-shared
  layer's input-norm fold on `self_attn.q_proj` alone.
* ovis2_6_moe: deleted. It only called `BaseQModel.awq_get_modules_for_scaling`
  past Ovis2_5QModel, which no longer overrides it.

`_awq_nodes_from_declarations` chose the empty-capture contract by class
identity (`type(self).awq_fold_declarations is BaseQModel...`), so any
variant would have moved a routed expert's empty `down` capture from the
processor's starved-member fallback (#4675) to a skip (#5995). That would
have changed Hymba's and Gemma 4's MoE layers, and it is why #6493 kept the
K2-Horizon and Gemma 4 node filters. The contract is now the
declared `awq_hand_declared_folds` flag, set by the two definitions that write
their own folds (PanGu, Inkling); a filter of the derived folds keeps the
derived contract.

Kept, because removing them changes behaviour or needs a maintainer decision:
bloom, chatglm, dbrx_converted, rw, ricursive and nemotron_h still plan from
the tree tracker and have drop:width groups (leaving the tracker drops them);
nanbeige stays on the tracker for its qk_layernorm tracker gap; kimi_k3's
NotImplementedError is a fail-closed guard, not a group filter; cohere_compass
re-prepares kwargs until PR 10. raon1_mini was converted in #6493 and the
deepseek_v4 MTP override was removed with #6435.

`tests/module_tree/awq_fold_inventory.py --check` reports no change for all 210
types; a stress and data-dependent A/B (MHA and coincident-width variants,
unrouted experts, absent and empty captures) is equal on all 210 types, and a
GPU AWQ A/B is bit-identical.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Qubitium added a commit that referenced this pull request Dec 1, 2026
…ranch (#6645)

#6435 deleted the DSv4/GLM MTP calibration stack, leaving two mechanisms with
no production reader:

- The three MTP_CAPTURE_* keys were added to the first-layer capture and popped
  again at replay. Delete the constants and the metadata round trip; keep the
  label-shape validation in begin_input_capture_example.
- zero_route_recovery_context's zero_route_recovery_uses_router_hooks opt-in is
  never set, so uses_router_hooks was exactly block_namespace == "base". The
  else branch installed _gptqmodel_mtp_zero_route_force and
  _gptqmodel_mtp_normal_mlp_capture_context on the layer module; only tests
  called them. Delete the branch, the attrs, prepare_router_candidates and
  pause_normal_mlp_capture; always install the router pre-hook.

Every recovery definition resolves to a model.layers decoder block, so the
deleted MTP path had no production caller. The recovery tests now drive the
production router-hook path.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Qubitium added a commit that referenced this pull request Dec 1, 2026
… 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 added a commit that referenced this pull request Dec 1, 2026
… since #6435) (#6667)

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]>
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.

1 participant