The question

Every real study ends with the same unanswerable complaint: my score stopped moving — is my model bad, or is this as good as it gets? Nobody can tell you, because on real data nobody knows the best score that was ever available.

This study buys that answer by giving up something else. The evidence here is not found, it is generated: prepare.py writes out the exact process that produced every row, so the best score any model could possibly reach is not a guess but a computation. That one fact turns two vague worries into arithmetic:

So the study climbs a four-rung ladder of ordinary tabular models and asks, at every rung, how much of the distance to the known ceiling it has closed — measured not in metric units but in units of what the measurement can actually resolve. Then it spends its one look at held-out data to check the answer.

The decision a reader takes away is not “use gradient boosting”. It is when to stop, and how to know you have reached that point rather than guessing.

The method

Two ideas do all the work here, and neither of them is a model.

The ceiling

Imagine grading weather forecasters. Even a forecaster who knows the true probability of rain for every single day will not score perfectly, because it sometimes fails to rain on an eighty-percent day. There is a best possible score, and the world's coin flips set it, not the forecaster. That is the Bayes ceiling.

The generating process is a logistic model with one interaction and one quadratic term, so the truth is smooth but not linear in the raw features:

\eta(x) = \beta_0 + \sum_{j=1}^{6} \beta_j x_j + \beta_{12}\, x_1 x_2 + \beta_{33}\, x_3^2

and each row's label is a coin flip weighted by that log-odds:

y \sim \mathrm{Bernoulli}(\sigma(\eta(x)))

AUC is the probability that a random positive outranks a random negative, so it depends on a score only through the order it puts the rows in. The true probability is by construction the best ordering there is, so no score can beat it:

A[s] \le A[p] = A_{\mathrm{Bayes}} \quad \text{for every } s

That is why the ceiling is computable here and nowhere else. Note the subtlety the study had to respect: it is a ceiling for these rows. A different draw of four thousand rows has its own ceiling, which is why the sealed prediction was written with a tolerance instead of as an equality.

The detection limit

Now put the ceiling next to the noise floor — how much the metric moves when nothing about the model changes. Their ratio is the headroom:

h = \frac{A_{\mathrm{Bayes}} - A[\hat{s}]}{\delta}

where \delta is the measured floor, the smallest improvement that counts. If h < 1, then even a perfect model could not beat your current one by an amount your measurement could tell apart from noise. The tournament is decided before it runs.

Two warnings the field paid for, repeated here. First, h \ge 1 means only “not arithmetically excluded” — never “worth trying”; the attainable ceiling usually sits well below the ideal one. Second, the floor you divide by must be the floor that judges your comparison. That second warning is the one this study nearly walked into, and section four shows how close it came.

The data story

Twenty thousand rows, eight standard-normal features, one binary label. Six features enter the true log-odds; x7 and x8 enter nothing at all, and they are there so the study can watch a high-capacity model spend budget on columns that carry no signal. The positive rate is 24.115%, and the contract splits the table 60/20/20 into 12000 training rows, 4000 development rows, and 4000 rows that stay sealed until the very last run.

The value-pattern check — the one the data gate never skips, because pandas cannot tell a Yes/No column from any other string column by dtype alone — found eight honest floats and a genuine binary integer. No sentinels, no numbers-in-strings, no string-encoded booleans. On synthetic data that is unsurprising; running it anyway is the point, because the day you skip it is the day it would have mattered.

Where the truth lives, and where it must not

prepare.py computes the true log-odds for every row and writes them to data/prepared/truth.json — and only there. Joining that column into the feature table would be perfect target leakage: the model would be handed the answer. The clean-room audit checked exactly this, in a fresh context on a different model, reading only the contract, the preparation script and the prepared table — never the lab notebook, whose hopes and priors are what make a leak look plausible.

The two controls

Before trusting any verdict the pipeline was checked in both directions. Most studies do this and never name it; naming it is half the teaching.

The gate ruled GO with two warnings carried forward rather than argued away: a 24% positive rate, and a development partition of only four thousand rows — which is what makes the noise floor wide, and therefore what makes the headroom close early. Both warnings landed in the arithmetic, not in a claim.

The experiment journey

Phase 0: two floors, and only one of them is a bar

Before any candidate ran, the study measured how much its own metric moves when nothing improves. It measured this twice, two different ways, and the two answers disagreed by everything.

Refitting the same anchor on the same rows under five different fit seeds moved the score not at all: standard deviation 0, range 0. A convex solver on a fixed partition is deterministic. Re-drawing which rows are held out and re-measuring moved it with a standard deviation of 0.00372606 over ten draws, giving a keep bar of

