Repository navigation
refactor(exl3): drop the EXL3 error ledger and projection journal - #6423
Merged
Merged
Conversation
Every EXL3 quantize wrote two side files that nothing in the repository reads back: - each projection appended a canonical-JSON record to logs/<processor>.exl3-error-ledger.jsonl (relative to the current working directory, or GPTQMODEL_EXL3_ERROR_JOURNAL), with an fsync per record; - every save wrote ds4rt-exl3-error-ledger.jsonl plus a ds4rt-exl3-error-ledger.manifest.json (projection records, w1/w2/w3 expert-family aggregates and a digest manifest) into the model directory. quant_log.csv already records layer, module, loss, loss kind, sample count, damp and time for every method. Removed: utils/exl3_error_ledger.py's record builder, provenance compaction, family aggregation, journal and ledger writer; the processor's journal path, journal append and record build/compare on projection-checkpoint hits; the writer's ledger write. Fifteen journal files committed under tests/logs go too. Kept, because live paths still use them: routed_expert_identity, the natural-route evidence contract and the zero-route recovery recipe and validators. Route capture, recovery, projection checkpoints and capture frontiers depend on them, so they move verbatim (two error messages lose the word "ledger") into utils/exl3_router_candidates.py, next to the router ranking they serve. Two live checks read module names from the ledger record. The writer's _validate_exllamav3_publication_modules (run on every EXL3 save) and the DS4 attach_mtp_quantization_model coverage check now read the new exl3_module quant-log key, the full module name, instead. Projection checkpoints: new results no longer store a ledger_record. Results committed by older builds still carry one; it is ignored, so they still hit. meta: ds4rt_error_ledger itself stays, because family_join and run.projection_checkpoint still drive recovery and checkpoints. run.projection_checkpoint_seed only fed the ledger, so it joins _RETIRED_META_KEYS. GPTQMODEL_EXL3_ERROR_JOURNAL joins _RETIRED_KERNEL_ENV_VARS. Both warn once. Tensors, quantize_config.json and the quant_log.csv columns are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
Drops the EXL3 error ledger and the per-projection error journal. Nothing in the repository reads either of them back.
Before this PR, every EXL3 quantize wrote two kinds of side file:
fsyncper record, tologs/<processor>_log_<id>_time_<ts>.exl3-error-ledger.jsonl. That path is relative to the current working directory, unlessGPTQMODEL_EXL3_ERROR_JOURNALwas set. Fifteen of these files had been committed undertests/logs/by accident. They are deleted here.ds4rt-exl3-error-ledger.jsonlandds4rt-exl3-error-ledger.manifest.jsoninto the model directory. They hold projection records, w1/w2/w3 expert-family aggregates and a digest manifest.quant_log.csvalready records layer, module, loss, loss kind, sample count, damp and time for every method.Behaviour change: the side files are no longer written. Tensors,
quantize_config.json,config.jsonand thequant_log.csvcolumns are unchanged. The GPU A/B below shows them byte-identical.Net diff:
41 files changed, 1204 insertions(+), 2441 deletions(-), so -1237 lines.To see the moves, run
git diff --color-moved=zebra origin/main...refactor/exl3-drop-error-ledger.What Changed
Removed
gptqmodel/utils/exl3_error_ledger.py:build_projection_record, provenance compaction (compact_projection_*), family aggregation (derive_family_records), the journal (append_exl3_error_journaland its index) andwrite_exl3_error_ledger.EXL3Processor.__init__: the journal path,exllamav3_processor.py:955on main.EXL3Processor.process: the record build (:2899), the record rebuild-and-compare on a projection-checkpoint hit (:2953-2985), the journal append (:2994), and the stat keysexl3_error_ledger_record,exl3_error_journalandexl3_error_record_sha256(:3036-3038).writer.py: the ledger write (:2706on main) and its import.tests/test_exl3_error_ledger.py(915 lines), the committedtests/logs/*.exl3-error-ledger.jsonl, anddocs/exl3-error-ledgers.mdwith its index link.Kept, because a live path still uses it
routed_expert_identity,routed_expert_processor_layer, the natural-route evidence contract (ROUTE_EVIDENCE_*,route_evidence_required,validate_route_evidence) and the zero-route recovery recipe, authorization and validators.gptqmodel/utils/exl3_router_candidates.py, next to the router ranking they serve. The only edit: the JSON guard's two error messages say "route value" instead of "ledger value".tests/test_exl3_route_recovery_contracts.py.build_projection_record. They now callvalidate_route_evidence/validate_zero_route_recoverydirectly, with the same accept/reject cases.Re-pointed: two live checks read module names from the ledger record
_validate_exllamav3_publication_modules: every module in the quant log must be packed before META sync. Runs on every EXL3 save.writer.py:1673readsentry["exl3_error_ledger_record"]["module"]writer.py:1672readsentry["exl3_module"]DeepSeekV4QModel.attach_mtp_quantization_model: MTP coverage and collision checkdeepseek_v4.py:1710readsrecord["block_namespace"] == "mtp"andrecord["module"]deepseek_v4.py:1712readsentry["exl3_module"]; namespace fromrouted_expert_identity(name), the same regex the record usedexl3_error_ledger_record.moduleexl3_module: module.full_name(exllamav3_processor.py:2957)Projection checkpoints
process()used to requireresult["ledger_record"]and rebuild it for comparison.ledger_record.exllamav3_processor.py:2906). A cross-tree check proves this; see below.Retired switches (warn once, no effect)
meta["ds4rt_error_ledger"]itself stays. Itsfamily_joinandrun.projection_checkpointentries still drive route recovery, capture frontiers and projection checkpoints.ds4rt_error_ledger.run.projection_checkpoint_seedwas read only by the ledger's provenance compaction. It joins_RETIRED_META_KEYS, soto_dict()drops it.GPTQMODEL_EXL3_ERROR_JOURNALjoins_RETIRED_KERNEL_ENV_VARSwith no replacement.docs/looper-checkpoint-redesign.md(retired switches table),docs/kernel-config.md, thedocs/exl3-durable-execution.mdprocess diagram,docs/native-checkpoint-export.md, anddocs/exl3-router-recovery.md(new home of the contracts; line refs updated).Other observable changes
quantize()returns, also shown as columns in the CLI table, lose the three ledger/journal keys and gainexl3_module.validate_exl3_hessian_metricsstill requires a finite selected scale, scale-search MSE, diagonal addend and symmetry correction. On a configured projection-checkpoint store, the stored result is still finite-checked.family_join.route_evidence_contractswitch,build_projection_recordre-validated route and recovery evidence once more at quantize time.validate_subset_capture_readinessalready validates the same evidence before fan-out, and that check remains.Out of scope (follow-ups)
ds4rt_error_ledgermeta key. It is a saved public key, and its name no longer matches its content.Tests
New or changed regressions, with red evidence from a disposable worktree:
tests/test_exl3_projection_resume.py::test_process_resumes_from_packed_checkpoint_without_requantizing[current|legacy](GPU).legacyrewrites the committed manifest to carry aledger_record, as older builds stored it, and asserts a hit with no requantization.not isinstance(result.get("ledger_record"), dict):[current]fails with "result is malformed".[legacy]fails.tests/test_deepseek_v4_support.py::test_deepseek_v4_mtp_quantization_adapter_replays_one_exact_block: a target-namespace module in the MTP log must raise "coverage mismatch". Dropping the namespace check givesDID NOT RAISE.tests/test_exl3_zero_sample_fallback_4995.py::test_unrouted_expert_is_packed_end_to_end(GPU): runsprocess()from an empty cwd, asserts nothing is written there, and assertsstat["exl3_module"].tests/test_writer_attention.py::test_save_quantized_writes_unambiguous_csv_and_no_exl3_ledger: the save directory holds onlyquant_log.csv, and the CSV rows are unchanged.tests/test_writer_state_overlay.py::test_exl3_publication_guard_*: the publication guard onexl3_module.tests/test_exllamav3.py::test_retired_ds4rt_meta_keys_warn_once_and_are_not_saved[exl3|gptq]: now coversrun.projection_checkpoint_seed.Per-node A/B of the touched families, base =
origin/maina4471c5, new = this branch.junit_cmp.pycompares the junit xml node by node.Skips:
cuda:1workspace/RNG tests (only one GPU used);owner=Falsecapture-source reduction;[legacy]resume param, which the CUDA run covers.GPU A/B (required: the quantize and save path is touched).
EXL3Config()defaults (bits=4, mcg) onQwen/Qwen2.5-0.5B-Instruct, 64 wikitext-2 rows, seed 0, one RTX 4090.offload_to_disk=FalseandTrue.gpu_ab.py quant <out> <0|1>thengpu_ab.py compare <base_out> <new_out>.*.jsonlin cwdds4rt-exl3-error-ledger.{jsonl,manifest.json}, missing on newlogs/exl3_log_…exl3-error-ledger.jsonl; new: nonequant_log.csvrow order differs between runs. Rows are appended by parallel module workers, so the comparison uses the row set.Cross-tree checkpoint compatibility (GPU).
cross_tree_checkpoint.pydrives the resume test's processor helper.ledger_record.quantize_exl3replaced by a function that raises. The result ishit True, and the replay weight is bit-identical to the base tree's.Measured Impact
Not applicable: no claimed issue. Peak CUDA allocation was 1388 MiB on both trees in all four A/B runs. The per-projection journal
fsyncand the save-time ledger write are gone; neither was timed.Model Support / Module Plan
Not applicable: no
MODEL_MAP, definition, module plan or fusion change.deepseek_v4.pychanges only the MTP attach coverage check's input, covered above.Model test node IDs and results (or "not applicable"): not applicable.
AWQ onboarding safety
Not applicable: AWQ grouping, search, replay and folding are untouched.
Logic Flow Documentation
file:lineevidence.docs/repeats the diagrams, titled for the mechanism, and is linked fromREADME.md.This removes a persisted side effect and changes where the publication guard gets its module names. The process diagram in
docs/exl3-durable-execution.mddrops the journal node. The old/new source table is under "Re-pointed" above.flowchart TD P["EXL3Processor.process"] --> S{"projection checkpoint store"} S -->|"none, the default"| Q["quantize_exl3"] S -->|"hit; an old ledger_record key is ignored"| L["reuse packed tensors"] Q --> C["store.commit if configured<br/>result has no ledger_record"] C --> T["_stage_runtime_weight<br/>stat row with exl3_module"] L --> T T --> W["ModelWriter.save_quantized"] W --> G["_validate_exllamav3_publication_modules<br/>reads exl3_module"] G -->|"a named module is not packed"| X["RuntimeError: publication tree is missing packed modules"] G --> CSV["quant_log.csv; no ledger files"] style X fill:#fee,stroke:#b22Review Requirements
Kernel Accuracy Requirements
Not applicable: no kernel, dispatch or packing change. The packed tensors are bit-identical in the GPU A/B.
Notes
ds4rt-exl3-error-ledger.*still load: no loader reads those files.quantize_config.jsonfiles whosemeta.ds4rt_error_ledger.runhasprojection_checkpoint_seedwarn once. Re-saving drops that entry.🤖 Generated with Claude Code