← Index
Source
Data provenance
ex-2.1.2
·
d036074-dirty
(dirty) · run 2026-07-15
via reports/m2/ex-2.1.2/margins
ex-2.1.3
·
410fbab-dirty
(dirty) · run 2026-07-19
via reports/m2/ex-2.1.3/metrics
ex-2.1.4
·
386c450
· run 2026-07-19
via reports/m2/ex-2.1.4/arrays, reports/m2/ex-2.1.4/evals/v216, reports/m2/ex-2.1.4/evals/v27, reports/m2/ex-2.1.4/metrics
import%20marimo%0A%0A__generated_with%20%3D%20%220.23.9%22%0Aapp%20%3D%20marimo.App(%0A%20%20%20%20width%3D%22medium%22%2C%0A%20%20%20%20app_title%3D%22Ex%202.1.4%3A%20spelling%20the%20names%22%2C%0A%20%20%20%20css_file%3D%22..%2F..%2Freport.css%22%2C%0A%20%20%20%20auto_download%3D%5B%22html%22%5D%2C%0A)%0A%0Awith%20app.setup(hide_code%3DTrue)%3A%0A%20%20%20%20import%20json%0A%20%20%20%20import%20tempfile%0A%20%20%20%20from%20pathlib%20import%20Path%0A%0A%20%20%20%20import%20marimo%20as%20mo%20%20%23%20noqa%3A%20F401%0A%20%20%20%20import%20matplotlib.pyplot%20as%20plt%0A%20%20%20%20import%20numpy%20as%20np%0A%20%20%20%20from%20matplotlib.legend_handler%20import%20HandlerTuple%0A%0A%20%20%20%20%23%20Marimo%20puts%20the%20notebook's%20directory%20on%20sys.path%2C%20so%20the%20experiment%0A%20%20%20%20%23%20definition%20is%20importable%20%E2%80%94%20refs%20and%20sweep%20constants%20can't%20drift.%0A%20%20%20%20from%20experiment%20import%20(%0A%20%20%20%20%20%20%20%20ARRAYS_REF%2C%0A%20%20%20%20%20%20%20%20EVALS_REF%2C%0A%20%20%20%20%20%20%20%20GRID_NAMES%2C%0A%20%20%20%20%20%20%20%20METRICS_REF%2C%0A%20%20%20%20%20%20%20%20N_EXAMPLES%2C%0A%20%20%20%20%20%20%20%20NAME_SEED%2C%0A%20%20%20%20%20%20%20%20SEEDS%2C%0A%20%20%20%20)%0A%20%20%20%20from%20mini.reports%20import%20report_bundle%2C%20use_publisher%0A%20%20%20%20from%20mini.store%20import%20project_store%0A%20%20%20%20from%20mini.vis%20import%20figure_html%2C%20light_dark%2C%20smooth_step%2C%20themed%0A%20%20%20%20from%20sca%20import%20baselines%20as%20bl%0A%20%20%20%20from%20sca.data%20import%20char_names%20as%20ch%0A%20%20%20%20from%20sca.data%20import%20named_colors%20as%20nc%0A%20%20%20%20from%20sca.data.colors%20import%20N_LEVELS%2C%20load_example_sets%2C%20to_hex%0A%0A%20%20%20%20use_publisher(report_bundle(__file__))%0A%0A%20%20%20%20PALETTES%20%3D%20%7Bg%3A%20ch.opaque_names(nc.GRIDS%5Bg%5D%2C%20NAME_SEED)%20for%20g%20in%20GRID_NAMES%7D%0A%20%20%20%20VOCAB_RGB%20%3D%20%7Bg%3A%20np.array(list(p.values())%2C%20dtype%3Dnp.float32)%20%2F%20(N_LEVELS%20-%201)%20for%20g%2C%20p%20in%20PALETTES.items()%7D%0A%0A%20%20%20%20%23%20The%20word-level%20sibling's%20published%20metrics%2C%20for%20rung-to-rung%20comparisons.%0A%20%20%20%20WORD_METRICS_REF%20%3D%20%22reports%2Fm2%2Fex-2.1.3%2Fmetrics%22%0A%20%20%20%20%23%20The%20base%20language's%20schedule%20probes%20(hex%20answers)%2C%20for%20the%20eviction%20contrast.%0A%20%20%20%20HEX_MARGINS_REF%20%3D%20%22reports%2Fm2%2Fex-2.1.2%2Fmargins%22%0A%0A%20%20%20%20def%20load_results()%20-%3E%20tuple%5Bdict%2C%20dict%5Bstr%2C%20np.ndarray%5D%2C%20dict%5Bstr%2C%20dict%5D%5D%20%7C%20None%3A%0A%20%20%20%20%20%20%20%20%22%22%22Resolve%20metrics%2C%20arrays%2C%20and%20eval%20sets%20from%20the%20store%2C%20or%20None%20if%20unpublished.%22%22%22%0A%20%20%20%20%20%20%20%20store%20%3D%20project_store()%0A%20%20%20%20%20%20%20%20arts%20%3D%20store.get_refs(%5BMETRICS_REF%2C%20ARRAYS_REF%2C%20*(f%22%7BEVALS_REF%7D%2F%7Bg%7D%22%20for%20g%20in%20GRID_NAMES)%5D)%0A%20%20%20%20%20%20%20%20m_art%2C%20a_art%20%3D%20arts%5BMETRICS_REF%5D%2C%20arts%5BARRAYS_REF%5D%0A%20%20%20%20%20%20%20%20e_arts%20%3D%20%7Bg%3A%20arts%5Bf%22%7BEVALS_REF%7D%2F%7Bg%7D%22%5D%20for%20g%20in%20GRID_NAMES%7D%0A%20%20%20%20%20%20%20%20if%20m_art%20is%20None%20or%20a_art%20is%20None%20or%20any(v%20is%20None%20for%20v%20in%20e_arts.values())%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20None%0A%20%20%20%20%20%20%20%20with%20tempfile.TemporaryDirectory()%20as%20d%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20paths%20%3D%20store.get_many(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(m_art%2C%20Path(d)%20%2F%20%22metrics.json%22)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(a_art%2C%20Path(d)%20%2F%20%22arrays.npz%22)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20*((art%2C%20Path(d)%20%2F%20f%22%7Bg%7D.json%22)%20for%20g%2C%20art%20in%20e_arts.items()%20if%20art%20is%20not%20None)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20%20%20%20%20metrics%20%3D%20json.loads(paths%5B0%5D.read_text())%0A%20%20%20%20%20%20%20%20%20%20%20%20with%20np.load(paths%5B1%5D)%20as%20z%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20arrays%20%3D%20%7Bk%3A%20z%5Bk%5D%20for%20k%20in%20z.files%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20evals%20%3D%20%7Bp.stem%3A%20load_example_sets(p.read_bytes())%20for%20p%20in%20paths%5B2%3A%5D%7D%0A%20%20%20%20%20%20%20%20return%20metrics%2C%20arrays%2C%20evals%0A%0A%20%20%20%20def%20load_sibling(ref%3A%20str%2C%20kind%3A%20str%20%3D%20%22json%22)%3A%0A%20%20%20%20%20%20%20%20%22%22%22A%20sibling%20experiment's%20published%20artifact%2C%20or%20None%20if%20unavailable.%22%22%22%0A%20%20%20%20%20%20%20%20store%20%3D%20project_store()%0A%20%20%20%20%20%20%20%20art%20%3D%20store.get_ref(ref)%0A%20%20%20%20%20%20%20%20if%20art%20is%20None%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20None%0A%20%20%20%20%20%20%20%20with%20tempfile.TemporaryDirectory()%20as%20d%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20path%20%3D%20store.get(art%2C%20Path(d)%20%2F%20f%22sibling.%7Bkind%7D%22)%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20kind%20%3D%3D%20%22json%22%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%20json.loads(path.read_text())%0A%20%20%20%20%20%20%20%20%20%20%20%20with%20np.load(path)%20as%20z%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%20%7Bk%3A%20z%5Bk%5D%20for%20k%20in%20z.files%7D%0A%0A%20%20%20%20def%20cell_of(metrics%3A%20dict%2C%20grid%3A%20str%2C%20s%3A%20int)%20-%3E%20dict%3A%0A%20%20%20%20%20%20%20%20(r%2C)%20%3D%20%5Br%20for%20r%20in%20metrics%5B%22cells%22%5D%20if%20r%5B%22label%22%5D%20%3D%3D%20f%22%7Bgrid%7D-s%7Bs%7D%22%5D%0A%20%20%20%20%20%20%20%20return%20r%0A%0A%20%20%20%20def%20grid_shades()%20-%3E%20dict%5Bstr%2C%20tuple%5D%3A%0A%20%20%20%20%20%20%20%20%23%20The%20same%20viridis%20stops%20ex-2.1.3%20used%20for%20these%20two%20grids.%0A%20%20%20%20%20%20%20%20stops%20%3D%20light_dark(%5B0.82%2C%200.32%5D%2C%20%5B0.88%2C%200.42%5D)%0A%20%20%20%20%20%20%20%20return%20dict(zip(GRID_NAMES%2C%20plt.cm.viridis(stops)%2C%20strict%3DTrue))%0A%0A%20%20%20%20def%20sw(name%3A%20str%2C%20grid%3A%20str)%20-%3E%20str%3A%0A%20%20%20%20%20%20%20%20%22%22%22Inline%20swatch%20%2B%20name%20for%20a%20grid's%20opaque%20names.%22%22%22%0A%20%20%20%20%20%20%20%20rgb%20%3D%20PALETTES%5Bgrid%5D.get(name)%0A%20%20%20%20%20%20%20%20if%20rgb%20is%20None%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20f%22%3Ccode%3E%7Bname%7D%3C%2Fcode%3E%22%0A%20%20%20%20%20%20%20%20return%20f'%3Cspan%20class%3D%22sw%22%20style%3D%22--sw%3A%20%7Bto_hex(rgb)%7D%3B%22%20aria-hidden%3D%22true%22%3E%3C%2Fspan%3E%20%3Ccode%3E%7Bname%7D%3C%2Fcode%3E'%0A%0A%20%20%20%20def%20dists_for(grid%3A%20str%2C%20exs%3A%20list)%20-%3E%20np.ndarray%3A%0A%20%20%20%20%20%20%20%20%22%22%22(N%2C%20V)%20distance%20from%20every%20vocabulary%20color%20to%20each%20example's%20true%20mix.%22%22%22%0A%20%20%20%20%20%20%20%20result%20%3D%20np.array(%5Bex.result%20for%20ex%20in%20exs%5D%2C%20dtype%3Dnp.float32)%20%2F%20(N_LEVELS%20-%201)%0A%20%20%20%20%20%20%20%20return%20np.linalg.norm(VOCAB_RGB%5Bgrid%5D%5BNone%5D%20-%20result%5B%3A%2C%20None%5D%2C%20axis%3D2)%0A%0A%20%20%20%20def%20renorm(lp%3A%20np.ndarray)%20-%3E%20np.ndarray%3A%0A%20%20%20%20%20%20%20%20%22%22%22Candidate%20log-probabilities%20%E2%86%92%20a%20distribution%20over%20the%20vocabulary%20names.%22%22%22%0A%20%20%20%20%20%20%20%20p%20%3D%20np.exp(lp%20-%20lp.max(axis%3D1%2C%20keepdims%3DTrue))%0A%20%20%20%20%20%20%20%20return%20p%20%2F%20p.sum(axis%3D1%2C%20keepdims%3DTrue)%0A%0A%20%20%20%20def%20raw_rgb(grid%3A%20str)%20-%3E%20np.ndarray%3A%0A%20%20%20%20%20%20%20%20%22%22%22(V%2C%203)%20raw%200..15%20channel%20values%2C%20which%20%60sca.baselines%60%20works%20in.%22%22%22%0A%20%20%20%20%20%20%20%20return%20np.array(list(PALETTES%5Bgrid%5D.values()))%0A%0A%20%20%20%20def%20blind_index(grid%3A%20str%2C%20evals%3A%20dict)%20-%3E%20int%3A%0A%20%20%20%20%20%20%20%20%22%22%22The%20name%20a%20prompt-blind%20model%20would%20always%20answer%2C%20fit%20on%20the%20training%20pairs.%22%22%22%0A%20%20%20%20%20%20%20%20return%20bl.blind_index(dists_for(grid%2C%20evals%5Bgrid%5D%5B%22named_seen%22%5D))%0A%0A%20%20%20%20def%20blind_nearest(grid%3A%20str%2C%20es%3A%20str%2C%20evals%3A%20dict)%20-%3E%20float%3A%0A%20%20%20%20%20%20%20%20%22%22%22How%20often%20the%20prompt-blind%20constant%20happens%20to%20*be*%20the%20nearest%20name.%22%22%22%0A%20%20%20%20%20%20%20%20return%20bl.blind_stats(dists_for(grid%2C%20evals%5Bgrid%5D%5Bes%5D)%2C%20blind_index(grid%2C%20evals))%5B%22nearest%22%5D%0A%0A%20%20%20%20def%20v27_evidence(evals%3A%20dict)%20-%3E%20dict%5Bstr%2C%20float%5D%3A%0A%20%20%20%20%20%20%20%20%22%22%22How%20much%20the%20%60v27%60%20split%20leaves%20to%20learn%20from%2C%20and%20how%20much%20it%20can%20grade.%0A%0A%20%20%20%20%20%20%20%20%60named_seen%60%20is%20the%20complete%20list%20of%20distinct%20training%20pairs%20at%20this%20grid%20(66)%2C%0A%20%20%20%20%20%20%20%20so%20the%20counts%20here%20are%20exact%20rather%20than%20sampled.%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%20%20%20%20seen%2C%20hold%20%3D%20evals%5B%22v27%22%5D%5B%22named_seen%22%5D%2C%20evals%5B%22v27%22%5D%5B%22named_holdout%22%5D%0A%20%20%20%20%20%20%20%20names%20%3D%20%7Bex.lhs%20for%20ex%20in%20seen%7D%20%7C%20%7Bex.rhs%20for%20ex%20in%20seen%7D%0A%20%20%20%20%20%20%20%20mixed%20%3D%20%7Bn%20for%20ex%20in%20seen%20if%20ex.lhs%20!%3D%20ex.rhs%20for%20n%20in%20(ex.lhs%2C%20ex.rhs)%7D%0A%20%20%20%20%20%20%20%20shell%20%3D%20bl.shell_mask(nc.GRIDS%5B%22v27%22%5D%2C%20raw_rgb(%22v27%22)%2C%20%5Bex.result%20for%20ex%20in%20hold%5D)%0A%20%20%20%20%20%20%20%20blind%20%3D%20dists_for(%22v27%22%2C%20hold)%5B%3A%2C%20blind_index(%22v27%22%2C%20evals)%5D%0A%20%20%20%20%20%20%20%20return%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22seen%22%3A%20len(seen)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22hold%22%3A%20len(hold)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22informative%22%3A%20sum(ex.lhs%20!%3D%20ex.rhs%20for%20ex%20in%20seen)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22lonely%22%3A%20len(names%20-%20mixed)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22shell_null%22%3A%20bl.neighborhood_exact_null(shell)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22blind_exact%22%3A%20float((blind%20%3D%3D%200).mean())%2C%0A%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20def%20miss_shape(grid%3A%20str%2C%20arrays%3A%20dict%2C%20evals%3A%20dict)%20-%3E%20dict%5Bstr%2C%20float%5D%3A%0A%20%20%20%20%20%20%20%20%22%22%22Held-out%20guesses%20pooled%20over%20seeds%3A%20how%20near%2C%20how%20often%20an%20operand%2C%20and%20the%20null.%0A%0A%20%20%20%20%20%20%20%20See%20%60sca.baselines%60%20for%20why%20the%20operand%20rate%20needs%20a%20null%20at%20all%3A%20closure%20puts%0A%20%20%20%20%20%20%20%20an%20operand%20one%20grid%20level%20from%20the%20mix%20wherever%20the%20operands%20differ%2C%20so%20on%20a%0A%20%20%20%20%20%20%20%20coarse%20grid%20it%20is%20usually%20a%20member%20of%20the%20mix's%20one-step%20shell%20by%20construction.%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%20%20%20%20exs%20%3D%20evals%5Bgrid%5D%5B%22named_holdout%22%5D%0A%20%20%20%20%20%20%20%20rgb%20%3D%20raw_rgb(grid)%0A%20%20%20%20%20%20%20%20shell%20%3D%20bl.shell_mask(nc.GRIDS%5Bgrid%5D%2C%20rgb%2C%20%5Bex.result%20for%20ex%20in%20exs%5D)%0A%20%20%20%20%20%20%20%20n%20%3D%20n_op%20%3D%20n_shell%20%3D%200%0A%20%20%20%20%20%20%20%20for%20s%20in%20SEEDS%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20guesses%20%3D%20rgb%5Barrays%5Bf%22%7Bgrid%7D-s%7Bs%7D%2Flogp%2Fnamed_holdout%22%5D.argmax(1)%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20for%20row%2C%20ex%2C%20gv%20in%20zip(shell%2C%20exs%2C%20guesses%2C%20strict%3DTrue)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20n%20%2B%3D%201%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20n_op%20%2B%3D%20tuple(gv)%20in%20(tuple(ex.lhs)%2C%20tuple(ex.rhs))%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20n_shell%20%2B%3D%20any(tuple(gv)%20%3D%3D%20tuple(c)%20for%20c%20in%20rgb%5Brow%5D)%0A%20%20%20%20%20%20%20%20null%20%3D%20bl.operand_shell_null(shell%2C%20rgb%2C%20%5B(ex.lhs%2C%20ex.rhs)%20for%20ex%20in%20exs%5D)%0A%20%20%20%20%20%20%20%20return%20%7B%22n%22%3A%20n%2C%20%22operand%22%3A%20n_op%2C%20%22shell%22%3A%20n_shell%2C%20%22null_operand%22%3A%20null%7D%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%20Ex%202.1.4%3A%20spelling%20the%20names%0A%0A%20%20%20%20In%20%5Bex-2.1.3%5D(..%2Fex-2.1.3%2F)%2C%20our%20small%20transformer%20inferred%20the%20geometry%20of%0A%20%20%20%20a%20color%20space%20from%20mixing%20equations%20alone%2C%20but%20every%20color%20was%20a%20single%0A%20%20%20%20opaque%20token%3A%20reading%20an%20operand%20was%20one%20table%20lookup%2C%20and%20writing%20the%0A%20%20%20%20answer%20took%20one%20softmax.%20This%20experiment%20keeps%20the%20same%20language%20and%20setup%0A%20%20%20%20but%20makes%20every%20color%20a%20random%5B%5Ewhy-not-hex%5D%20four-letter%20name%20that%20the%0A%20%20%20%20model%20reads%20and%20writes%20one%20character%20at%20a%20time%3A%0A%0A%20%20%20%20%60%60%60%0A%20%20%20%20tkzk%20%2B%20qwfd%20%3D%20hjnp%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20The%20question%20is%20whether%20one%20token%20per%20concept%20is%20needed%20for%20geometry%0A%20%20%20%20inference.%20This%20language%20variant%20sits%20between%20the%20word-level%20language%0A%20%20%20%20(ex-2.1.3)%20and%20the%20hex%20languages%20(ex-2.1.1%2C%20ex-2.1.2)%2C%20though%20the%20ordering%0A%20%20%20%20by%20difficulty%20isn't%20entirely%20clear%3A%20the%20hex%20models%20seemed%20to%20learn%20some%0A%20%20%20%20geometry%20but%20failed%20to%20predict%20held-out%20named%20colors.%0A%0A%20%20%20%20%5B%5Ewhy-not-hex%5D%3A%20In%20ex-2.1.3%2C%20we%20used%20names%20like%20%60c05f%60%20for%20the%20denser%20grids.%0A%20%20%20%20Those%20are%20single%20tokens%20that%20decode%20as%20hex%2C%20but%20we%20can't%20use%20those%20names%20as%0A%20%20%20%20the%20multi-character%20names%20in%20this%20experiment%2C%20or%20the%20model%20will%20just%20learn%0A%20%20%20%20the%20separable%20channel%20arithmetic%20again%20(as%20in%20ex-2.1.1).%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(rf%22%22%22%0A%20%20%20%20%23%23%20The%20language%0A%0A%20%20%20%20We'll%20use%20two%20data%20grids%20from%20ex-2.1.3%3A%0A%0A%20%20%20%20-%20%60v27%60%20is%20the%203-level%20grid%3A%2027%20colors%2C%20with%20barely%20enough%20closed%20pairs%20to%0A%20%20%20%20%20%20learn%20from.%0A%20%20%20%20-%20%60v216%60%20is%20the%206-level%20grid%2C%20216%20colors%2C%20where%20the%20word-level%20model%20had%0A%20%20%20%20%20%20essentially%20solved%20the%20task.%0A%0A%20%20%20%20Each%20grid%20trains%20three%20seeds%20of%20the%20d64-L4%20architecture%20from%20scratch%2C%20on%20the%0A%20%20%20%20same%20%60a%20%2B%20b%20%3D%20mix(a%2C%20b)%60%20equations%20as%20ex-2.1.3%2C%20but%20tokenized%20differently.%20A%0A%20%20%20%20line%20is%20now%2019%20character%20tokens%20rather%20than%206%2C%20so%20the%0A%20%20%20%20%7BN_EXAMPLES%3A%2C%7D-equation%20corpus%20holds%20about%203%C3%97%20the%20tokens%3B%20we%20assume%20this%0A%20%20%20%20isn't%20a%20significant%20confound%20as%20long%20as%20training%20reaches%20a%20low%20loss.%0A%0A%20%20%20%20The%20model%20now%20has%20to%20recognize%20%60tkzk%60%20as%20one%20unit%20spread%20over%20four%20positions%0A%20%20%20%20and%20attach%20a%20value%20to%20it.%20It%20then%20has%20to%20start%20writing%20the%20mix's%20name%20before%0A%20%20%20%20any%20of%20it%20is%20in%20the%20context%2C%20and%20continue%20without%20losing%20track.%0A%0A%20%20%20%20A%20few%20lines%20from%20each%20corpus%3A%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20def%20_sample(grid%3A%20str)%20-%3E%20str%3A%0A%20%20%20%20%20%20%20%20names%20%3D%20%7Bv%3A%20k%20for%20k%2C%20v%20in%20PALETTES%5Bgrid%5D.items()%7D%0A%20%20%20%20%20%20%20%20return%20%22%22.join(ch.rename(ex%2C%20names).text%20for%20ex%20in%20nc.sample_corpus(5%2C%200%2C%20nc.GRIDS%5Bgrid%5D))%0A%0A%20%20%20%20mo.hstack(%0A%20%20%20%20%20%20%20%20%5Bmo.md(f%22%60%7Bg%7D%60%3A%5Cn%60%60%60%5Cn%7B_sample(g)%7D%60%60%60%22)%20for%20g%20in%20GRID_NAMES%5D%2C%0A%20%20%20%20%20%20%20%20justify%3D%22start%22%2C%0A%20%20%20%20%20%20%20%20gap%3D3%2C%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20What%20we%20measure%0A%0A%20%20%20%20-%20Greedy%20accuracy%3A%20decode%20five%20characters%2C%20taking%20the%20most%20likely%20at%20each%0A%20%20%20%20%20%20step%2C%20and%20check%20them%20against%20the%20true%20name.%20We%20also%20record%20%60p_malformed%60%3A%0A%20%20%20%20%20%20how%20often%20the%20output%20is%20no%20color's%20name%20at%20all.%0A%20%20%20%20-%20Candidate%20accuracy%3A%20teacher-force%20every%20vocabulary%20name%20plus%20its%20closing%0A%20%20%20%20%20%20newline%20and%20take%20the%20highest%20scorer.%20This%20sets%20spelling%20aside%2C%20and%20it%0A%20%20%20%20%20%20recovers%20the%20model's%20full%20distribution%20over%20well-formed%20answers.%0A%20%20%20%20-%20Distribution%20distance%3A%20compare%20that%20answer%20distribution%20to%20soft%20targets%0A%20%20%20%20%20%20built%20from%20color%20geometry%20%E2%80%94%20a%20softmax%20of%20negative%20RGB%20distance%20to%20the%20true%0A%20%20%20%20%20%20mix%20at%20a%20temperature%20%CF%84.%20A%20model%20that%20has%20learned%20the%20geometry%20should%0A%20%20%20%20%20%20spread%20its%20uncertainty%20over%20colors%20near%20the%20true%20mix.%20This%20also%20works%20on%0A%20%20%20%20%20%20open%20pairs%2C%20where%20no%20name%20is%20exactly%20right.%0A%20%20%20%20-%20Distances%2C%20as%20in%20ex-2.1.3%3A%20RGB%20distance%20from%20the%20model's%20chosen%20name%20(the%0A%20%20%20%20%20%20candidate%20argmax)%20to%20the%20true%20mix%2C%20set%20against%20the%20nearest-name%20floor%20and%0A%20%20%20%20%20%20the%20vocabulary-mean%20chance.%0A%20%20%20%20-%20Probes%3A%20per-depth%20ridge%20probes%20for%20operand%20and%20result%20RGB%2C%20fit%20on%0A%20%20%20%20%20%20in-training%20lines%20and%20checked%20for%20transfer%20to%20held-out%20and%20open%20prompts%3B%0A%20%20%20%20%20%20plus%20the%20answer-schedule%20probe%20from%20ex-2.1.2%2C%20which%20teacher-forces%20whole%0A%20%20%20%20%20%20equations%20and%20probes%20for%20the%20mix's%20three%20channels%20at%20every%20position%20around%0A%20%20%20%20%20%20the%20answer%2C%20at%20each%20depth.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Hypotheses%0A%0A%20%20%20%20Written%20down%20before%20we%20looked%20at%20any%20results.%0A%0A%20%20%20%20**H1.**%20Training%20still%20works%3A%20seen-pair%20accuracy%20is%20near-perfect%20on%20both%0A%20%20%20%20grids%2C%20and%20malformed%20completions%20are%20rare.%20Well-formedness%20is%20a%20local%0A%20%20%20%20statistical%20pattern%20(after%20%60%3D%20%60%2C%20four%20letters%20and%20a%20newline)%20that%20a%20char%0A%20%20%20%20model%20of%20this%20size%20picks%20up%20easily.%0A%0A%20%20%20%20**H2.**%20Held-out%20accuracy%20will%20be%20lower%20than%20ex-2.1.3%20which%20scored%20%E2%89%88%201.0%2C%0A%20%20%20%20but%20well%20above%20zero.%20Multi-token%20names%20add%20ways%20to%20fail%20at%20binding%20and%0A%20%20%20%20emission%20without%20removing%20the%20co-occurrence%20evidence%20the%20inference%20runs%20on.%0A%20%20%20%20%60v27%60%20stays%20low%2C%20as%20it%20was%20at%20word%20level.%20A%20%60v216%60%20collapse%20to%20%E2%89%88%200%20would%0A%20%20%20%20mean%20that%20multi-token%20naming%20on%20its%20own%20blocks%20the%20inference.%0A%0A%20%20%20%20**H3.**%20Where%20the%20task%20is%20learned%2C%20guesses%20stay%20close%20in%20color%20space%3A%0A%20%20%20%20near-floor%20distances%20on%20open%20pairs%2C%20and%20misses%20that%20are%20neighbors%20rather%20than%0A%20%20%20%20random%20names.%20Geometric%20closeness%20held%20at%20every%20vocabulary%20size%20at%20word%20level%2C%0A%20%20%20%20including%20sizes%20whose%20exact%20match%20was%20poor%2C%20so%20we%20expect%20it%20to%20survive%20the%0A%20%20%20%20tokenizer%20change%20as%20well.%0A%0A%20%20%20%20**H4.**%20The%20mix%20has%20a%20fixed%20home%20even%20though%20the%20answer%20spans%20several%20tokens.%0A%20%20%20%20No%20character%20of%20an%20opaque%20name%20stands%20for%20a%20channel%2C%20so%20the%20model%20cannot%0A%20%20%20%20compute%20one%20channel%2C%20write%20it%2C%20and%20drop%20it%3B%20whatever%20it%20knows%20about%20the%20mix%0A%20%20%20%20has%20to%20stay%20put%20while%20the%20name%20is%20being%20spelled.%20Concretely%2C%20all%20three%20RGB%0A%20%20%20%20channels%20stay%20decodable%20at%20late%20depth%20across%20the%20whole%20emission%20window%2C%20unlike%0A%20%20%20%20ex-2.1.2's%20per-channel%20stair-step.%20We%20also%20expect%20the%20mix%20to%20be%20largely%0A%20%20%20%20decodable%20at%20the%20pre-answer%20position%2C%20as%20at%20word%20level%2C%20though%20it%20may%20come%0A%20%20%20%20together%20later%20in%20depth%2C%20since%20identifying%20the%20operands%20now%20takes%20layers%20of%0A%20%20%20%20work%20that%20embeddings%20used%20to%20handle.%0A%0A%20%20%20%20**H5.**%20The%20answer%20distribution%20is%20shaped%20like%20the%20color%20geometry.%20The%20KL%0A%20%20%20%20divergence%20from%20the%20distance-softmax%20target%20to%20the%20candidate%20distribution%2C%0A%20%20%20%20minimized%20over%20%CF%84%2C%20sits%20far%20below%20the%20same%20divergence%20for%20a%20value-blind%0A%20%20%20%20reference%20(uniform%20over%20names)%2C%20and%20the%20best-fit%20%CF%84%20is%20on%20the%20order%20of%20the%20grid%0A%20%20%20%20spacing.%20Less%20confidently%2C%20%60v216%60's%20distribution%20should%20match%20the%20targets%0A%20%20%20%20better%20than%20%60v27%60's%2C%20echoing%20the%20geometric%20trend%20of%20the%20word-level%20sweep.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20loaded%20%3D%20load_results()%0A%20%20%20%20return%20(loaded%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(loaded)%3A%0A%20%20%20%20mo.stop(%0A%20%20%20%20%20%20%20%20loaded%20is%20None%2C%0A%20%20%20%20%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%20%20%20%20%22No%20results%20yet%20%E2%80%94%20run%20the%20experiment%20(it%20publishes%20metrics%2C%20arrays%2C%20eval%20sets%2C%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%22and%20checkpoints%20on%20completion)%3A%5Cn%5Cn%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%22%60%60%60bash%5Cnbin%2Fmini%20run%20docs%2Fm2%2Fex-2.1.4%2Fexperiment.py%20--app%20modal%20--max-containers%209%5Cn%60%60%60%22%0A%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20)%0A%20%20%20%20metrics%2C%20arrays%2C%20evals%20%3D%20loaded%0A%20%20%20%20return%20arrays%2C%20evals%2C%20metrics%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(metrics)%3A%0A%20%20%20%20def%20_mean(g%2C%20es%2C%20key)%3A%0A%20%20%20%20%20%20%20%20return%20float(np.mean(%5Bcell_of(metrics%2C%20g%2C%20s)%5B%22sets%22%5D%5Bes%5D%5Bkey%5D%20for%20s%20in%20SEEDS%5D))%0A%0A%20%20%20%20_hold%20%3D%20%7Bg%3A%20_mean(g%2C%20%22named_holdout%22%2C%20%22accuracy%22)%20for%20g%20in%20GRID_NAMES%7D%0A%20%20%20%20_mal%20%3D%20%7Bg%3A%20_mean(g%2C%20%22named_holdout%22%2C%20%22p_malformed%22)%20for%20g%20in%20GRID_NAMES%7D%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22**Headline%20numbers.**%20Mean%20held-out%20greedy%20accuracy%3A%20%22%0A%20%20%20%20%20%20%20%20%2B%20%22%2C%20%22.join(f%22%60%7Bg%7D%60%20**%7Bv%3A.2f%7D**%22%20for%20g%2C%20v%20in%20_hold.items())%0A%20%20%20%20%20%20%20%20%2B%20%22%20(word%20level%20scored%200.27%20and%20%E2%89%88%201.0%20on%20these%20grids).%20Malformed%20completions%3A%20%22%0A%20%20%20%20%20%20%20%20%2B%20%22%2C%20%22.join(f%22%7Bv%3A.1%25%7D%20on%20%60%7Bg%7D%60%22%20for%20g%2C%20v%20in%20_mal.items())%0A%20%20%20%20%20%20%20%20%2B%20f%22.%20Held-out%20guesses%20land%20a%20mean%20%7B_mean('v216'%2C%20'named_holdout'%2C%20'guess_dist')%3A.2f%7D%20%22%0A%20%20%20%20%20%20%20%20f%22from%20the%20true%20mix%20on%20%60v216%60%20(chance%20%7B_mean('v216'%2C%20'named_holdout'%2C%20'chance_dist')%3A.2f%7D).%20%22%0A%20%20%20%20%20%20%20%20%22The%20sections%20that%20follow%20fill%20this%20in%2C%20starting%20with%20the%20corpus%20accounting.%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(metrics)%3A%0A%20%20%20%20_stats%20%3D%20metrics%5B%22corpus_stats%22%5D%0A%20%20%20%20_rows%20%3D%20%22%22.join(%0A%20%20%20%20%20%20%20%20f%22%3Ctr%3E%3Ctd%3E%3Ccode%3E%7Bg%7D%3C%2Fcode%3E%3C%2Ftd%3E%22%0A%20%20%20%20%20%20%20%20f'%3Ctd%20class%3D%22num%22%3E%7Bs%5B%22n_colors%22%5D%3A%2C%7D%3C%2Ftd%3E'%0A%20%20%20%20%20%20%20%20f'%3Ctd%20class%3D%22num%22%3E%7Bs%5B%22n_seen_distinct%22%5D%3A%2C%7D%3C%2Ftd%3E'%0A%20%20%20%20%20%20%20%20f'%3Ctd%20class%3D%22num%22%3E%7Bs%5B%22n_holdout%22%5D%3A%2C%7D%3C%2Ftd%3E'%0A%20%20%20%20%20%20%20%20f'%3Ctd%20class%3D%22num%22%3E%7Bs%5B%22n_open%22%5D%3A%2C%7D%3C%2Ftd%3E'%0A%20%20%20%20%20%20%20%20f'%3Ctd%20class%3D%22num%22%3E%7Bs%5B%22total_tokens%22%5D%3A%2C%7D%3C%2Ftd%3E'%0A%20%20%20%20%20%20%20%20%22%3C%2Ftr%3E%22%0A%20%20%20%20%20%20%20%20for%20g%2C%20s%20in%20_stats.items()%0A%20%20%20%20)%0A%20%20%20%20_table%20%3D%20(%0A%20%20%20%20%20%20%20%20'%3Cdiv%20class%3D%22report-table-scroll%22%3E%3Ctable%20class%3D%22report-table%22%3E'%0A%20%20%20%20%20%20%20%20'%3Ctr%3E%3Cth%3Egrid%3C%2Fth%3E%3Cth%20class%3D%22num%22%3Ecolors%3C%2Fth%3E%3Cth%20class%3D%22num%22%3Edistinct%20pairs%20in%20corpus%3C%2Fth%3E'%0A%20%20%20%20%20%20%20%20'%3Cth%20class%3D%22num%22%3Eheld%20out%3C%2Fth%3E%3Cth%20class%3D%22num%22%3Eopen%20pairs%3C%2Fth%3E'%0A%20%20%20%20%20%20%20%20'%3Cth%20class%3D%22num%22%3Ecorpus%20tokens%3C%2Fth%3E%3C%2Ftr%3E'%20%2B%20_rows%20%2B%20%22%3C%2Ftable%3E%3C%2Fdiv%3E%22%0A%20%20%20%20)%0A%20%20%20%20_caption%20%3D%20mo.md(%0A%20%20%20%20%20%20%20%20f%22%22%22%0A%20%20%20%20%20%20%20%20Pair%20counts%20per%20grid.%20These%20match%20ex-2.1.3's%20by%20construction%20(same%0A%20%20%20%20%20%20%20%20sampler%2C%20same%20seed)%3B%20only%20the%20token%20count%20changes%20(%7BN_EXAMPLES%3A%2C%7D%20equations%0A%20%20%20%20%20%20%20%20%C3%97%2019%20characters%2C%20against%20%C3%97%206%20word-level%20tokens).%20At%20%60v27%60%20the%20two%20pair%0A%20%20%20%20%20%20%20%20columns%20are%20the%20entire%20closed%20universe%3A%2076%20equations%20exist%2C%20and%2027%20of%0A%20%20%20%20%20%20%20%20the%2066%20training%20ones%20are%20%60a%20%2B%20a%20%3D%20a%60.%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20).text%0A%20%20%20%20mo.Html(figure_html(_table%2C%20caption%3D_caption%2C%20class_%3D%22report-figure%22))%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Training%0A%0A%20%20%20%20Both%20grids%20train%20smoothly%20under%20the%20same%20100-epoch%20schedule%20as%20before.%20The%0A%20%20%20%20curves%20are%20not%20comparable%20to%20ex-2.1.3's%3A%20the%20vocabulary%20here%20is%2030%20characters%0A%20%20%20%20rather%20than%20hundreds%20of%20names%2C%20so%20chance%20loss%20is%20lower.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(metrics)%3A%0A%20%20%20%20%40themed(%0A%20%20%20%20%20%20%20%20name%3D%22val-loss%22%2C%0A%20%20%20%20%20%20%20%20alt_text%3D%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Validation%20loss%20versus%20training%20epoch%20for%20the%20two%20grids%2C%20v27%20and%20v216%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20with%20three%20seeds%20each%20drawn%20as%20thin%20overlapping%20lines.%20Every%20curve%20settles%0A%20%20%20%20%20%20%20%20%20%20%20%20smoothly%20inside%20the%20100-epoch%20budget.%0A%20%20%20%20%20%20%20%20%22%22%22%2C%0A%20%20%20%20%20%20%20%20caption%3D%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Validation%20loss%20per%20epoch%2C%20with%20three%20thin%20lines%20per%20grid%2C%20one%20per%20seed.%0A%20%20%20%20%20%20%20%20%20%20%20%20This%20is%20per-token%20loss%20over%20characters%2C%20so%20it%20does%20not%20line%20up%20with%20the%0A%20%20%20%20%20%20%20%20%20%20%20%20word-level%20experiment's%20curves%3B%20what%20matters%20is%20that%20each%20curve%20converges.%0A%20%20%20%20%20%20%20%20%22%22%22%2C%0A%20%20%20%20)%0A%20%20%20%20def%20_plot()%20-%3E%20plt.Figure%3A%0A%20%20%20%20%20%20%20%20fig%2C%20ax%20%3D%20plt.subplots(figsize%3D(7.0%2C%203.6))%0A%20%20%20%20%20%20%20%20shades%20%3D%20grid_shades()%0A%20%20%20%20%20%20%20%20for%20g%20in%20GRID_NAMES%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20for%20s%20in%20SEEDS%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20vl%20%3D%20cell_of(metrics%2C%20g%2C%20s)%5B%22val_loss%22%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ax.plot(vl%2C%20color%3Dshades%5Bg%5D%2C%20lw%3D1.0%2C%20alpha%3D0.8%2C%20label%3Dg%20if%20s%20%3D%3D%200%20else%20None)%0A%20%20%20%20%20%20%20%20ax.set(xlabel%3D%22epoch%22%2C%20ylabel%3D%22validation%20loss%22)%0A%20%20%20%20%20%20%20%20ax.legend()%0A%20%20%20%20%20%20%20%20ax.grid(alpha%3D0.3)%0A%20%20%20%20%20%20%20%20return%20fig%0A%0A%20%20%20%20mo.Html(_plot())%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Exact-match%20accuracy%0A%0A%20%20%20%20Greedy%20accuracy%20is%20the%20end-to-end%20score%3B%20candidate%20accuracy%20(the%20argmax%0A%20%20%20%20over%20teacher-forced%20names)%20tells%20us%20how%20much%20of%20any%20gap%20is%20spelling%20rather%0A%20%20%20%20than%20knowledge.%20The%20dashed%20line%20over%20each%20group%20of%20bars%20is%20ex-2.1.3's%0A%20%20%20%20word-level%20accuracy%20on%20the%20same%20pairs.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(metrics)%3A%0A%20%20%20%20_word%20%3D%20load_sibling(WORD_METRICS_REF)%0A%20%20%20%20_sets%20%3D%20%5B%22named_seen%22%2C%20%22named_holdout%22%5D%0A%0A%20%20%20%20%40themed(%0A%20%20%20%20%20%20%20%20name%3D%22accuracy%22%2C%0A%20%20%20%20%20%20%20%20alt_text%3D%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Two%20bar%20panels%20of%20exact-match%20accuracy%20(0%20to%201)%20for%20grids%20v27%20and%20v216%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20one%20panel%20for%20seen%20pairs%20and%20one%20for%20held-out%20pairs.%20Each%20grid%20shows%20a%0A%20%20%20%20%20%20%20%20%20%20%20%20greedy%20bar%20and%20a%20candidate%20(argmax%20over%20teacher-forced%20names)%20bar%20in%20the%0A%20%20%20%20%20%20%20%20%20%20%20%20grid's%20color%2C%20with%20a%20dashed%20horizontal%20line%20over%20the%20group%20marking%0A%20%20%20%20%20%20%20%20%20%20%20%20ex-2.1.3's%20word-level%20accuracy%20on%20the%20same%20pairs.%20Bars%20are%20means%20over%20three%0A%20%20%20%20%20%20%20%20%20%20%20%20seeds%2C%20dots%20the%20individual%20seeds.%20On%20seen%20pairs%20all%20bars%20are%20at%201.0.%20On%0A%20%20%20%20%20%20%20%20%20%20%20%20held-out%20pairs%20v27's%20bars%20sit%20at%20zero%2C%20below%20its%20word-level%20line%20at%200.27%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20while%20v216's%20bars%20reach%200.91%2C%20just%20under%20its%20word-level%20line%20near%201.0.%0A%20%20%20%20%20%20%20%20%22%22%22%2C%0A%20%20%20%20%20%20%20%20caption%3D%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Exact%20match%20by%20grid%20and%20eval%20set%3B%20bars%20are%20means%20over%20three%20seeds%2C%20dots%20the%0A%20%20%20%20%20%20%20%20%20%20%20%20individual%20seeds.%20Greedy%20decoding%20writes%20freely%2C%20so%20spelling%20mistakes%20count%0A%20%20%20%20%20%20%20%20%20%20%20%20as%20misses%3B%20candidate%20scoring%20picks%20the%20highest-probability%20vocabulary%20name%0A%20%20%20%20%20%20%20%20%20%20%20%20and%20so%20cannot%20misspell.%20The%20dashed%20line%20over%20each%20group%20is%20the%20word-level%0A%20%20%20%20%20%20%20%20%20%20%20%20benchmark%2C%20ex-2.1.3's%20accuracy%20on%20the%20same%20pairs%20with%20one-token%20names.%0A%20%20%20%20%20%20%20%20%22%22%22%2C%0A%20%20%20%20)%0A%20%20%20%20def%20_plot()%20-%3E%20plt.Figure%3A%0A%20%20%20%20%20%20%20%20fig%2C%20axes%20%3D%20plt.subplots(1%2C%20len(_sets)%2C%20figsize%3D(8.4%2C%203.4)%2C%20sharey%3DTrue)%0A%20%20%20%20%20%20%20%20shades%20%3D%20grid_shades()%0A%20%20%20%20%20%20%20%20fg%20%3D%20light_dark(%22%23333%22%2C%20%22%23ddd%22)%0A%20%20%20%20%20%20%20%20for%20ax%2C%20es%20in%20zip(axes%2C%20_sets%2C%20strict%3DTrue)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20for%20i%2C%20g%20in%20enumerate(GRID_NAMES)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20per_seed%20%3D%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5Bcell_of(metrics%2C%20g%2C%20s)%5B%22sets%22%5D%5Bes%5D%5Bk%5D%20for%20s%20in%20SEEDS%5D%20for%20k%20in%20(%22accuracy%22%2C%20%22cand_accuracy%22)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20for%20x%2C%20vals%2C%20a%20in%20zip(%5Bi%20-%200.16%2C%20i%20%2B%200.16%5D%2C%20per_seed%2C%20(1.0%2C%200.55)%2C%20strict%3DTrue)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ax.bar(%5Bx%5D%2C%20%5Bnp.mean(vals)%5D%2C%20color%3Dshades%5Bg%5D%2C%20alpha%3Da%2C%20width%3D0.28)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ax.plot(%5Bx%5D%20*%20len(vals)%2C%20vals%2C%20%22o%22%2C%20color%3Dlight_dark(%22%230008%22%2C%20%22%23fff8%22)%2C%20ms%3D3%2C%20zorder%3D3)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if%20_word%20is%20not%20None%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20wl%20%3D%20np.mean(%5Bcell_of(_word%2C%20g%2C%20s)%5B%22sets%22%5D%5Bes%5D%5B%22accuracy%22%5D%20for%20s%20in%20SEEDS%5D)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ax.plot(%5Bi%20-%200.38%2C%20i%20%2B%200.38%5D%2C%20%5Bwl%2C%20wl%5D%2C%20color%3Dfg%2C%20ls%3D%22--%22%2C%20lw%3D1.4%2C%20zorder%3D4)%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.set(title%3Des.replace(%22_%22%2C%20%22%20%22)%2C%20ylim%3D(-0.03%2C%201.03))%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.set_xticks(range(len(GRID_NAMES))%2C%20GRID_NAMES)%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.grid(alpha%3D0.3%2C%20axis%3D%22y%22)%0A%20%20%20%20%20%20%20%20axes%5B0%5D.set_ylabel(%22exact-match%20accuracy%22)%0A%0A%20%20%20%20%20%20%20%20def%20_pair(a%3A%20float)%20-%3E%20tuple%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20tuple(plt.Rectangle((0%2C%200)%2C%201%2C%201%2C%20fc%3Dshades%5Bg%5D%2C%20alpha%3Da)%20for%20g%20in%20GRID_NAMES)%0A%0A%20%20%20%20%20%20%20%20_handles%3A%20list%20%3D%20%5B_pair(1.0)%2C%20_pair(0.55)%5D%0A%20%20%20%20%20%20%20%20_labels%20%3D%20%5B%22greedy%22%2C%20%22candidate%22%5D%0A%20%20%20%20%20%20%20%20if%20_word%20is%20not%20None%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20_handles.append(plt.Line2D(%5B%5D%2C%20%5B%5D%2C%20color%3Dfg%2C%20ls%3D%22--%22%2C%20lw%3D1.4))%0A%20%20%20%20%20%20%20%20%20%20%20%20_labels.append(%22word%20level%20(ex-2.1.3)%22)%0A%20%20%20%20%20%20%20%20axes%5B1%5D.legend(%0A%20%20%20%20%20%20%20%20%20%20%20%20_handles%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20_labels%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20handler_map%3D%7Btuple%3A%20HandlerTuple(ndivide%3DNone%2C%20pad%3D0.2)%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20fontsize%3D8%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20loc%3D%22upper%20left%22%2C%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20return%20fig%0A%0A%20%20%20%20mo.Html(_plot())%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(arrays%2C%20evals%2C%20metrics)%3A%0A%20%20%20%20def%20_mean(g%2C%20es%2C%20key)%3A%0A%20%20%20%20%20%20%20%20return%20float(np.mean(%5Bcell_of(metrics%2C%20g%2C%20s)%5B%22sets%22%5D%5Bes%5D%5Bkey%5D%20for%20s%20in%20SEEDS%5D))%0A%0A%20%20%20%20def%20_miss_structure(g%3A%20str)%20-%3E%20tuple%5Bint%2C%20int%2C%20int%5D%3A%0A%20%20%20%20%20%20%20%20%22%22%22Pooled%20over%20seeds%3A%20(misses%2C%20one-channel%20misses%2C%20of%20those%20off%20by%20one%20level).%22%22%22%0A%20%20%20%20%20%20%20%20exs%20%3D%20evals%5Bg%5D%5B%22named_holdout%22%5D%0A%20%20%20%20%20%20%20%20rgb%20%3D%20np.array(list(PALETTES%5Bg%5D.values()))%0A%20%20%20%20%20%20%20%20lvl%20%3D%20%7Bv%3A%20i%20for%20i%2C%20v%20in%20enumerate(nc.GRIDS%5Bg%5D)%7D%0A%20%20%20%20%20%20%20%20n_miss%20%3D%20n_1ch%20%3D%20n_1lvl%20%3D%200%0A%20%20%20%20%20%20%20%20for%20s%20in%20SEEDS%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20guesses%20%3D%20rgb%5Barrays%5Bf%22%7Bg%7D-s%7Bs%7D%2Flogp%2Fnamed_holdout%22%5D.argmax(1)%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20for%20ex%2C%20gv%20in%20zip(exs%2C%20guesses%2C%20strict%3DTrue)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20diff%20%3D%20%5Bint(a%20!%3D%20b)%20for%20a%2C%20b%20in%20zip(gv%2C%20ex.result%2C%20strict%3DTrue)%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if%20sum(diff)%20%3D%3D%200%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20continue%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20n_miss%20%2B%3D%201%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if%20sum(diff)%20%3D%3D%201%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20n_1ch%20%2B%3D%201%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(chn%2C)%20%3D%20%5Bi%20for%20i%2C%20dd%20in%20enumerate(diff)%20if%20dd%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20n_1lvl%20%2B%3D%20abs(lvl%5Bint(gv%5Bchn%5D)%5D%20-%20lvl%5Bex.result%5Bchn%5D%5D)%20%3D%3D%201%0A%20%20%20%20%20%20%20%20return%20n_miss%2C%20n_1ch%2C%20n_1lvl%0A%0A%20%20%20%20_m216%20%3D%20_miss_structure(%22v216%22)%0A%20%20%20%20_s2_27%20%3D%20float(np.mean(%5Bcell_of(metrics%2C%20%22v27%22%2C%20s)%5B%22sets%22%5D%5B%22named_holdout%22%5D%5B%22calibration%22%5D%5B%22s2%22%5D%20for%20s%20in%20SEEDS%5D))%0A%20%20%20%20_s2_216%20%3D%20float(np.mean(%5Bcell_of(metrics%2C%20%22v216%22%2C%20s)%5B%22sets%22%5D%5B%22named_holdout%22%5D%5B%22calibration%22%5D%5B%22s2%22%5D%20for%20s%20in%20SEEDS%5D))%0A%20%20%20%20mo.md(rf%22%22%22%0A%20%20%20%20Seen%20pairs%20are%20perfect%20on%20both%20grids%20(greedy%0A%20%20%20%20%7B_mean(%22v27%22%2C%20%22named_seen%22%2C%20%22accuracy%22)%3A.2f%7D%20%2F%0A%20%20%20%20%7B_mean(%22v216%22%2C%20%22named_seen%22%2C%20%22accuracy%22)%3A.2f%7D)%2C%20and%20H1%20holds%3A%20no%20malformed%0A%20%20%20%20completion%20turns%20up%20in%20any%20eval%20set%20or%20seed%2C%20and%20the%20probability%20mass%20on%0A%20%20%20%20complete%20names%20sums%20to%20%7B_mean(%22v216%22%2C%20%22named_holdout%22%2C%20%22mass_names%22)%3A.2f%7D.%0A%20%20%20%20Greedy%20and%20candidate%20accuracy%20agree%20everywhere%2C%20so%20it%20seems%20that%20spelling%20is%0A%20%20%20%20a%20settled%20sub-problem.%0A%0A%20%20%20%20Held-out%20accuracy%20does%20drop.%20%60v216%60%20lands%20at%0A%20%20%20%20%7B_mean(%22v216%22%2C%20%22named_holdout%22%2C%20%22accuracy%22)%3A.2f%7D%2C%20below%20its%20word-level%0A%20%20%20%20benchmark%20of%20%E2%89%88%200.99%20but%20in%20line%20with%20H2.%20The%20misses%20are%20similar%20to%20the%0A%20%20%20%20word-level%20full%20grid%3A%20pooled%20over%20seeds%2C%20%7B_m216%5B1%5D%7D%20of%20%7B_m216%5B0%5D%7D%20are%0A%20%20%20%20wrong%20in%20exactly%20one%20RGB%20channel%2C%20and%20%7B_m216%5B2%5D%7D%20of%20those%20are%20off%20by%20a%0A%20%20%20%20single%20grid%20level.%20The%20model%20works%20out%20roughly%20the%20right%20mix%20and%0A%20%20%20%20occasionally%20rounds%20one%20channel%20to%20a%20neighboring%20level.%0A%0A%20%20%20%20%60v27%60%20drops%20much%20more%20than%20H2%20expected%3A%20zero%20on%20every%20seed%20(compared%20to%200.27%0A%20%20%20%20for%20word-level%20tokens).%20And%20the%20model%20is%20confident%20about%20it%3A%20s%E2%82%82%20%3D%0A%20%20%20%20%7B_s2_27%3A.2f%7D%20on%20those%20prompts%20(confidently%20wrong%3B%20%60v216%60%20reads%0A%20%20%20%20%7B_s2_216%3A.2f%7D%2C%20well%20calibrated)%2C%20and%20the%20true%20answer's%20candidate%20NLL%20is%20%E2%89%88%2013%0A%20%20%20%20nats.%20The%20failure%20rows%20further%20down%20show%20that%20it%20expects%20nearby%20names%20%E2%80%94%0A%20%20%20%20often%20one%20of%20the%20operands%2C%20though%20the%20section%20after%20them%20shows%20that%20is%20what%0A%20%20%20%20the%20grid%20geometry%20predicts%20on%20its%20own.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20How%20close%20do%20the%20guesses%20land%3F%0A%0A%20%20%20%20The%20graded%20view%2C%20as%20in%20ex-2.1.3%3A%20for%20every%20prompt%2C%20the%20RGB%20distance%20from%0A%20%20%20%20the%20model's%20chosen%20name%20(the%20candidate%20argmax%2C%20so%20spelling%20plays%20no%20part)%0A%20%20%20%20to%20the%20true%20mix%2C%20drawn%20as%20a%20cumulative%20distribution.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(arrays%2C%20evals)%3A%0A%20%20%20%20_panels%20%3D%20%5B(%22named_holdout%22%2C%20%22held-out%20pairs%22)%2C%20(%22open%22%2C%20%22open%20pairs%22)%5D%0A%0A%20%20%20%20%40themed(%0A%20%20%20%20%20%20%20%20name%3D%22distance-ecdf%22%2C%0A%20%20%20%20%20%20%20%20alt_text%3D%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Two%20panels%20of%20cumulative%20distributions%20of%20the%20RGB%20distance%20from%20the%20model's%0A%20%20%20%20%20%20%20%20%20%20%20%20chosen%20name%20to%20the%20true%20mix%2C%20pooled%20over%20three%20seeds%2C%20one%20panel%20for%20held-out%0A%20%20%20%20%20%20%20%20%20%20%20%20pairs%20and%20one%20for%20open%20pairs.%20One%20line%20per%20grid%20(v27%2C%20v216).%20Dashed%20lines%0A%20%20%20%20%20%20%20%20%20%20%20%20show%20the%20nearest-name%20floor%20on%20open%20pairs.%20Under%20each%20axis%20a%20triangle%20marks%0A%20%20%20%20%20%20%20%20%20%20%20%20the%20prompt-blind%20constant%20baseline.%0A%20%20%20%20%20%20%20%20%22%22%22%2C%0A%20%20%20%20%20%20%20%20caption%3D%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Distance%20from%20the%20model's%20choice%20to%20the%20true%20mix%2C%20in%20unit-cube%20units%2C%20pooled%0A%20%20%20%20%20%20%20%20%20%20%20%20over%20seeds%3B%20a%20curve%20that%20climbs%20sooner%20(further%20left)%20is%20better.%20On%20held-out%0A%20%20%20%20%20%20%20%20%20%20%20%20pairs%20the%20height%20at%20distance%200%20is%20the%20candidate%20exact-match%20accuracy.%20On%20open%0A%20%20%20%20%20%20%20%20%20%20%20%20pairs%20no%20name%20is%20exactly%20right%2C%20so%20the%20dashed%20line%20marks%20the%20best%20reachable%0A%20%20%20%20%20%20%20%20%20%20%20%20distance%20(the%20nearest%20name).%20The%20triangles%20on%20the%20x-axis%20are%20the%20prompt-blind%0A%20%20%20%20%20%20%20%20%20%20%20%20constant%20(always%20answering%20the%20centre%20of%20the%20training%20answers).%0A%20%20%20%20%20%20%20%20%22%22%22%2C%0A%20%20%20%20)%0A%20%20%20%20def%20_plot()%20-%3E%20plt.Figure%3A%0A%20%20%20%20%20%20%20%20fig%2C%20axes%20%3D%20plt.subplots(1%2C%20len(_panels)%2C%20figsize%3D(8.4%2C%203.4)%2C%20sharey%3DTrue)%0A%20%20%20%20%20%20%20%20shades%20%3D%20grid_shades()%0A%20%20%20%20%20%20%20%20for%20ax%2C%20(es%2C%20title)%20in%20zip(axes%2C%20_panels%2C%20strict%3DTrue)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20for%20g%20in%20GRID_NAMES%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20exs%20%3D%20evals%5Bg%5D%5Bes%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20d%20%3D%20dists_for(g%2C%20exs)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20gd%20%3D%20np.concatenate(%5Bd%5Bnp.arange(len(exs))%2C%20arrays%5Bf%22%7Bg%7D-s%7Bs%7D%2Flogp%2F%7Bes%7D%22%5D.argmax(1)%5D%20for%20s%20in%20SEEDS%5D)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20xs%20%3D%20np.sort(gd)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ax.plot(xs%2C%20np.arange(1%2C%20len(xs)%20%2B%201)%20%2F%20len(xs)%2C%20color%3Dshades%5Bg%5D%2C%20lw%3D1.6%2C%20label%3Dg)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if%20es%20%3D%3D%20%22open%22%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20xf%20%3D%20np.sort(d.min(axis%3D1))%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ax.plot(xf%2C%20np.arange(1%2C%20len(xf)%20%2B%201)%20%2F%20len(xf)%2C%20color%3Dshades%5Bg%5D%2C%20lw%3D1.0%2C%20ls%3D%22--%22%2C%20alpha%3D0.7)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ax.plot(%5Bd%5B%3A%2C%20blind_index(g%2C%20evals)%5D.mean()%5D%2C%20%5B-0.02%5D%2C%20marker%3D%22%5E%22%2C%20ms%3D4%2C%20color%3Dshades%5Bg%5D%2C%20clip_on%3DFalse)%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.set(title%3Dtitle%2C%20xlabel%3D%22distance%20to%20true%20mix%22%2C%20xlim%3D(-0.02%2C%201.0)%2C%20ylim%3D(-0.03%2C%201.03))%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.grid(alpha%3D0.3)%0A%20%20%20%20%20%20%20%20axes%5B0%5D.set_ylabel(%22fraction%20of%20prompts%20%E2%89%A4%20x%22)%0A%20%20%20%20%20%20%20%20axes%5B0%5D.legend(loc%3D%22lower%20right%22%2C%20fontsize%3D8)%0A%20%20%20%20%20%20%20%20return%20fig%0A%0A%20%20%20%20mo.Html(_plot())%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(arrays%2C%20evals%2C%20metrics)%3A%0A%20%20%20%20def%20_mean(g%2C%20es%2C%20key)%3A%0A%20%20%20%20%20%20%20%20return%20float(np.mean(%5Bcell_of(metrics%2C%20g%2C%20s)%5B%22sets%22%5D%5Bes%5D%5Bkey%5D%20for%20s%20in%20SEEDS%5D))%0A%0A%20%20%20%20def%20_blind(g%2C%20es)%3A%0A%20%20%20%20%20%20%20%20return%20float(dists_for(g%2C%20evals%5Bg%5D%5Bes%5D)%5B%3A%2C%20blind_index(g%2C%20evals)%5D.mean())%0A%0A%20%20%20%20_shape%20%3D%20miss_shape(%22v27%22%2C%20arrays%2C%20evals)%0A%0A%20%20%20%20mo.md(rf%22%22%22%0A%20%20%20%20The%20graded%20view%20recovers%20most%20of%20what%20exact%20match%20missed%2C%20as%20H3%20predicted.%0A%0A%20%20%20%20%60v216%60%20tracks%20its%20floor%3A%20held-out%20guesses%20land%20a%20mean%0A%20%20%20%20%7B_mean(%22v216%22%2C%20%22named_holdout%22%2C%20%22guess_dist%22)%3A.3f%7D%20from%20the%20true%20mix%2C%20and%0A%20%20%20%20open-pair%20guesses%20%7B_mean(%22v216%22%2C%20%22open%22%2C%20%22guess_dist%22)%3A.2f%7D%20against%20a%20floor%20of%0A%20%20%20%20%7B_mean(%22v216%22%2C%20%22open%22%2C%20%22floor_dist%22)%3A.2f%7D%2C%20a%20prompt-blind%20constant%20of%0A%20%20%20%20%7B_blind(%22v216%22%2C%20%22open%22)%3A.2f%7D%20and%20chance%20of%0A%20%20%20%20%7B_mean(%22v216%22%2C%20%22open%22%2C%20%22chance_dist%22)%3A.2f%7D%2C%20landing%20on%20the%20single%20nearest%20name%0A%20%20%20%20%7B_mean(%22v216%22%2C%20%22open%22%2C%20%22nearest_acc%22)%3A.0%25%7D%20of%20the%20time.%0A%0A%20%20%20%20%60v27%60%20lands%20on%20the%20single%20nearest%20name%20%7B_mean(%22v27%22%2C%20%22open%22%2C%20%22nearest_acc%22)%3A.0%25%7D%20of%20the%20time%20against%0A%20%20%20%20the%20constant's%20%7Bblind_nearest(%22v27%22%2C%20%22open%22%2C%20evals)%3A.0%25%7D%2C%20and%0A%20%20%20%20%7B_shape%5B%22shell%22%5D%7D%20of%20the%20%7B_shape%5B%22n%22%5D%7D%20held-out%20guesses%20sit%20one%20grid%20step%0A%20%20%20%20from%20the%20true%20mix%20(0.53)%2C%20the%20rest%20at%20two%20steps.%20So%20the%20geometry%20did%20come%0A%20%20%20%20through%20the%20tokenizer%20change%20on%20both%20grids%2C%20and%20what%20%60v27%60%20lost%20is%20the%20last%0A%20%20%20%20step%2C%20picking%20the%20exactly%20right%20name%20%E2%80%94%20but%20this%20grid%20seems%20to%20be%20too%20coarse.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Is%20the%20whole%20distribution%20shaped%20like%20the%20geometry%3F%0A%0A%20%20%20%20Exact%20match%20and%20the%20distance%20metrics%20read%20the%20top%20of%20the%20model's%20answer%0A%20%20%20%20distribution.%20To%20check%20the%20rest%20of%20the%20mass%2C%20we%20build%20a%20target%20distribution%0A%20%20%20%20per%20prompt%20for%20each%20temperature%20%CF%84%3A%20a%20softmax%20of%20negative%20RGB%20distance%20from%0A%20%20%20%20every%20vocabulary%20name%20to%20the%20true%20mix.%20Then%20we%20measure%20the%20KL%20divergence%0A%20%20%20%20from%20target%20to%20model%2C%20%60KL(q_%CF%84%20%E2%80%96%20p)%60%2C%20as%20%CF%84%20varies.%20As%20%CF%84%20%E2%86%92%200%20the%20target%0A%20%20%20%20collapses%20to%20one-hot%20on%20the%20nearest%20name%3B%20large%20%CF%84%20tends%20toward%20uniform.%20A%0A%20%20%20%20model%20whose%20uncertainty%20is%20spread%20over%20colors%20near%20the%20true%20mix%20will%20fit%0A%20%20%20%20some%20middle%20%CF%84%20far%20better%20than%20a%20value-blind%20model%20could%2C%20and%20the%20best-fit%20%CF%84%0A%20%20%20%20estimates%20the%20scale%20of%20its%20geometric%20uncertainty.%20The%20dashed%0A%20%20%20%20%60KL(q_%CF%84%20%E2%80%96%20uniform)%60%20line%20is%20what%20a%20model%20giving%20every%20name%20equal%20probability%0A%20%20%20%20would%20score.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(arrays%2C%20evals)%3A%0A%20%20%20%20_taus%20%3D%20np.geomspace(0.02%2C%201.2%2C%2040)%0A%0A%20%20%20%20def%20_kl_curves(g%3A%20str%2C%20es%3A%20str)%20-%3E%20tuple%5Bnp.ndarray%2C%20np.ndarray%5D%3A%0A%20%20%20%20%20%20%20%20%22%22%22Mean-over-prompts%20KL(q_tau%20%7C%7C%20model)%20and%20KL(q_tau%20%7C%7C%20uniform)%2C%20per%20tau.%22%22%22%0A%20%20%20%20%20%20%20%20exs%20%3D%20evals%5Bg%5D%5Bes%5D%0A%20%20%20%20%20%20%20%20d%20%3D%20dists_for(g%2C%20exs)%20%20%23%20(N%2C%20V)%0A%20%20%20%20%20%20%20%20lp%20%3D%20np.stack(%5Barrays%5Bf%22%7Bg%7D-s%7Bs%7D%2Flogp%2F%7Bes%7D%22%5D%20for%20s%20in%20SEEDS%5D)%20%20%23%20(S%2C%20N%2C%20V)%0A%20%20%20%20%20%20%20%20log_pn%20%3D%20np.log(np.stack(%5Brenorm(m)%20for%20m%20in%20lp%5D)%20%2B%201e-30)%0A%20%20%20%20%20%20%20%20kl_m%2C%20kl_u%20%3D%20%5B%5D%2C%20%5B%5D%0A%20%20%20%20%20%20%20%20for%20t%20in%20_taus%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20lq%20%3D%20-d%20%2F%20t%0A%20%20%20%20%20%20%20%20%20%20%20%20lq%20%3D%20lq%20-%20lq.max(axis%3D1%2C%20keepdims%3DTrue)%0A%20%20%20%20%20%20%20%20%20%20%20%20q%20%3D%20np.exp(lq)%0A%20%20%20%20%20%20%20%20%20%20%20%20q%20%2F%3D%20q.sum(axis%3D1%2C%20keepdims%3DTrue)%0A%20%20%20%20%20%20%20%20%20%20%20%20h_q%20%3D%20-(q%20*%20np.log(q%20%2B%201e-30)).sum(axis%3D1)%20%20%23%20(N%2C)%0A%20%20%20%20%20%20%20%20%20%20%20%20ce%20%3D%20-(q%5BNone%5D%20*%20log_pn).sum(axis%3D2)%20%20%23%20(S%2C%20N)%0A%20%20%20%20%20%20%20%20%20%20%20%20kl_m.append(float((ce%20-%20h_q%5BNone%5D).mean()))%0A%20%20%20%20%20%20%20%20%20%20%20%20kl_u.append(float((np.log(d.shape%5B1%5D)%20-%20h_q).mean()))%0A%20%20%20%20%20%20%20%20return%20np.array(kl_m)%2C%20np.array(kl_u)%0A%0A%20%20%20%20_panels%20%3D%20%5B(%22named_holdout%22%2C%20%22held-out%20pairs%22)%2C%20(%22open%22%2C%20%22open%20pairs%22)%5D%0A%0A%20%20%20%20%40themed(%0A%20%20%20%20%20%20%20%20name%3D%22distance-kl%22%2C%0A%20%20%20%20%20%20%20%20alt_text%3D%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Two%20panels%20(held-out%20pairs%2C%20open%20pairs)%20of%20KL%20divergence%20from%20a%0A%20%20%20%20%20%20%20%20%20%20%20%20distance-shaped%20target%20distribution%20to%20the%20model's%20answer%20distribution%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20against%20the%20target%20temperature%20tau%20on%20a%20log%20axis.%20One%20solid%20line%20per%20grid%0A%20%20%20%20%20%20%20%20%20%20%20%20(v27%2C%20v216)%3B%20dashed%20lines%20show%20the%20same%20divergence%20to%20a%20uniform%0A%20%20%20%20%20%20%20%20%20%20%20%20distribution%2C%20the%20value-blind%20reference.%0A%20%20%20%20%20%20%20%20%22%22%22%2C%0A%20%20%20%20%20%20%20%20caption%3D%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20How%20well%20does%20the%20model's%20answer%20distribution%20match%20distance-shaped%0A%20%20%20%20%20%20%20%20%20%20%20%20targets%3F%20Solid%20lines%3A%20mean%20KL(q_%CF%84%20%E2%80%96%20model)%2C%20pooled%20over%20seeds%20and%20prompts%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20where%20q_%CF%84%20is%20a%20softmax%20of%20%E2%88%92distance%2F%CF%84%20around%20the%20true%20mix.%20Dashed%20lines%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20KL(q_%CF%84%20%E2%80%96%20uniform)%2C%20the%20score%20a%20value-blind%20guesser%20gets.%20A%20dip%20well%20below%0A%20%20%20%20%20%20%20%20%20%20%20%20the%20dashed%20line%20at%20moderate%20%CF%84%20means%20the%20model's%20probability%20mass%20gathers%0A%20%20%20%20%20%20%20%20%20%20%20%20near%20the%20true%20mix%2C%20spread%20over%20its%20neighbors%20rather%20than%20resting%20on%20one%0A%20%20%20%20%20%20%20%20%20%20%20%20best%20guess.%0A%20%20%20%20%20%20%20%20%22%22%22%2C%0A%20%20%20%20)%0A%20%20%20%20def%20_plot()%20-%3E%20plt.Figure%3A%0A%20%20%20%20%20%20%20%20fig%2C%20axes%20%3D%20plt.subplots(1%2C%20len(_panels)%2C%20figsize%3D(8.4%2C%203.4)%2C%20sharey%3DTrue)%0A%20%20%20%20%20%20%20%20shades%20%3D%20grid_shades()%0A%20%20%20%20%20%20%20%20for%20ax%2C%20(es%2C%20title)%20in%20zip(axes%2C%20_panels%2C%20strict%3DTrue)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20for%20g%20in%20GRID_NAMES%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20kl_m%2C%20kl_u%20%3D%20_kl_curves(g%2C%20es)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ax.plot(_taus%2C%20kl_m%2C%20color%3Dshades%5Bg%5D%2C%20lw%3D1.6%2C%20label%3Dg)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ax.plot(_taus%2C%20kl_u%2C%20color%3Dshades%5Bg%5D%2C%20lw%3D1.0%2C%20ls%3D%22--%22%2C%20alpha%3D0.7)%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.set(title%3Dtitle%2C%20xlabel%3D%22target%20temperature%20%CF%84%22%2C%20xscale%3D%22log%22)%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.grid(alpha%3D0.3)%0A%20%20%20%20%20%20%20%20axes%5B0%5D.set_ylabel(%22KL(target%20%E2%80%96%20%C2%B7)%20%20(nats)%22)%0A%20%20%20%20%20%20%20%20axes%5B0%5D.legend(loc%3D%22upper%20right%22%2C%20fontsize%3D8)%0A%20%20%20%20%20%20%20%20return%20fig%0A%0A%20%20%20%20mo.Html(_plot())%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20On%20%60v216%60%20the%20model%20fits%20even%20the%20sharpest%20targets%20well%3A%20KL%20%E2%89%88%200.3%20nats%20at%20%CF%84%0A%20%20%20%20%E2%89%88%200.03%20on%20held-out%20pairs%2C%20an%20order%20of%20magnitude%20under%20the%20uniform%20line%2C%20with%0A%20%20%20%20the%20best-fit%20%CF%84%20near%20the%20grid%20spacing%20of%200.2%2C%20as%20H5%20hoped.%0A%0A%20%20%20%20%60v27%60%20fits%20worse%20than%20uniform%20at%20every%20temperature%2C%20even%20though%20the%20distance%0A%20%20%20%20curves%20above%20showed%20its%20guesses%20are%20close.%20%60KL(q_%CF%84%20%E2%80%96%20p)%60%20is%20very%20sensitive%0A%20%20%20%20to%20confident%20error%2C%20and%20this%20model's%20answer%20entropy%20is%20under%200.2%20nats%2C%20so%0A%20%20%20%20whenever%20its%20chosen%20name%20is%20not%20the%20target's%20favorite%2C%20the%20divergence%20shoots%0A%20%20%20%20up.%20The%20metric%20shows%20whether%20the%20mass%20sits%20in%20geometrically%20sensible%20places%0A%20%20%20%20and%20whether%20the%20confidence%20is%20appropriate.%20So%20H5%20is%20confirmed%20on%20%60v216%60%2C%20but%0A%20%20%20%20not%20on%20%60v27%60.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Probes%3A%20Is%20the%20mix%20computed%20in%20value%20space%2C%20and%20when%3F%0A%0A%20%20%20%20Per-depth%20probes%20ask%20whether%20the%20residual%20stream%20at%20the%20pre-answer%0A%20%20%20%20position%20(the%20space%20after%20%60%3D%60)%20already%20holds%20the%20mixed%20color%20before%20any%20of%0A%20%20%20%20the%20answer%20is%20in%20the%20context%3B%20we%20fit%20them%20on%20in-training%20lines%20and%20transfer%0A%20%20%20%20them%20to%20held-out%20and%20open%20prompts.%0A%0A%20%20%20%20Schedule%20probes%20teacher-forces%20whole%0A%20%20%20%20equations%20and%20reads%20the%20three%20channels%20at%20every%20position%20around%20the%20answer%2C%0A%20%20%20%20at%20every%20depth.%20On%20hex%20answers%20(ex-2.1.2)%20this%20picture%20was%20a%20staircase%20with%0A%20%20%20%20eviction%3B%20H4%20predicts%20a%20plateau%20here.%0A%0A%20%20%20%20%23%23%23%20Per-depth%20probes%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(metrics)%3A%0A%20%20%20%20%40themed(%0A%20%20%20%20%20%20%20%20name%3D%22residual-probes%22%2C%0A%20%20%20%20%20%20%20%20alt_text%3D%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Two%20line%20panels%2C%20one%20per%20grid%20(v27%2C%20v216)%2C%20of%20ridge-probe%20R-squared%20for%20the%0A%20%20%20%20%20%20%20%20%20%20%20%20mix's%20RGB%20read%20from%20the%20pre-answer%20residual%20stream%2C%20against%20depth%200%20to%204.%0A%20%20%20%20%20%20%20%20%20%20%20%20Lines%20show%20the%20probe's%20fit%20set%20(in-training%20lines)%20and%20its%20transfer%20to%20seen%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20held-out%2C%20and%20open%20prompts.%0A%20%20%20%20%20%20%20%20%22%22%22%2C%0A%20%20%20%20%20%20%20%20caption%3D%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Ridge%20probes%20from%20the%20pre-answer%20residual%20stream%20to%20the%20true%20mix's%20RGB%2C%20per%0A%20%20%20%20%20%20%20%20%20%20%20%20depth%20(0%20is%20embeddings%2C%204%20is%20the%20final%20block)%2C%20fit%20on%20half%20the%20in-training%0A%20%20%20%20%20%20%20%20%20%20%20%20probe%20lines%20(seed%200)%20and%20transferred%20to%20the%20eval%20sets.%0A%20%20%20%20%20%20%20%20%22%22%22%2C%0A%20%20%20%20)%0A%20%20%20%20def%20_plot()%20-%3E%20plt.Figure%3A%0A%20%20%20%20%20%20%20%20fig%2C%20axes%20%3D%20plt.subplots(1%2C%20len(GRID_NAMES)%2C%20figsize%3D(8.4%2C%203.2)%2C%20sharey%3DTrue)%0A%20%20%20%20%20%20%20%20styles%20%3D%20%7B%22fit%22%3A%20%22-%22%2C%20%22named_seen%22%3A%20%22-.%22%2C%20%22named_holdout%22%3A%20%22--%22%2C%20%22open%22%3A%20%22%3A%22%7D%0A%20%20%20%20%20%20%20%20shades%20%3D%20grid_shades()%0A%20%20%20%20%20%20%20%20for%20ax%2C%20g%20in%20zip(axes%2C%20GRID_NAMES%2C%20strict%3DTrue)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20transfer%20%3D%20cell_of(metrics%2C%20g%2C%200)%5B%22transfer_r2%22%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20for%20es%2C%20r2s%20in%20transfer.items()%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ax.plot(r2s%2C%20styles.get(es%2C%20%22-%22)%2C%20color%3Dshades%5Bg%5D%2C%20label%3Des.replace(%22_%22%2C%20%22%20%22))%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.set(title%3Dg%2C%20xlabel%3D%22depth%22%2C%20ylim%3D(-0.1%2C%201.03))%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.set_xticks(range(len(next(iter(transfer.values())))))%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.grid(alpha%3D0.3)%0A%20%20%20%20%20%20%20%20axes%5B0%5D.set_ylabel(%22probe%20R%C2%B2%20(mix%20RGB)%22)%0A%20%20%20%20%20%20%20%20axes%5B0%5D.legend(fontsize%3D7%2C%20loc%3D%22upper%20left%22)%0A%20%20%20%20%20%20%20%20return%20fig%0A%0A%20%20%20%20mo.Html(_plot())%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(metrics)%3A%0A%20%20%20%20_op%20%3D%20cell_of(metrics%2C%20%22v216%22%2C%200)%5B%22probe_r2%22%5D%5B%22operand_rgb%22%5D%0A%20%20%20%20_res%20%3D%20cell_of(metrics%2C%20%22v216%22%2C%200)%5B%22transfer_r2%22%5D%0A%20%20%20%20mo.md(rf%22%22%22%0A%20%20%20%20The%20mix%20is%20computed%20in%20value%20space%20at%20the%20pre-answer%20position%20on%20both%0A%20%20%20%20grids%2C%20but%20it%20shows%20up%20later.%20At%20word%20level%20it%20was%0A%20%20%20%20decodable%20from%20depth%201%E2%80%932%20on.%20Here%20at%20%60v216%60%20it%20is%20essentially%20absent%20until%0A%20%20%20%20the%20final%20block%3A%20R%C2%B2%20%7B_res%5B%22fit%22%5D%5B2%5D%3A.2f%7D%20at%20depth%202%2C%20%7B_res%5B%22fit%22%5D%5B3%5D%3A.2f%7D%0A%20%20%20%20at%20depth%203%2C%20then%20%7B_res%5B%22fit%22%5D%5B4%5D%3A.2f%7D%20at%20depth%204.%20The%20earlier%20layers%20are%0A%20%20%20%20reading%3A%20the%20operand%20probe%20climbs%0A%20%20%20%20%7B%22%20%E2%86%92%20%22.join(f%22%7Bv%3A.2f%7D%22%20for%20v%20in%20_op)%7D%20across%20depths%2C%20so%20turning%20a%0A%20%20%20%20four-letter%20name%20back%20into%20a%20value%20is%20itself%20a%20multi-layer%20computation.%20The%0A%20%20%20%20final-block%20mix%20transfers%20with%20almost%20no%20loss%20to%20held-out%20and%20open%20prompts%0A%20%20%20%20(%7B_res%5B%22named_holdout%22%5D%5B4%5D%3A.2f%7D%20and%20%7B_res%5B%22open%22%5D%5B4%5D%3A.2f%7D)%2C%20so%20it%20is%20a%0A%20%20%20%20real%20value-space%20computation.%0A%0A%20%20%20%20%60v27%60%20matches%20its%20behavioral%20collapse.%20Mid-stack%2C%20a%20probe%20fit%20on%20training%0A%20%20%20%20lines%20transfers%20respectably%20to%20held-out%20prompts%20(R%C2%B2%20%E2%89%88%200.6%E2%80%930.8%20at%20depths%201%E2%80%932%2C%0A%20%20%20%20depending%20on%20seed)%3B%20by%20the%20final%20layer%2C%20transfer%20falls%20to%0A%20%20%20%20%7Bcell_of(metrics%2C%20%22v27%22%2C%200)%5B%22transfer_r2%22%5D%5B%22named_holdout%22%5D%5B4%5D%3A.2f%7D%0A%20%20%20%20(depth%204%2C%20seed%200)%20while%20the%20fit%20set%20stays%20at%0A%20%20%20%20%7Bcell_of(metrics%2C%20%22v27%22%2C%200)%5B%22transfer_r2%22%5D%5B%22fit%22%5D%5B4%5D%3A.2f%7D.%0A%20%20%20%20The%20value%20seems%20to%20be%20computed%2C%20but%20the%20last%20block%20overwrites%20it%20with%20the%0A%20%20%20%20wrong%20answer%20the%20readout%20has%20settled%20on.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%23%20Schedule%20probes%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(arrays%2C%20metrics)%3A%0A%20%20%20%20_hex%20%3D%20load_sibling(HEX_MARGINS_REF%2C%20kind%3D%22npz%22)%0A%0A%20%20%20%20%40themed(%0A%20%20%20%20%20%20%20%20name%3D%22answer-schedule%22%2C%0A%20%20%20%20%20%20%20%20alt_text%3D%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Line%20panels%20of%20probe%20R-squared%20against%20position%20around%20the%20answer%20(offsets%20%E2%88%924%0A%20%20%20%20%20%20%20%20%20%20%20%20to%203)%2C%20read%20from%20the%20final%20residual%20layer%2C%20with%20one%20line%20per%20RGB%20channel%20drawn%0A%20%20%20%20%20%20%20%20%20%20%20%20in%20its%20own%20color.%20Left%20panels%20show%20this%20experiment's%20opaque%20names%20(v27%2C%20v216)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20where%20the%20three%20channel%20lines%20run%20together%20at%20every%20offset.%20The%20right%20panel%2C%20if%0A%20%20%20%20%20%20%20%20%20%20%20%20available%2C%20shows%20ex-2.1.2's%20hex%20answers%2C%20where%20the%20three%20separate%20into%20a%0A%20%20%20%20%20%20%20%20%20%20%20%20staircase%2C%20each%20channel%20high%20only%20around%20its%20own%20emission%20position.%0A%20%20%20%20%20%20%20%20%22%22%22%2C%0A%20%20%20%20%20%20%20%20caption%3D%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20The%20answer-emission%20schedule%20at%20the%20final%20residual%20depth%20(seed%200).%20Each%20line%20is%0A%20%20%20%20%20%20%20%20%20%20%20%20R%C2%B2%20for%20one%20RGB%20channel%20across%20offsets%20from%20the%20answer's%20first%20character%3B%20the%0A%20%20%20%20%20%20%20%20%20%20%20%20answer%20sits%20at%20offsets%200%E2%80%933%2C%20and%20the%20prompt's%20last%20characters%20are%20the%20negative%0A%20%20%20%20%20%20%20%20%20%20%20%20offsets.%20Lines%20are%20drawn%20as%20steps%20because%20each%20offset%20is%20a%20separate%20character%0A%20%20%20%20%20%20%20%20%20%20%20%20position%2C%20with%20the%20value%20held%20across%20the%20position%20and%20ramping%20between%3B%20line%0A%20%20%20%20%20%20%20%20%20%20%20%20width%20tapers%20R%20%E2%86%92%20G%20%E2%86%92%20B%20so%20an%20offset%20where%20all%20three%20agree%20reads%20as%20nested%20bands%0A%20%20%20%20%20%20%20%20%20%20%20%20rather%20than%20as%20whichever%20channel%20drew%20last.%20Hex%20answers%20(right%2C%20from%20ex-2.1.2's%0A%20%20%20%20%20%20%20%20%20%20%20%20base-grammar%20cells)%20spell%20one%20channel%20per%20digit%2C%20and%20the%20probe%20found%20each%0A%20%20%20%20%20%20%20%20%20%20%20%20channel%20computed%20just%20in%20time%20and%20dropped%20once%20emitted.%20Opaque%20names%20cannot%20be%0A%20%20%20%20%20%20%20%20%20%20%20%20written%20that%20way%2C%20and%20H4%20predicts%20all%20three%20channels%20stay%20decodable%20across%20the%0A%20%20%20%20%20%20%20%20%20%20%20%20window.%0A%20%20%20%20%20%20%20%20%22%22%22%2C%0A%20%20%20%20)%0A%20%20%20%20def%20_plot()%20-%3E%20plt.Figure%3A%0A%20%20%20%20%20%20%20%20%23%20(title%2C%20r2%2C%20offsets%2C%20is_reference)%20%E2%80%94%20reference%20panels%20come%20from%20another%0A%20%20%20%20%20%20%20%20%23%20experiment%2C%20and%20are%20set%20apart%20from%20this%20one's%20panels%20below.%0A%20%20%20%20%20%20%20%20panels%3A%20list%5Btuple%5Bstr%2C%20np.ndarray%2C%20list%5Bint%5D%2C%20bool%5D%5D%20%3D%20%5B%5D%0A%20%20%20%20%20%20%20%20for%20g%20in%20GRID_NAMES%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20r2%20%3D%20arrays%5Bf%22%7Bg%7D-s0%2Fschedule%2Fr2%22%5D%20%20%23%20(offsets%2C%20depth%2B1%2C%203)%0A%20%20%20%20%20%20%20%20%20%20%20%20panels.append((f%22%7Bg%7D%20(names)%22%2C%20r2%5B%3A%2C%20-1%5D%2C%20cell_of(metrics%2C%20g%2C%200)%5B%22schedule_offsets%22%5D%2C%20False))%0A%20%20%20%20%20%20%20%20if%20_hex%20is%20not%20None%20and%20%22control-s0%2Fschedule%2Fr2%22%20in%20_hex%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20panels.append((%22hex%20(ex-2.1.2)%22%2C%20_hex%5B%22control-s0%2Fschedule%2Fr2%22%5D%5B%3A%2C%20-1%5D%2C%20list(range(-4%2C%204))%2C%20True))%0A%0A%20%20%20%20%20%20%20%20%23%20Color%20is%20data%3A%20each%20channel's%20line%20is%20drawn%20in%20that%20channel's%20own%20hue.%0A%20%20%20%20%20%20%20%20cols%20%3D%20light_dark(%5B%22%23d1495b%22%2C%20%22%232a9d5c%22%2C%20%22%233b6fd4%22%5D%2C%20%5B%22%23ff6b7d%22%2C%20%22%234fd07a%22%2C%20%22%236ea3ff%22%5D)%0A%20%20%20%20%20%20%20%20%23%20The%20finding%20at%20v27%2Fv216%20is%20that%20all%20three%20channels%20agree%2C%20so%20the%20lines%20coincide%0A%20%20%20%20%20%20%20%20%23%20almost%20exactly.%20Tapering%20the%20widths%20keeps%20every%20channel%20visible%20where%20they%20do.%0A%20%20%20%20%20%20%20%20lws%20%3D%20(2.6%2C%201.7%2C%201.0)%0A%0A%20%20%20%20%20%20%20%20%23%20A%20spacer%20column%20ahead%20of%20each%20reference%20panel%3A%20the%20extra%20gap%2C%20plus%20the%20rule%0A%20%20%20%20%20%20%20%20%23%20drawn%20in%20it%2C%20say%20%22this%20one%20is%20from%20elsewhere%22%20without%20a%20caption%20having%20to.%0A%20%20%20%20%20%20%20%20gap%20%3D%200.1%0A%20%20%20%20%20%20%20%20widths%20%3D%20%5Bw%20for%20i%2C%20(*_%2C%20ref)%20in%20enumerate(panels)%20for%20w%20in%20((gap%2C%201.0)%20if%20ref%20and%20i%20else%20(1.0%2C))%5D%0A%20%20%20%20%20%20%20%20fig%20%3D%20plt.figure(figsize%3D(3.2%20*%20sum(widths)%2C%202.8))%0A%20%20%20%20%20%20%20%20gs%20%3D%20fig.add_gridspec(1%2C%20len(widths)%2C%20width_ratios%3Dwidths%2C%20wspace%3D0.1)%0A%0A%20%20%20%20%20%20%20%20axes%2C%20col%20%3D%20%5B%5D%2C%200%0A%20%20%20%20%20%20%20%20for%20title%2C%20m%2C%20offsets%2C%20ref%20in%20panels%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20ref%20and%20col%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20rule%20%3D%20fig.add_subplot(gs%5B0%2C%20col%5D)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20rule.set_axis_off()%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20rule.axvline(0.5%2C%20color%3D%22grey%22%2C%20alpha%3D0.35%2C%20lw%3D0.8)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20col%20%2B%3D%201%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20Shared%20y%20scale%20throughout%2C%20but%20the%20reference%20panel%20is%20far%20enough%20from%20the%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20left%20edge%20that%20it%20earns%20its%20own%20tick%20labels.%0A%20%20%20%20%20%20%20%20%20%20%20%20ax%20%3D%20fig.add_subplot(gs%5B0%2C%20col%5D%2C%20sharey%3Daxes%5B0%5D%20if%20axes%20else%20None)%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20ax.tick_params(labelleft%3Dcol%20%3D%3D%200%20or%20ref)%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.tick_params(labelleft%3Dcol%20%3D%3D%200)%0A%20%20%20%20%20%20%20%20%20%20%20%20col%20%2B%3D%201%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.axvline(0%2C%20color%3D%22grey%22%2C%20alpha%3D0.5%2C%20linestyle%3D%22--%22)%0A%20%20%20%20%20%20%20%20%20%20%20%20for%20c%20in%20range(3)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20smooth_step(ax%2C%20offsets%2C%20np.clip(m%5B%3A%2C%20c%5D%2C%200%2C%201)%2C%20color%3Dcols%5Bc%5D%2C%20lw%3Dlws%5Bc%5D%2C%20ramp%3D0.5)%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.set(xlabel%3D%22offset%20from%20answer%20start%22%2C%20ylim%3D(-0.05%2C%201.05))%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.set_title(title%2C%20**(%7B%22style%22%3A%20%22italic%22%2C%20%22color%22%3A%20%22grey%22%7D%20if%20ref%20else%20%7B%7D))%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.set_xlim(offsets%5B0%5D%20-%200.5%2C%20offsets%5B-1%5D%20%2B%200.5)%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.set_xticks(offsets)%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.grid(alpha%3D0.1)%0A%20%20%20%20%20%20%20%20%20%20%20%20axes.append(ax)%0A%20%20%20%20%20%20%20%20axes%5B0%5D.set_ylabel(%22probe%20R%C2%B2%20(mix%20RGB)%22)%0A%20%20%20%20%20%20%20%20axes%5B0%5D.legend(%0A%20%20%20%20%20%20%20%20%20%20%20%20handles%3D%5Bplt.Line2D(%5B%5D%2C%20%5B%5D%2C%20color%3Dcols%5Bc%5D%2C%20lw%3Dlws%5Bc%5D%2C%20label%3Dn)%20for%20c%2C%20n%20in%20enumerate(%22RGB%22)%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20fontsize%3D7%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20loc%3D%22lower%20left%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20ncols%3D3%2C%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20return%20fig%0A%0A%20%20%20%20mo.Html(_plot())%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20H4%20mainly%20holds%3A%20there%20is%20no%20per-channel%20staircase.%20In%20the%20name%20panels%20the%20three%20lines%0A%20%20%20%20run%20together%20at%20every%20offset%3A%20whatever%20the%20stream%20knows%20about%20the%20mix%2C%20it%0A%20%20%20%20knows%20for%20all%20three%20channels%20at%20once.%0A%0A%20%20%20%20The%20%22stays%20fully%20live%22%20half%20needs%20a%20small%20amendment.%20At%20%60v216%60%20the%0A%20%20%20%20final-depth%20R%C2%B2%20is%20high%20at%20the%20pre-answer%20position%20and%20the%20first%20answer%0A%20%20%20%20character%20(%E2%89%88%200.95)%2C%20dips%20to%20%E2%89%88%200.55%E2%80%930.6%20through%20the%20middle%20of%20the%20name%2C%20and%0A%20%20%20%20climbs%20back%20to%20%E2%89%88%200.96%20at%20the%20last%20character.%20Perhaps%20the%20mid-name%20positions%0A%20%20%20%20look%20backward%20to%20finish%20a%20spelling%20that%20is%20already%20decided%2C%20carrying%20only%20a%0A%20%20%20%20thinned%20copy%20of%20the%20value.%20So%20no%20per-channel%20eviction%2C%20though%20the%20whole%0A%20%20%20%20value%20fades%20somewhat%20during%20emission%3B%20%22the%20result%22%20is%20sharpest%20at%20the%0A%20%20%20%20pre-answer%20position%20or%20the%20first%20answer%20character.%0A%0A%20%20%20%20%23%23%20What%20the%20misses%20look%20like%0A%0A%20%20%20%20A%20few%20completions%2C%20picked%20as%20the%20widest%20misses%2C%20so%20worst%20cases%20rather%20than%0A%20%20%20%20typical%20ones.%20Swatches%20show%20each%20opaque%20name's%20actual%20color.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(arrays%2C%20evals)%3A%0A%20%20%20%20def%20completion_rows(grid%3A%20str%2C%20es%3A%20str%2C%20k%3A%20int%20%3D%206)%20-%3E%20str%3A%0A%20%20%20%20%20%20%20%20exs%20%3D%20evals%5Bgrid%5D%5Bes%5D%0A%20%20%20%20%20%20%20%20lp%20%3D%20arrays%5Bf%22%7Bgrid%7D-s0%2Flogp%2F%7Bes%7D%22%5D%0A%20%20%20%20%20%20%20%20names%20%3D%20list(PALETTES%5Bgrid%5D)%0A%20%20%20%20%20%20%20%20d%20%3D%20dists_for(grid%2C%20exs)%0A%20%20%20%20%20%20%20%20gd%20%3D%20d%5Bnp.arange(len(exs))%2C%20lp.argmax(1)%5D%0A%20%20%20%20%20%20%20%20fl%20%3D%20d.min(axis%3D1)%0A%20%20%20%20%20%20%20%20order%20%3D%20np.argsort(-gd)%5B%3Ak%5D%0A%20%20%20%20%20%20%20%20rows%20%3D%20%5B%5D%0A%20%20%20%20%20%20%20%20for%20i%20in%20order%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20ex%20%3D%20exs%5Bi%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20a%2C%20b%20%3D%20ex.prompt.split()%5B0%5D%2C%20ex.prompt.split()%5B2%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20true%20%3D%20(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20sw(ex.answer%2C%20grid)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if%20ex.answer%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20else%20f'%3Cspan%20class%3D%22sw%22%20style%3D%22--sw%3A%20%7Bto_hex(ex.result)%7D%3B%22%20aria-hidden%3D%22true%22%3E%3C%2Fspan%3E%20%3Ccode%3E%7Bto_hex(ex.result)%7D%3C%2Fcode%3E'%0A%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20%20%20%20%20rows.append(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%22%3Ctr%3E%3Ctd%3E%7Bsw(a%2C%20grid)%7D%3C%2Ftd%3E%3Ctd%3E%7Bsw(b%2C%20grid)%7D%3C%2Ftd%3E%3Ctd%3E%7Btrue%7D%3C%2Ftd%3E%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f'%3Ctd%3E%7Bsw(names%5Bint(lp%5Bi%5D.argmax())%5D%2C%20grid)%7D%3C%2Ftd%3E%3Ctd%20class%3D%22num%22%3E%7Bgd%5Bi%5D%3A.2f%7D%3C%2Ftd%3E'%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f'%3Ctd%20class%3D%22num%22%3E%7Bfl%5Bi%5D%3A.2f%7D%3C%2Ftd%3E%3C%2Ftr%3E'%0A%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20return%20%22%22.join(rows)%0A%0A%20%20%20%20return%20(completion_rows%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(completion_rows)%3A%0A%20%20%20%20_head%20%3D%20(%0A%20%20%20%20%20%20%20%20%22%3Ctr%3E%3Cth%3Ea%3C%2Fth%3E%3Cth%3Eb%3C%2Fth%3E%3Cth%3Etrue%20mix%3C%2Fth%3E%3Cth%3Emodel's%20choice%3C%2Fth%3E%22%0A%20%20%20%20%20%20%20%20'%3Cth%20class%3D%22num%22%3Edistance%3C%2Fth%3E%3Cth%20class%3D%22num%22%3Efloor%3C%2Fth%3E%3C%2Ftr%3E'%0A%20%20%20%20)%0A%20%20%20%20_k%20%3D%205%0A%20%20%20%20_tables%20%3D%20%5B%5D%0A%20%20%20%20for%20_g%2C%20_es%20in%20%5B(%22v27%22%2C%20%22named_holdout%22)%2C%20(%22v216%22%2C%20%22named_holdout%22)%2C%20(%22v216%22%2C%20%22open%22)%5D%3A%0A%20%20%20%20%20%20%20%20_tables.append(%0A%20%20%20%20%20%20%20%20%20%20%20%20mo.Html(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20figure_html(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f'%3Cdiv%20class%3D%22report-table-scroll%22%3E%3Ctable%20class%3D%22report-table%22%3E%7B_head%7D'%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%22%7Bcompletion_rows(_g%2C%20_es%2C%20_k)%7D%3C%2Ftable%3E%3C%2Fdiv%3E%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20caption%3Df%22%60%7B_g%7D%60%20%C2%B7%20%7B_es.replace('_'%2C%20'%20')%7D%3A%20the%20%7B_k%7D%20widest%20misses%20(seed%200).%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20class_%3D%22report-figure%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20mo.vstack(_tables)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(arrays%2C%20evals)%3A%0A%20%20%20%20_m%20%3D%20miss_shape(%22v27%22%2C%20arrays%2C%20evals)%0A%20%20%20%20_n%2C%20_k%2C%20_null%20%3D%20_m%5B%22n%22%5D%2C%20_m%5B%22operand%22%5D%2C%20_m%5B%22null_operand%22%5D%0A%20%20%20%20_se%20%3D%20(_n%20*%20_null%20*%20(1%20-%20_null))%20**%200.5%0A%20%20%20%20_ev%20%3D%20v27_evidence(evals)%0A%20%20%20%20mo.md(rf%22%22%22%0A%20%20%20%20In%20%60v216%60%2C%20the%20worst%20held-out%20misses%20are%20neighbor%20colors%2C%20and%20its%20worst%20open-pair%20choices%20hover%20a%20step%20from%20the%0A%20%20%20%20floor.%0A%20%20%20%20The%20%60v27%60%20misses%20often%20return%20an%20operand%20(%7B_k%7D%20of%20%7B_n%7D%20predictions%2C%0A%20%20%20%20%7B_k%20%2F%20_n%3A.0%25%7D)%2C%20which%20looks%20like%20an%20echo%20until%20you%20count%20the%20alternatives.%0A%20%20%20%20Closure%20puts%20each%20operand%20one%20grid%20level%20from%20the%20mix%2C%20so%20a%20guesser%20that%0A%20%20%20%20picks%20uniformly%20from%20the%20mix's%20one-step%20shell%20already%20returns%20an%20operand%0A%20%20%20%20%7B_null%3A.0%25%7D%20of%20the%20time%3B%20against%20that%20reference%20the%20observed%20rate%20is%20about%0A%20%20%20%20%7B(_k%20%2F%20_n%20-%20_null)%20%2F%20(_se%20%2F%20_n)%3A.1f%7D%20standard%20errors%20away%2C%20on%20%7B_n%7D%0A%20%20%20%20predictions.%20So%20there%20is%20no%20operand%20echo%20here%2C%20only%20a%20small%20vocabulary.%0A%0A%20%20%20%20%23%23%20Discussion%0A%0A%20%20%20%20Is%20one%20token%20per%20concept%20needed%20for%20geometry%20inference%3F%20At%20%60v216%60%2C%20no.%0A%20%20%20%20The%20model%20reads%20opaque%20four-letter%20names%2C%20binds%20them%20to%20values%20across%20layers%0A%20%20%20%201%E2%80%933%2C%20computes%20the%20mix%20in%20value%20space%20in%20the%20final%20block%2C%20and%20spells%20the%0A%20%20%20%20answer%20as%20a%20whole.%20Held-out%20accuracy%20is%200.91%20against%20the%20word-level%200.99%2C%0A%20%20%20%20and%20the%20shortfall%20is%20one-grid-level%20precision%20misses.%20The%20value%20subspace%2C%20the%20fixed%20pre-answer%20home%0A%20%20%20%20for%20the%20result%2C%20and%20the%20distance-shaped%20answer%20distribution%20all%20survive%0A%20%20%20%20the%20tokenizer%20change.%0A%0A%20%20%20%20It%20turns%20out%20the%20%60v27%60%20grid%20is%20too%20coarse%20to%20answer%20the%20question.%20Its%20closed-pair%20universe%20is%20%7B_ev%5B%22seen%22%5D%20%2B%20_ev%5B%22hold%22%5D%7D%0A%20%20%20%20equations%20in%20total%2C%20split%20into%20%7B_ev%5B%22seen%22%5D%7D%20for%20training%20and%0A%20%20%20%20%7B_ev%5B%22hold%22%5D%7D%20held%20out.%20Of%20the%20training%20pairs%2C%20%7B_ev%5B%22seen%22%5D%20-%20_ev%5B%22informative%22%5D%7D%0A%20%20%20%20are%20%60a%20%2B%20a%20%3D%20a%60%2C%20leaving%20%7B_ev%5B%22informative%22%5D%7D%20equations%20that%20say%20anything%0A%20%20%20%20about%20how%20two%20names%20combine.%20There%20are%20%7B_ev%5B%22lonely%22%5D%7D%20names%20that%20never%0A%20%20%20%20appear%20in%20a%20mix%20at%20all%2C%20and%20one%20held-out%20pair%20is%20built%20entirely%20from%20them%3A%0A%20%20%20%20both%20operands%20and%20the%20true%20answer%20occur%20in%20training%20only%20as%20%60a%20%2B%20a%20%3D%20a%60.%0A%20%20%20%20No%20amount%20of%20skill%20reaches%20that%20answer%20from%20this%20corpus.%0A%0A%20%20%20%20The%20grading%20side%20is%20equally%20thin%20for%20v27.%20A%20guesser%20confined%20to%20the%20true%20mix's%0A%20%20%20%20one-step%20shell%20scores%20%7B_ev%5B%22shell_null%22%5D%3A.2f%7D%20exact%20on%20these%20ten%20pairs%2C%20and%0A%20%20%20%20always%20answering%20the%20center%20of%20the%20training%20answers%20scores%0A%20%20%20%20%7B_ev%5B%22blind_exact%22%5D%3A.2f%7D%2C%20so%20Ex-2.1.3's%20word%20level%200.27%20and%20this%20experiment's%200.00%20both%0A%20%20%20%20sit%20inside%20the%20range%20a%20model%20with%20no%20naming%20ability%20produces.%0A%0A%20%20%20%20The%20same%20caution%20applies%20to%20the%20base%20language%20in%20Ex-2.1.1.%20That%20experiment%20measured%20%60named_holdout%60%20%3D%200%2C%20but%20named%20sub-grid%20is%20this%20same%2027-color%20regime%20with%20a%20hex%20distraction%20on%20top.%0A%0A%20%20%20%20---%0A%0A%20%20%20%20Future%20experiments%20might%20use%20a%20v216-like%20vocabulary.%20If%20so%2C%20consider%3A%0A%0A%20%20%20%20-%20Reading%20names%20occupied%20layers%201%E2%80%933%20in%20this%20experiment%2C%20so%20the%20mix%20only%20exists%0A%20%20%20%20%20%20from%20the%20final%20layer%3A%20a%20d64-L4%20model%20leaves%20one%20layer%20of%20residual%20stream%0A%20%20%20%20%20%20in%20which%20the%20result%20concept%20exists%20at%20all.%20Operand%20concepts%20are%0A%20%20%20%20%20%20readable%20from%20depth%201%E2%80%932.%0A%20%20%20%20-%20Without%20hex%2C%20all%20three%20channels%20stay%20decodable%20together%0A%20%20%20%20%20%20from%20the%20pre-answer%20position%20through%20the%20last%20character%2C%20with%20a%20dip%0A%20%20%20%20%20%20mid-name%2C%20so%20an%20anchored%20result%20direction%20at%20the%20pre-answer%20position%20would%0A%20%20%20%20%20%20not%20have%20to%20work%20around%20ex-2.1.2's%20compute-and-evict%20schedule.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
562655615389d8f4b0834d4cfb2428cd