Validate before deploying

The framework's defining property: every check exercises the artifact through the same runtime production uses. There is no notebook shadow implementation to drift out of sync with the deployed path — the historical failure mode of validation tooling.

from compileml.validate import validate_artifact

report = validate_artifact(
    "decision.json",              # or the dict; paths get load-and-verify
    X_val=X_holdout, y_val=y_holdout,
    model=whitebox,               # enables fidelity (check 3)
    latent_train=latent_train,    # enables churn baseline (check 6)
    require_full_reason_coverage=True,
)
assert report["all_pass"], report["checks"]

Or gate a pipeline on the CLI's exit code:

compileml validate decision.json --csv holdout.csv --y-col DEFAULT --require-reasons

The eleven checks#

#CheckWhat it provesNeeds
1integrityhash verifies; structure valid; canonical JSON round-trip stablenothing
2reconciliationthe spec §7.4 identity re-added on sample rows; residual exactly zero when exactness is claimedX
3fidelityinteger artifact within the quantization bound of the float model; rank order preserved (Spearman ≥ 0.999)X + model
4band propertiesevery band receives volume; latent resolution adequateX
5semantic monotonicitybad rates non-decreasing across bands, measured on the deployed integer pathX + y
6churn baselinebootstrap ladder stability, measured with fixed-point edgesX + latent_train
7explainability stabilitytop-k reason sets stable under small input perturbation, using the runtime's explainerX
8reason coveragedictionary coverage of feature names; optional hard gatenothing
9monotone constraintsdeclared directions re-verified against the shipped integer trees (spec §3.1)nothing
10reference floorthe artifact out-scores a reference model on the same data — the floor teacher retention cannot supplyX + y + reference
11selection hygienewhen the artifact carries a provenance block from compile_selected: soft targets cross-fitted, partitions disjoint, Report read once; advisory unless require_selection_hygiene=Truenothing

Checks lacking inputs skip (reported as skipped, not passed silently); checks 1 and 8 always run, and check 9 runs whenever the artifact declares constraints — it needs no data because the trees themselves are the evidence.

Evidence, not verdicts#

Each check returns its numbers, not just a boolean — bad rates per band, worst monotonicity drop, churn rate, mean Jaccard, worst residual — so a validation report is reviewable, arguable material rather than a green light to trust.

Sample-size guidance#

Empirical checks need volume. Rule of thumb: a few hundred observations per band before bad-rate monotonicity is meaningful; at 50 per band, sampling noise alone can exceed the default 0.01 tolerance. The framework will fail honestly on noise — give it enough data to fail only on signal.