Files
chrnxandClaude Opus 5 d95383f8a2 feat: omega curve and unseen-N, the two steps before psi
omega.md: a plateau at [1,4] that does not track the domain across a 4.7x range,
so the bandwidth is a knob that was set wrong rather than a defect to design
around. omega=8 is an optimisation cliff, not a mis-tune. The project default of
10 is outside the plateau.

scale.md: one parameter set works at an entity count it never trained on --
trained on N<=16 it beats the oracle at N=32 -- and a lookup table does it too.
Read against an oracle because the mse/floor ratio is not comparable across N,
which is asserted as a test rather than claimed in prose. The cost runs
large->small only, at 2.28x, which makes it the pooling's 1/deg dilution rather
than a degree-distribution shift.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCydQraDSoZ9WoTm2v23Eb
2026-09-07 17:45:41 -05:00

45 lines
1.9 KiB
Python

"""The training range is the experiment. If an unseen N appears in training, nothing complains.
Same silent-failure shape as the held-out cells in test_unseen: every arm still trains and every
number still prints, and `unseen N` quietly becomes `seen N`.
"""
import torch
import scale
def test_training_never_sees_an_n_outside_its_range():
gen = torch.Generator().manual_seed(0)
for lo, hi in ((2, 16), (17, 32)):
ns = {a.shape[0] for a, _, _ in scale.mixed_batch(lo, hi, gen, size=200)}
assert ns and min(ns) >= lo and max(ns) <= hi
def test_training_range_actually_varies_n():
# A range that collapsed to a single N would make the whole axis meaningless while still
# satisfying the bounds check above.
gen = torch.Generator().manual_seed(1)
ns = {a.shape[0] for a, _, _ in scale.mixed_batch(2, 16, gen, size=200)}
assert len(ns) > 8
def test_one_parameter_set_evaluates_at_every_n():
# The property under test: the same object, unchanged, runs at any entity count.
model = scale.make_model("rp", 0, 1.0)
before = [p.clone() for p in model.parameters()]
gen = torch.Generator().manual_seed(2)
for n in (2, 7, 16, 25, 32):
for a, r, m in scale.configs(n, 1, gen):
assert scale.run_model(model, a, r, m).shape == (n, scale.D)
assert all(torch.equal(x, y) for x, y in zip(before, model.parameters()))
def test_floor_shrinks_as_n_grows():
# The measurement note in scale.py depends on this being true, so it is checked rather
# than asserted in prose: pooling more neighbours lowers the target's variance, which is
# why the mse/floor ratio must not be read as a trend down the N axis.
tea = scale.teacher(0)
gen = torch.Generator().manual_seed(3)
floors = [scale.evaluate(tea, tea, scale.configs(n, 32, gen))[1] for n in (2, 8, 32)]
assert floors[0] > floors[1] > floors[2]