Skip to content

fix(data): adversarial hardening of trained DataClass classifiers (self-review) - #265

Merged
mdheller merged 1 commit into
mainfrom
fix/train-classifiers-adversarial
Aug 3, 2026
Merged

fix(data): adversarial hardening of trained DataClass classifiers (self-review)#265
mdheller merged 1 commit into
mainfrom
fix/train-classifiers-adversarial

Conversation

@mdheller

@mdheller mdheller commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Adversarial + functional review of #264 (which Copilot didn't review)

Since #264 merged without Copilot's second pass, I ran an adversarial review myself and found three real rigor gaps (plus a latent validator bug the fix surfaced):

  1. The monotone constraint was vacuous. The fixture held decimal_places constant, so its weight trained to 0 and the monotone teeth passed trivially. New fixture makes both monotone features (token_magnitude, decimal_places) the primary label signal → both weights bind strongly positive, accuracy realistic (<1.0), monotonicity genuinely exercised.
  2. Train/test leakage — the standardiser was fit on full data → now train-split only.
  3. Overclaimed manifest — said wide-and-deep/lattice but a linear monotone logistic was trained → renamed monotone-logistic (an honest realisation of the declared tf-lattice-wide-and-deep contract, not a full calibrated lattice).
  4. Latent validator bug (surfaced by the now-non-1.0 accuracy): it compared full-precision recompute against the 4-decimal rounded stored value with a 1e-6 tolerance → per-class 0.7857 spuriously failed. Now compares at stored precision.

Validator strengthened: checks both per-class heads monotone AND asserts the constraint binds (non-vacuous). 8 checks; tamper teeth still refuses corrupted weights.

This is the adversarial pass #264 was owed.

…lf-review, no Copilot on #264)

Adversarial + functional review of #264 (which Copilot didn't review) found:
- the monotone constraint was VACUOUS — the fixture held decimal_places constant, so its weight
  trained to 0 and the monotone teeth passed trivially. New fixture makes BOTH monotone features
  (token_magnitude, decimal_places) the primary label signal → both weights bind strongly positive,
  accuracy realistic (<1.0), monotonicity genuinely exercised.
- standardiser was fit on FULL data (mild train/test leakage) → now fit on the TRAIN split only.
- ModelManifest overclaimed 'wide-and-deep'/lattice → renamed 'monotone-logistic' (an honest
  realisation of the declared tf-lattice-wide-and-deep contract, not a full calibrated lattice).
- validator now checks BOTH per-class heads monotone + asserts the constraint BINDS (non-vacuous),
  and — a latent bug the trivial 1.0-accuracy fixture had masked — compares reproduced accuracy at
  the stored 4-decimal precision instead of full-precision vs 1e-6 (per-class 0.7857 now reproduces).
Tamper teeth still refuses corrupted weights. 8 checks green.
@mdheller
mdheller merged commit 409fd2a into main Aug 3, 2026
7 checks passed
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