whestbench.
API

MLP

Validated MLP container with fixed width and layer depth.

class · source

MLP(width: 'int', depth: 'int', weights: 'Weights', seed: 'int' = 0, name: 'str' = '') -> None
Validated MLP container with fixed width and layer depth.

Attributes:
    width: Number of neurons per layer.
    depth: Number of weight matrices (layers).
    weights: Ordered list of weight matrices, each shape ``(width, width)``.
    seed: Per-MLP grader-supplied seed. Estimators using randomness should
        seed off this so their submission reproduces under regrade. How it
        is obtained depends on the dataset's seed protocol (see
        ``whestbench.seeds``): under 2.0 the parquet ``mlp_seed`` column IS
        this value; under 3.0 it is the third ``SeedSequence`` substream of
        that column; under 4.0 it is a keyed BLAKE2b of it. On the live
        ``make_contest`` path it is derived from ``ContestSpec.seed`` and
        the MLP index. 0 when no seed is available.
    name: Human-readable per-MLP slug like ``"danielle-johnson"``. Stable
        across runs and backends at the WhestBench release's pinned
        ``faker`` version (see ``whestbench.naming``). Empty string when
        the MLP is constructed outside an evaluator bake path (e.g. in
        unit tests). Estimators may read it for log lines.

Note:
    Under seed-protocol 4.0, ``name`` and ``seed`` are two domain-separated
    keyed derivations of the same per-MLP input seed, so neither yields the
    other and neither is computable without the dataset's key. Recognising
    an instance therefore yields identity only.

    Under 2.0 and 3.0, ``name`` is a pure function of ``seed``. That makes
    it a stable identifier for an instance across runs and submissions --
    which is what it is for, not a claim about what it protects. In
    particular, withholding ``name`` while still supplying ``seed`` is not a
    mitigation on those protocols, because anything holding ``seed``
    recomputes ``name`` via ``naming.generate_mlp_name``.