\delta = \max(2\sigma,\ \mathrm{range}/2) = 0.00745212

This is the trap the whole discipline exists to avoid. A study that had pasted the cheap number into its contract would have carried a keep bar of zero and would have kept every candidate that moved the last decimal. Klein records the two under different keys — fit_noise for provenance, noise_floor for the bar — so the cheap one can never be mistaken for the expensive one.

The ladder

Four candidates, each one falsifiable idea, each committed before it ran. Every run printed its own distance to the ceiling and its paired lift over the rung it claimed to beat — the predecessor refitted on the same rows inside the same run, so the comparison lives in one printed block instead of being reconstructed afterwards.

Tracks: primary — val_auc (higher is better)

ExpTrackKindMetricStatusDescription
E0001primarydevelopment0.806201keepE0001 anchor: the raw-feature logistic identity anchor — how far is a single hyperplane from the known ceiling?; first valid result on this track
E0002primarydevelopment0.835785keepE0002: hand the linear model the DGP's true x1*x2 interaction — does the term the hyperplane could not express buy more than a floor?; frontier improvement over 0.806201 with minimum_delta=0.00745212
E0003primarydevelopment0.87139keepE0003: a boosted tree told none of the true terms — can it beat the hand-specified interaction rung it was never shown?; frontier improvement over 0.835785 with minimum_delta=0.00745212
E0004primarydevelopment0.858049discardE0004: the over-capacity boosted tree — 500 trees, 127 leaves, no shrinkage discipline, no early stopping. Does buying capacity at h = 1.708 buy anything the floor can see?; did not improve track frontier 0.87139 by minimum_delta=0.00745212
E0005primaryfinal_test0.880949discardE0005 sealed: E0003's configuration, once, on the held-out partition — does it land within two measured floors of that partition's own Bayes ceiling?; sealed final-test evidence; excluded from the adaptive frontier
Left panel: every rung's val_auc on a zero-based axis with the Bayes ceiling and the chance line drawn; the five bars look nearly identical. Right panel: the same distances to the ceiling divided by the measured floor, where they differ by a factor of six.
The primary track's four development rungs, and the sealed run set apart to the right of each panel, measured against the known Bayes ceiling: raw val_auc on a zero-based axis with the chance line on the left, and on the right the same distances to the ceiling divided by the measured floor. One division is the whole lesson — in metric units every rung looks alike, in floors the raw-feature anchor sits many times further from the ceiling than the boosted incumbent. Close
The pair of panels is the lesson. On the left, in metric units, all five rungs look alike and the ceiling sits just above them — that is the honest picture, and it is why a reader staring at raw AUC cannot tell progress from noise. On the right, the same distances divided by the measured floor: the anchor is 10.4555 floors from the ceiling and the boosted rung is 1.7077. Same numbers, one division, completely different story.

The primary track's decision trajectory: three keeps stepping up the frontier, one discard plotted below it, and the sealed run marked separately as a star inside its own phase band.
The decision history of the primary track on the development partition, drawn from the run manifests: the step frontier rises through each keep, the discarded over-capacity rung is plotted below it as retained negative evidence, and the one sealed final test is marked as a star apart from the frontier — confirmation evidence never joins the adaptive climb. Read it as what was kept, what was kept as evidence of failure, and where the single sealed look was spent. Close
The fourth rung, and the discard that paid for itself

Before spending the fourth candidate the study read its headroom: h = 1.708. Ajar, not open — so the detection-limit law neither refused the run nor demanded an acknowledgement. The study spent it anyway, on an over-capacity boosted tree with five times the trees, no shrinkage discipline and no early stopping.

It came back worse: delta_in_floors -1.7903 against its own reference, a discard. And it broke the probabilities long before it broke the ranking — log-loss went from 0.355165 to 1.024102, nearly triple, while the AUC change was only delta_vs_reference -0.013341. It also cost 18.407609 seconds against 0.647123.

That refuted a registered prediction. P4 was written as a no-effect prediction — “within noise” — and the honest reading of a refuted no-effect prediction is not “nothing happened after all” but “something happened, in the wrong direction”. The study wrote that down, dated, and stopped buying capacity.

The one sealed look

The sealed partition was rehearsed first — a dry run that executes the whole path on development data and spends nothing, because an earlier study lost its only seal to a crash that happened before any data was read. Then it was spent once. The selected configuration scored 0.880949 against that partition's own ceiling of 0.893469, a distance of 1.68 floors against 1.7077 on development.

