Isolate population-variance decoding after each item’s squared deviation has already been calculated.
Seed 3500 on gpu: 1 of 1 behavioral checks met. See the measurements below. The experiment code has changed since this run; these measurements describe its earlier version.
Insights
Providing squared deviations tests averaging; it does not show that the model can calculate variance from raw values. The generator has already centered and squared each value. The model receives those sufficient statistics and learns to decode their average as population variance.
That makes the case a useful diagnostic beside raw-value variance: if this succeeds while the raw route fails, investigate centering or the learned nonlinear interaction before blaming final reduction. Mean averages encoded tokens, so numerical decoding still has to work. The accuracy gate does not independently establish permutation behavior, varying collection lengths, or handling of missing values, and it supplies no evidence that the model learned the preprocessing operation.
Setup
Code
"""Supplied squared deviations isolate collection averaging.Mean learns population variance once squared deviations are supplied.Run: uv run python proofs/run.py P009"""from __future__ import annotationsfrom collections.abc import Iteratorimport lightning.pytorch as litimport numpy as npimport torchfrom reporting import reportimport relflow as rfPROOF_ID ="P009"ITEMS =8
Examples
Targets use mask=True; the labels below are supervision hidden from the encoder.
The per-item contributions differ, but they still average to 1.0. Every record already supplies the centering and squaring operation; these examples illustrate that diagnostic boundary.
Synthetic data and controls
Code
def dispersion_records(*, rows: int, seed: int) -> Iterator[dict]:"""Draw rows whose location and spread are statistically independent.""" rng = np.random.default_rng(seed)for _ inrange(rows): basis = rng.normal(size=ITEMS) basis -= basis.mean() basis /= np.sqrt(np.mean(np.square(basis))) location =float(rng.uniform(-0.8, 0.8)) scale =float(rng.uniform(0.12, 1.25)) values = location + scale * basis items = [{"squared_deviation": float(np.square(value - location))} for value in values]yield {"items": items, "variance": scale * scale}def prediction(model: rf.Model, observations: list[dict]) -> np.ndarray: inputs = [{"items": row["items"]} for row in observations] output = model.predict(inputs)["predictions"].to_pylist()return np.asarray([row["record/variance"]["content"] for row in output], dtype=np.float64)def rmse(actual: np.ndarray, predicted: np.ndarray |float) ->float:returnfloat(np.sqrt(np.mean(np.square(actual - predicted))))def score(*, train: list[dict], test: list[dict], predicted: np.ndarray) ->dict[str, float]:"""Compare held-out RMSE with the constant training-target mean.""" actual = np.asarray([row["variance"] for row in test], dtype=np.float64) baseline = rmse(actual, float(np.asarray([row["variance"] for row in train], dtype=np.float64).mean())) measured = rmse(actual, predicted)return {"rmse": measured, "baseline_rmse": baseline, "nrmse": measured / baseline}
Model tree
Figure 1: Mean averages eight encoded squared deviations with item attention disabled; root Attention feeds the variance decoder.
How it works
The generator computes (value - mean(value)) ** 2 before encoding. The item branch uses attention=None and rf.Mean(); the root uses learned attention to predict the average of eight supplied squared deviations.
Mean averages encoded tokens, so the decoder still has to learn their numerical interpretation. Passing this diagnostic supports reduction and decoding of sufficient statistics. It does not prove learned centering or squaring; the raw-value variance proof checks those requirements.
Repeat this control across seeds and broaden collection lengths and edge cases. Keep population-versus-sample variance semantics explicit, and retain the raw-value comparison when claiming that dispersion was learned from inputs.
The family’s promotion target is at least three core seeds and ten lightweight calibration seeds.
Reproduce
Run by stable ID from the repository root:
uv run python proofs/run.py P009
Or run the self-contained script directly:
PYTHONPATH=proofs uv run python proofs/aggregation/supplied_squared_deviations.py
Add --accelerator gpu for CUDA or --seed 42 for another seeded experiment. --steps 2 checks execution with a short training budget; it is recorded as a smoke run.