Repository navigation
Description
Parent: #202
Problem
The canonical benchmark currently tracks final predictive/objective metrics very well, but many estimators can produce similar scores from materially different learned states. A pass/fail score tolerance is therefore not enough to explain implementation differences.
Work
Define estimator-specific model-state diagnostics for all 19 canonical rows, including where applicable coefficients/intercepts, support vectors/dual coefficients, tree structure, ensemble member state, cluster centers/inertia/iteration count, PCA components/singular values/explained variance, class priors/means/variances, and solver iteration/convergence statistics. Use sign/permutation alignment where mathematically required and store raw/normalized deltas in a machine-readable artifact joined into disparity_report.json.
Implementation progress
PR #331 establishes the generic learned-state evidence layer instead of hard-coding estimator HTML. Existing *_diff state diagnostics are promoted into model_state_diagnostics, model-state becomes its own disparity dimension, and the disparity artifact counts rows with learned-state coverage.
A new model_state_coverage.py audit enumerates all 19 canonical rows as covered or missing and lists the exact state diagnostic keys for each covered row. CI generates and uploads this coverage artifact and verifies it remains aligned with the canonical row set. The script already supports --require-complete; that will become the hard gate once all rows have state evidence.
The first pass exposed 2/19 covered rows. A follow-up on #331 fixed an evidence-loss bug for failed strict score gates: both KMeans implementations already emit inertia and iteration count for Digits, but the previous comparison stopped before retaining them. The disparity generator now derives those state deltas directly from the frozen DETAIL records, so 3/19 rows are covered and 16/19 are missing.
Current covered rows are Iris KMeans, Digits KMeans, and Iris PCA. For Digits KMeans specifically, the canonical frozen evidence shows a large ARI trajectory gap (~0.06368) alongside only ~0.1044% final-inertia difference and a 22-vs-19 iteration-count difference. That distinction is now persistent even while the row remains approximately equivalent at the headline level.
The highest-value missing state work remains Digits DecisionTree, RandomForest and KernelSVC, followed by coefficient/state diagnostics for the linear estimators and GaussianNB priors/means/variances.
This issue remains open after #331: the coverage artifact is deliberately intended to expose and drive the remaining estimator-specific state work rather than treating score parity as completion.
Activity
godofecht commentedon Aug 18, 2026
Triage: partially done, staying open
PR #331 landed as
8936641("Expose canonical learned-state diagnostic coverage"). The evidence layer exists; the estimator-specific state work does not.What is on
main:benchmarks/generate_disparity_report.pypromotes every*_diffdiagnostic into amodel_state_diagnosticsfield, addsmodel-stateas its own entry indisparity_dimensions, and parsesDETAIL|records directly so a failed strict score gate cannot erase state evidence.benchmarks/model_state_coverage.pyenumerates all 19 canonical rows as covered or missing and lists the state diagnostic keys per covered row. It supports--require-complete, which is not yet wired as a hard gate..github/workflows/disparity.ymlruns the coverage audit, assertscoverage["counts"]["canonical_rows"] == 19and that covered rows matchrows_with_model_state_diagnostics, and uploadsmodel_state_coverage.jsonas an artifact.What the frozen artifact actually shows.
benchmarks/disparity_report.jsonatc1e01dfreports"rows_with_model_state_diagnostics": 3out of 19. The three covered rows are:inertia_relative_diff,n_iter_abs_diffinertia_relative_diff,n_iter_abs_diffexplained_variance_ratio_abs_diff,singular_values_relative_diff,reconstruction_mse_abs_diff,component_0_sign_aligned_abs_diff,component_1_sign_aligned_abs_diffThe other 16 rows emit no learned state at all. The root cause is upstream of the report:
benchmarks/bench_flow_v2.flowemitsDETAIL|records only for KMeans (iris, digits) and PCA (iris), at lines 236-237, 250-254 and 299. Nothing for the tree, ensemble, SVM, linear or naive-Bayes rows.Remaining work: emit
DETAIL|state records from both implementations for the 16 uncovered rows (tree structure for #204, per-tree and ensemble state for #205, support vectors and dual coefficients for #206, coefficients and intercepts for the linear rows, priors/means/variances for GaussianNB), then flipmodel_state_coverage.py --require-completeon in CI.godofecht commentedon Aug 18, 2026
PR #402 extends
DETAIL|emission to every canonical row on both runners andmakes
generate_disparity_report.pypair the records generically instead ofspecial-casing KMeans. Measured locally against freshly generated raw evidence,
coverage goes from 3/19 to 19/19 and
model_state_coverage.py --require-completeexits 0.Emitted per estimator: coefficients and intercepts for the linear models;
one-vs-one support counts, bounded-support counts, summed dual coefficients,
gamma and per-pair intercepts for KernelSVC; full preorder split vectors plus a
per-depth node census and split-feature histogram for DecisionTree; per-tree
structure, bootstrap checksums, unique-sample fractions and vote-margin
statistics for RandomForest; class priors and per-class mean/variance norms for
GaussianNB; center norms and cluster sizes for KMeans; dual-coefficient
statistics for KernelRidge.
benchmarks/README.mdcarries the full table and thesummarisation rationale.
The report also now records
<field>_first_divergent_indexfor equal-lengthvectors, so Digits DecisionTree resolves to node 4 rather than just "the trees
differ".
Every canonical
RESULT|line is byte-identical toorigin/mainon an identicallocal run, and
DETAIL|output is identical across three consecutive runs, whichalso confirms nothing reads the uninitialised tree fields from #359.
This issue should stay open.
disparity.ymlregeneratesdisparity_report.jsonfrom the committedflow_results_v2.txtandsklearn_results_v2.txt, which are refreshed by thefreeze-resultsjob onpushes to
mainand are kept out of feature-branch diffs. The disparity job willkeep reporting 3/19 until that freeze runs after #402 merges.
--require-completeshould be added to
.github/workflows/disparity.ymlas a follow-up once thefrozen evidence shows 19/19, not before.
Still uncovered after #402: leaf class distributions for trees (blocked on #359,
since
TreeNode.valueis unwritten on internal nodes in amalloc'd array),per-node structure inside forest members, per-phase timing for KernelSVC (needs
timers inside
svm.flow, the known victim of compiler bug #469), individualsupport vectors and dual coefficients, and any measure of how many test samples
the two implementations actually label differently.
godofecht commentedon Aug 19, 2026
Closing. Coverage is complete and now enforced.
Where this landed
DETAIL|learned-state emission from 3/19 to 19/19 canonical rows, and the diagnostics immediately paid for themselves: they produced the first-divergence data that Reduce Digits DecisionTree predictive disparity and compare learned tree structure #204 needed (Digits DecisionTree diverges at node 4) and the centre-norm evidence that led to Make KMeans trajectory semantics sklearn-compatible and retire the equivalence exception #203 being fixed and its equivalence exception retired.disparity.ymlnow runsmodel_state_coverage.py --require-complete, and the accompanying assertion went fromcovered_rows > 0tocovered_rows == 19withmissing_rows == 0.On current main:
The assertion change matters on its own.
covered_rows > 0would have passed with a single covered row, which is precisely how coverage sat at 3/19 without the gate objecting. I verified the new gate bites rather than merely passing: clearingmodel_state_diagnosticson one row makes the step exit 1.What the diagnostics actually produced
Worth recording, since the issue's value was always downstream:
first_divergent_indexlocated the divergence at node 4 and showed both implementations compute weighted gini 0.31999999999999995 there, with six features tied at the exact minimum. The gap is tie-break noise, and Flow is the more accurate side.Depth gaps that remain, deliberately not blocking this
These are recorded rather than dropped: leaf class distributions, per-node forest structure (only per-tree scalars today), raw bootstrap indices rather than a checksum, individual support vectors and dual coefficients for KernelSVC, and per-phase KernelSVC timing which #206 wants. None of them is needed for the coverage criterion this issue set.