The distance to the ceiling did not grow when the rows changed. That is what “the remaining gap is irreducible at this sample size” looks like when you can actually see the ceiling.

Findings and insights

The ladder closed the distance to the development ceiling of 0.884116 from 10.4555 measured floors at the raw-feature anchor to 1.7077 at the boosted incumbent, and the sealed partition returned 0.880949 against its own ceiling of 0.893469. That claim is the only kind this study is allowed to call confirmed: it cites both a development run and the sealed run, which are two different kinds of evidence.

The result a practitioner should take away carries the scope tag in-silico, because it is a statement about behaviour under this declared process and not about the world: a boosted tree shown none of the true terms out-earned handing a linear model the true interaction — 4.7779 floors against 3.9699, and 4.6190 on the sealed rows. Nobody had to know which term to specify.

Where the linear model actually goes wrong

Left panel: mean predicted probability against mean true probability in twenty equal-count bins; the linear model bows away from the diagonal while the boosted tree tracks it. Right panel: mean predicted minus true against true probability; the linear model over-predicts below a true probability of about 0.3 and under-predicts sharply above it.
Mean predicted probability against the mean TRUE probability of the same development rows (left), and the residual, predicted minus true, against the true probability (right), for the raw-feature anchor and the boosted incumbent of the primary track. Both panels compare against the declared truth rather than against observed frequencies — the plot only a known-truth study can draw. The takeaway is the shape, not the size: the linear model's error is a clean sign flip rather than noise, and the boosted tree shows the same shape an order of magnitude smaller and only in the tails. Close
This is the plot only a known-truth study can draw: predicted probability against the true probability of the same rows, not against observed frequencies. And the shape of the error matters more than its size. The linear model's error is not noise but a clean sign flip — it over-predicts the low-probability rows and under-predicts the high-probability ones, crossing zero around the middle of the range. That is shrinkage toward the base rate, which is exactly what a model that cannot express the curvature of the true log-odds must do: unable to reach the extremes, it pulls every row toward the average.

The ranking gap and the probability gap are the same missing structure seen twice: Brier 0.132010 for the linear model against the boosted tree's 0.109337 and the irreducible Bayes floor of 0.103604.

The prediction the study got wrong, and the one it was wrong about

Five predictions were registered before any evidence existed. Four were supported and one refuted, every one adjudicated by arithmetic on a printed block rather than by prose. The family size is five, each bound to exactly one run, with no post-hoc selection — so the guard here is pre-registration rather than an alpha correction.

The second research question was refuted, and that is the most useful sentence on this page. It predicted the headroom would close before the fourth candidate was spent; it stood at 1.708 instead. The law did not stop the study, the study paid for the discard in full, and the prior that said otherwise was recorded as a miss rather than quietly rewritten.

Two replications that failed, and were kept

Both attempts to replicate the incumbent run failed, and neither failure was scientific. The first timed out: a replication builds its own environment in a detached worktree before the entrypoint runs at all, and this study's honest per-run budget was sized for runs that take under a second. The second crashed on a prepared artifact that the entrypoint reads but the contract never declared — so the replication harness, which copies exactly what the contract names, never copied it.

Both records stand at not reproduced. Neither was retried into a pass, and the entrypoint was not quietly edited afterwards to make an unproven fix look proven. The failure became a claim instead, which is the single most useful thing here for the next author.

What the records say

Everything below is copied out of this study's own records at build time — claims.lock and study_state.json — rather than retyped into the prose above, so the page cannot drift from the ledger it describes.

claims
8 locked in claims.lock
by strength
confirmed 2 · exploratory 6
by class
empirical-description 2 · known-dgp-teaching 1 · mechanism-interpretation 1 · procedural-verdict 1 · research-discipline 3
errata
0 of 8 claims tagged · 0 erratum record(s) in the lock
locked at
2b29e93bf0b3 · klein 2.0.0
label
confirmed
referee
PASS-WITH-NOTES — klein-referee (Claude Code subagent, model: claude-opus-5[1m]) · independent of the experimenter: no

Method coding advice

Here is the entire per-experiment surface of this study — the actual bytes, included by reference so this page cannot drift from the code that produced the numbers above. Read the two constants in the middle first: CANDIDATE and REFERENCE. That two-line diff is an experiment.

