Skip to content

feat(matching): training now says which parameters it did not measure - #598

Merged
athvin merged 1 commit into
mainfrom
bm/train-reports-defaults
Nov 5, 2026
Merged

athvin merged 1 commit into
mainfrom
bm/train-reports-defaults

Conversation

@athvin

@athvin athvin commented Nov 5, 2026

Copy link
Copy Markdown
Owner

#596 added publish advisories that predict which exact levels the u-sample will not reach, from the profile alone and before any training exists. This is the other half: what actually came back unmeasured — which is what makes that prediction checkable rather than merely plausible.

What it reports

TrainedModel::defaulted_levels() returns every non-null level whose m or u is still ProbabilitySlot::Unset after training, so the scorer reads the level's built-in default instead of a value measured on this corpus.

Falling back to the default is the right behaviour — it is a considered prior for the level's position in the ladder, which beats asserting "these values practically never agree by chance" on no evidence at all. But it is silent: training succeeds, the model saves, every golden passes, and nothing in the saved document distinguishes a u measured over a million pairs from an assumption. For an exact level on a near-unique column the two can be orders of magnitude apart, because the true u of an equality is that corpus's own collision probability.

Final slots, not estimate history

Read off level.m / level.u rather than the estimate history, deliberately. The question is what the scorer will use, and a level pinned by fix_m / fix_u or supplied in the settings JSON is a declared value, not a fallback. Unset is the one state that means "the default is in force".

Where it surfaces

The three places the convergence report already travels:

Where What
TrainReport defaulted_levels + fully_measured(), beside not_converged and for the same reason — a confidence statement, not a failure
the train task's counters levels_defaulted / levels_fully_measured, because the ledger is the only place the distinction survives the run
er train's summary its own line — provenance is not a verdict, and an operator reading "converged" should not have to work out which parameters that convergence measured

Computed after the label pass, not with the rest of the report: a tenant's verdicts can still supply m for a level EM never observed, so reading it earlier would name a fallback the next few lines go on to remove.

Test

Uses the committed goldens rather than hand-built settings, which also makes the two halves separable:

  • model_initial.json — neither parameter on any of its 20 non-null levels → all 20 reported, both m and u
  • model_after_u.json — all 20 u values present, still no m → all 20 reported, m only

A report that conflated m and u fails it. Verified by mutating the accessor to read the same slot twice and watching it fail on exactly that assertion:

panicked at tests/golden_u.rs:173:
u came from the corpus and m did not — the two must not be conflated

Also corrects ProbabilitySlot::resolve's doc comment, which still described the deleted NotObserved variant mapping to 1e-6. That line is the origin of the belief that an untrained level scores at 1e-6.

Verification

make check green from the repo root — 819 tests, 0 failures. The dedupe-core golden suite goes 64 → 65 (the one new test); no golden value moved, which is expected since the accessor is read-only and changes no scoring.

🤖 Generated with Claude Code

The publish advisories predict which `exact` levels the u-sample will not
reach, from the profile alone and before any training exists. This is the other
half: what actually came back unmeasured, which is what makes that prediction
checkable rather than merely plausible.

`TrainedModel::defaulted_levels()` reports every non-null level whose m or u is
still `ProbabilitySlot::Unset` after training, so the scorer reads the level's
built-in default instead of a value measured on this corpus.

Falling back to the default is the right behaviour — it is a considered prior
for the level's POSITION in the ladder, which beats asserting "these values
practically never agree by chance" on no evidence. But it is silent: training
succeeds, the model saves, every golden passes, and nothing in the saved
document distinguishes a u measured over a million pairs from an assumption.
For an exact level on a near-unique column the two can be orders of magnitude
apart, because the true u of an equality is that corpus's own collision
probability.

Read off the final slots rather than the estimate history, deliberately. The
question is what the scorer will use, and a level pinned by `fix_m` / `fix_u`
or supplied in the settings JSON is a declared value, not a fallback. `Unset`
is the one state that means "the default is in force".

Surfaced in the three places the convergence report already travels:

- `TrainReport.defaulted_levels` + `fully_measured()`, beside `not_converged`
  and for the same reason — a confidence statement, not a failure
- the train task's counters as `levels_defaulted` / `levels_fully_measured`,
  because the ledger is the only place the distinction survives the run
- `er train`'s summary, on its own line: provenance is not a verdict, and an
  operator reading "converged" should not have to work out which parameters
  that convergence measured

Computed after the label pass, not with the rest of the report: a tenant's
verdicts can still supply `m` for a level EM never observed, so reading it
earlier would name a fallback the next few lines go on to remove.

The test uses the committed goldens rather than hand-built settings, which also
makes the two halves separable — `model_initial.json` has neither parameter on
any of its 20 non-null levels, and `model_after_u.json` has all 20 u values and
still no m. A report that conflated m and u fails it; verified by mutating the
accessor to read the same slot twice and watching it fail on exactly that
assertion.

Also corrects `ProbabilitySlot::resolve`'s doc comment, which still described
the deleted `NotObserved` variant mapping to 1e-6. That line is the origin of
the belief that an untrained level scores at 1e-6.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin merged commit b334658 into main Nov 5, 2026
38 of 39 checks passed
@athvin
athvin deleted the bm/train-reports-defaults branch November 5, 2026 17:23
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