train.py · executed by E0003 (development, track primary) at commit 061a079ab2b9 · sha256 147b24920cf6…
"""The only per-candidate mutable surface in this study.

The per-experiment diff is two constants — ``CANDIDATE`` (the rung being tried)
and ``REFERENCE`` (the rung it claims to beat) — and nothing else. Everything
below them is fixed machinery.

What every run prints, on top of the canonical block
---------------------------------------------------
Because the truth is declared, each run can report where it stands relative to
things a normal study can only guess at. All of them are read from the contract
and from ``data/prepared/truth.json``; none is written here as a literal:

===================== ==========================================================
``bayes_auc``         the Bayes-optimal AUC for exactly the rows this run was
                      graded on, from the DGP's true log-odds
``gap_to_ideal``      ``bayes_auc - val_auc``: how far this rung is from the
                      ceiling, in metric units
``gap_in_floors``     the same distance divided by the contract's
                      ``minimum_delta`` — i.e. **this run's own headroom h**,
                      the number the detection-limit law is about
``reference_auc``     the named reference rung refitted on the SAME rows (common
                      random numbers), so the comparison lives in one block
``delta_vs_reference``  ``val_auc - reference_auc``
``delta_in_floors``   that lift in units of the measured floor
===================== ==========================================================

`gap_in_floors` and `delta_in_floors` are printed only once the contract carries
a measured ``minimum_delta``; before Phase 0 sets it there is no floor to divide
by, and a prediction whose key is not printed is INCONCLUSIVE rather than
refuted, which is the honest answer.

The partition comes from ``kleinlib.data.load_partition`` (which prints the
``split_fingerprint:`` the notary checks against the DATA gate) and the ceiling
is looked up by row label, so the sealed dry-run — which hands back development
rows — reports the development ceiling without this file knowing anything about
it.
"""

from __future__ import annotations

import json
import os
import time
from pathlib import Path

import numpy as np
import pandas as pd
from sklearn.ensemble import HistGradientBoostingClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import roc_auc_score
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler

import kleinlib
from kleinlib.contract import load_contract
from kleinlib.data import load_partition

RANDOM_SEED = 42
SMOKE = os.environ.get("KLEIN_SMOKE") == "1"
EXPERIMENT_ID = os.environ.get("KLEIN_EXPERIMENT_ID") or ("SMOKE" if SMOKE else None)
TRACK = os.environ.get("KLEIN_TRACK") or ("primary" if SMOKE else None)

TRUTH_PATH = Path("data/prepared/truth.json")


def _with_interaction(X: pd.DataFrame) -> pd.DataFrame:
    """Hand the linear model the DGP's true two-way interaction term."""
    out = X.copy()
    out["x1_x2"] = out["x1"] * out["x2"]
    return out


#: The ladder's rungs. A recipe is (feature builder or None, estimator factory).
#: Adding a rung is a deliberate edit to this library; choosing one is the
#: per-experiment idea.
RECIPES = {
    "logreg_raw": (
        None,
        lambda: make_pipeline(
            StandardScaler(),
            LogisticRegression(max_iter=1000, random_state=RANDOM_SEED),
        ),
    ),
    "logreg_interaction": (
        _with_interaction,
        lambda: make_pipeline(
            StandardScaler(),
            LogisticRegression(max_iter=1000, random_state=RANDOM_SEED),
        ),
    ),
    "hgbt_default": (
        None,
        lambda: HistGradientBoostingClassifier(random_state=RANDOM_SEED),
    ),
    "hgbt_overcapacity": (
        None,
        lambda: HistGradientBoostingClassifier(
            max_iter=500,
            learning_rate=0.25,
            max_leaf_nodes=127,
            min_samples_leaf=1,
            l2_regularization=0.0,
            early_stopping=False,
            random_state=RANDOM_SEED,
        ),
    ),
}

# --- the candidate: the whole per-experiment diff surface -------------------
CANDIDATE = "hgbt_default"        # E0003: a boosted tree, told none of the true terms
REFERENCE = "logreg_interaction"  # the hand-specified rung it claims to beat


def fit_recipe(name: str, X_fit: pd.DataFrame, y_fit: pd.Series):
    """Fit one rung; return the model and the feature transform it expects."""
    build, make = RECIPES[name]
    transform = build or (lambda frame: frame)
    model = make()
    model.fit(transform(X_fit), y_fit)
    return model, transform


def positive_probabilities(model, X: pd.DataFrame) -> np.ndarray:
    return np.asarray(model.predict_proba(X))[:, 1]


def ceiling_for(rows: pd.Index, y_eval: pd.Series) -> float:
    """The Bayes AUC of exactly these rows, from the declared true log-odds."""
    eta = np.asarray(json.loads(TRUTH_PATH.read_text(encoding="utf-8"))["true_log_odds"], dtype=float)
    probability = 1.0 / (1.0 + np.exp(-eta[np.asarray(rows)]))
    return float(roc_auc_score(y_eval, probability))


def main() -> None:
    t0 = time.time()
    evaluation_kind = os.environ.get("KLEIN_EVALUATION_KIND")
    if SMOKE:
        evaluation_kind = evaluation_kind or "development"
    missing = [
        name
        for name, value in (
            ("KLEIN_EVALUATION_KIND", evaluation_kind),
            ("KLEIN_EXPERIMENT_ID", EXPERIMENT_ID),
            ("KLEIN_TRACK", TRACK),
        )
        if value is None
    ]
    if missing:
        raise RuntimeError(
            "train.py must be invoked through `klein run-one`. For a pre-run "
            "syntax/shape check use `KLEIN_SMOKE=1 python train.py` — it prints "
            "the canonical block, writes no sidecars or snapshots, and is not "
            "evidence. Missing: " + ", ".join(missing)
        )

    X_fit, X_eval, y_fit, y_eval = load_partition(evaluation_kind, study_dir=".")
    minimum_delta = float(
        load_contract(".")["tracks"][TRACK]["metric"].get("minimum_delta") or 0.0
    )

    fit_start = time.time()
    model, transform = fit_recipe(CANDIDATE, X_fit, y_fit)
    fit_seconds = time.time() - fit_start
    X_eval_t = transform(X_eval)

    # The same arithmetic `evaluate` is about to do, computed here so the
    # distance to the ceiling can be printed alongside the score rather than
    # reconstructed by a reader afterwards.
    candidate_auc = float(roc_auc_score(y_eval, positive_probabilities(model, X_eval_t)))
    bayes_auc = ceiling_for(X_eval.index, y_eval)

    extra: dict[str, str] = {
        "bayes_auc": f"{bayes_auc:.6f}",
        "gap_to_ideal": f"{bayes_auc - candidate_auc:.6f}",
    }
    if minimum_delta > 0:
        extra["gap_in_floors"] = f"{(bayes_auc - candidate_auc) / minimum_delta:.4f}"
    if REFERENCE is not None:
        reference_model, reference_transform = fit_recipe(REFERENCE, X_fit, y_fit)
        reference_auc = float(
            roc_auc_score(
                y_eval, positive_probabilities(reference_model, reference_transform(X_eval))
            )
        )
        extra["reference_auc"] = f"{reference_auc:.6f}"
        extra["delta_vs_reference"] = f"{candidate_auc - reference_auc:.6f}"
        if minimum_delta > 0:
            extra["delta_in_floors"] = f"{(candidate_auc - reference_auc) / minimum_delta:.4f}"

    kleinlib.eval.evaluate(
        model,
        X_eval_t,
        y_eval,
        exp_id=EXPERIMENT_ID,
        study_dir=".",
        t0=t0,
        fit_seconds=fit_seconds,
        train_n=len(X_fit),
        val_n=len(X_eval),
        metric_name="val_auc",
        metric_goal="higher",
        extra=extra,
    )


if __name__ == "__main__":
    main()

Four things worth stealing

Two things this study got wrong, kept, and wrote down

Next steps

  1. Give the replication path something it can copy. Either declare the truth as part of the prepared artifact, or recompute the ceiling from the generator's committed coefficients instead of reading a cache. Then re-run the replication and watch the record come back reproduced. Cheapest fix, highest value.
  2. Measure a paired floor. Every delta here is paired — each run refits its reference on the same rows — but it is divided by a marginal floor, because that is the bar a frontier keep must clear. A paired-bootstrap floor would be the sharper denominator, and the two side by side would show what the conservative choice costs in resolution.
  3. Vary the sample size and watch the headroom close. Both terms of the ratio move with the number of rows: more rows shrink the floor and let the boosted tree get closer. The same four rungs at several table sizes would turn a single reading of the detection limit into a curve.
  4. Try a middle rung. The permission to say anything about capacity here comes from one extreme point. A shrunk, early-stopped boosted tree between the two measured settings would say whether the loss is a cliff or a slope.

References

All four were checked against the publisher or arXiv page before any run, and none of them carries a confirmed claim on its own. The complete citation for each — volume, pages, the date it was verified and by what — is in the study's references.yaml and on the method card; what follows is what a reader needs to find the work and to see why it is here.