← Index
Source
Data provenance
ex-2.1.1
·
5eadc57-dirty
(dirty) · run 2026-07-14
via reports/m2/ex-2.1.1/checkpoints/d64-L4-s0, reports/m2/ex-2.1.1/checkpoints/d64-L4-s1, reports/m2/ex-2.1.1/checkpoints/d64-L4-s2, reports/m2/ex-2.1.1/metrics, reports/m2/ex-2.1.1/probe-weights
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.1%3A%20the%20color-mixing%20transformer%2C%20un-anchored%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.patheffects%20as%20pe%0A%20%20%20%20import%20matplotlib.pyplot%20as%20plt%0A%20%20%20%20import%20numpy%20as%20np%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%20CKPT_REF%2C%0A%20%20%20%20%20%20%20%20CORPUS_SEED%2C%0A%20%20%20%20%20%20%20%20DEPTHS%2C%0A%20%20%20%20%20%20%20%20HOLDOUT_FRAC%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%20SEEDS%2C%0A%20%20%20%20%20%20%20%20WEIGHTS_REF%2C%0A%20%20%20%20%20%20%20%20WIDTHS%2C%0A%20%20%20%20)%0A%20%20%20%20from%20mini.reports%20import%20externalize_html%2C%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%20themed%0A%20%20%20%20from%20sca%20import%20baselines%20as%20bl%0A%20%20%20%20from%20sca.data%20import%20colors%2C%20cube%0A%20%20%20%20from%20sca.vis%20import%20CUBE_VIEWS%2C%20draw_cube_bound%2C%20grid_diameter%2C%20plot_rgb_cube%2C%20project_cube%0A%20%20%20%20from%20subline.series%20import%20Series%0A%20%20%20%20from%20subline.subline%20import%20Subline%0A%0A%20%20%20%20use_publisher(report_bundle(__file__))%0A%0A%20%20%20%20EVAL_SETS%20%3D%20%5B%22named_seen%22%2C%20%22named_holdout%22%2C%20%22hex_unseen%22%2C%20%22cross_unseen%22%5D%0A%0A%20%20%20%20def%20load_results()%20-%3E%20tuple%5Blist%5Bdict%5D%2C%20dict%5Bstr%2C%20np.ndarray%5D%5D%20%7C%20None%3A%0A%20%20%20%20%20%20%20%20%22%22%22Resolve%20the%20metrics%20and%20probe%20weights%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%20WEIGHTS_REF%5D)%0A%20%20%20%20%20%20%20%20m_art%2C%20w_art%20%3D%20arts%5BMETRICS_REF%5D%2C%20arts%5BWEIGHTS_REF%5D%0A%20%20%20%20%20%20%20%20if%20m_art%20is%20None%20or%20w_art%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%20m_path%2C%20w_path%20%3D%20store.get_many(%5B(m_art%2C%20Path(d)%20%2F%20%22metrics.json%22)%2C%20(w_art%2C%20Path(d)%20%2F%20%22weights.npz%22)%5D)%0A%20%20%20%20%20%20%20%20%20%20%20%20metrics%20%3D%20json.loads(m_path.read_text())%0A%20%20%20%20%20%20%20%20%20%20%20%20with%20np.load(w_path)%20as%20z%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20weights%20%3D%20%7Bk%3A%20z%5Bk%5D%20for%20k%20in%20z.files%7D%0A%20%20%20%20%20%20%20%20return%20metrics%2C%20weights%0A%0A%20%20%20%20def%20label(w%3A%20int%2C%20d%3A%20int%2C%20s%3A%20int)%20-%3E%20str%3A%0A%20%20%20%20%20%20%20%20return%20f%22d%7Bw%7D-L%7Bd%7D-s%7Bs%7D%22%0A%0A%20%20%20%20def%20acc(metrics%3A%20list%5Bdict%5D%2C%20w%3A%20int%2C%20d%3A%20int%2C%20s%3A%20int%2C%20eval_set%3A%20str)%20-%3E%20float%3A%0A%20%20%20%20%20%20%20%20(r%2C)%20%3D%20%5Br%20for%20r%20in%20metrics%20if%20r%5B%22label%22%5D%20%3D%3D%20label(w%2C%20d%2C%20s)%5D%0A%20%20%20%20%20%20%20%20return%20r%5B%22accuracy%22%5D%5Beval_set%5D%5B%22accuracy%22%5D%0A%0A%20%20%20%20def%20width_shades()%20-%3E%20dict%5Bint%2C%20tuple%5D%3A%0A%20%20%20%20%20%20%20%20stops%20%3D%20light_dark(%5B0.7%2C%200.45%2C%200.12%5D%2C%20%5B0.8%2C%200.55%2C%200.28%5D)%0A%20%20%20%20%20%20%20%20return%20dict(zip(WIDTHS%2C%20plt.cm.viridis(stops)%2C%20strict%3DTrue))%0A%0A%20%20%20%20def%20pick_arch(metrics%3A%20list%5Bdict%5D)%20-%3E%20tuple%5Bint%2C%20int%5D%3A%0A%20%20%20%20%20%20%20%20%22%22%22The%20smallest%20cell%20(by%20params%20%E2%88%9D%20width%C2%B2%C2%B7depth)%20that%20saturates%20the%20unseen-pair%20sets.%22%22%22%0A%0A%20%20%20%20%20%20%20%20def%20unseen(w%3A%20int%2C%20d%3A%20int)%20-%3E%20float%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20float(np.mean(%5Bacc(metrics%2C%20w%2C%20d%2C%20s%2C%20es)%20for%20s%20in%20SEEDS%20for%20es%20in%20(%22hex_unseen%22%2C%20%22cross_unseen%22)%5D))%0A%0A%20%20%20%20%20%20%20%20cells%20%3D%20sorted(((w%2C%20d)%20for%20w%20in%20WIDTHS%20for%20d%20in%20DEPTHS)%2C%20key%3Dlambda%20c%3A%20c%5B0%5D%20**%202%20*%20c%5B1%5D)%0A%20%20%20%20%20%20%20%20return%20next((c%20for%20c%20in%20cells%20if%20unseen(*c)%20%3E%3D%200.995)%2C%20max(cells%2C%20key%3Dlambda%20c%3A%20unseen(*c)))%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.1%3A%20the%20color-mixing%20transformer%2C%20un-anchored%0A%0A%20%20%20%20In%20M2%2C%20we%20want%20to%20see%20whether%20Sparse%20Concept%20Anchoring%20carries%20over%20from%0A%20%20%20%20autoencoders%20to%20transformers.%20Before%20we%20anchor%20anything%20we%20need%20a%20baseline%2C%0A%20%20%20%20so%20this%20experiment%20trains%20a%20small%20transformer%20on%20a%20well-defined%20task.%0A%0A%20%20%20%20The%20model%20must%20learn%20a%20character-level%20language%20of%20color%20mixing%20equations%20on%0A%20%20%20%20a%2016-level%20RGB%20grid.%20Here%20are%20the%20sample%20types%2C%20which%20we%20will%20refer%20to%0A%20%20%20%20throughout%3A%0A%0A%20%20%20%20%7C%20Type%20%7C%20Example%20%7C%0A%20%20%20%20%7C------%7C---------%7C%0A%20%20%20%20%7C%20Named%20pairs%20%7C%20%60red%20%2B%20blue%20%3D%20purple%60%20%7C%0A%20%20%20%20%7C%20Hex%20pairs%20%20%20%7C%20%60%23f00%20%2B%20%2300f%20%3D%20%23808%60%20%20%7C%0A%20%20%20%20%7C%20Cross-form%20%20%7C%20%60red%20%2B%20%2300f%20%3D%20%23808%60%20%20%20%7C%0A%20%20%20%20%7C%20Alias%20%20%20%20%20%20%20%7C%20%60red%20%3D%20%23f00%60%20%20%20%20%20%20%20%20%20%20%7C%0A%0A%20%20%20%20Every%20operand%20spans%20several%20tokens%20in%20both%20of%20its%20spellings%2C%20to%20force%20the%0A%20%20%20%20model%20to%20perform%20two%20tasks%20simultaneously%3A%20it%20must%20mix%20the%20colors%20and%20spell%0A%20%20%20%20the%20result.%0A%0A%20%20%20%20Mixing%20(%60%2B%60)%20is%20the%20channel-wise%20round-half-up%20mean%2C%20so%20each%20prompt%20has%20one%0A%20%20%20%20correct%20completion.%0A%0A%20%20%20%20We%20sweep%20width%20%7B16%2C%2032%2C%2064%7D%20%C3%97%20depth%20%7B2%2C%204%7D%20%C3%97%203%20seeds%20(%5Bexperiment%0A%20%20%20%20definition%5D(.%2Fexperiment.py))%2C%20and%20for%20each%20cell%20we%20measure%3A%0A%0A%20%20%20%20-%20Completion%20accuracy%3A%20greedy%20decoding%2C%20scored%20as%20an%20exact%20string%20match%2C%0A%20%20%20%20%20%20over%20four%20evaluation%20sets.%20Those%20are%20named%20pairs%20seen%20in%20training%3B%0A%20%20%20%20%20%20held-out%20named%20pairs%2C%20which%20never%20appear%20as%20named%20equations%2C%20so%20the%20model%0A%20%20%20%20%20%20has%20to%20combine%20the%20alias%20dictionary%20with%20hex%20arithmetic%20to%20answer%20them%3B%0A%20%20%20%20%20%20hex-only%20equations%3B%20and%20cross-form%20operand%20pairs%20that%20were%20never%20shown%0A%20%20%20%20%20%20together.%0A%0A%20%20%20%20-%20Probe%20alignment%20%5B%5Eprobes%5D%3A%20ridge%20regression%20from%20the%20residual%20stream%20at%0A%20%20%20%20%20%20each%20depth%20out%20to%20the%20operand%20color%2C%20the%20result%20color%2C%20and%20the%20result's%0A%20%20%20%20%20%20*redness*.%0A%0A%20%20%20%20%23%23%20Hypotheses%0A%0A%20%20%20%20**H1.**%20A%20small%20nGPT%20should%20learn%20the%20task%2C%20with%20near-perfect%20accuracy%20on%0A%20%20%20%20seen%20forms%20and%20on%20unseen%20*hex*%20pairs%3B%20that%20leaves%20the%20anchored%20runs%20room%20to%0A%20%20%20%20show%20any%20degradation%20later.%0A%0A%20%20%20%20**H2.**%20Color%20should%20be%20linearly%20readable%20from%20the%20residual%20stream%2C%20more%20so%0A%20%20%20%20as%20depth%20increases.%0A%0A%20%20%20%20**H3.**%20The%20*redness*%20probe%20directions%20should%20vary%20from%20seed%20to%20seed.%20This%0A%20%20%20%20is%20part%20of%20the%20motivation%20for%20this%20work%3A%20searching%20for%20a%20concept%20after%0A%20%20%20%20training%20turns%20up%20a%20different%20geometry%20every%20time%2C%20whereas%20SCA%20should%20let%20us%0A%20%20%20%20fix%20the%20location%20in%20advance.%0A%0A%20%20%20%20%5B%5Eprobes%5D%3A%20A%20probe%20is%20a%20small%20linear%20model%20we%20fit%20on%20the%20model's%20internal%0A%20%20%20%20activations%20to%20read%20out%20what%20those%20activations%20carry.%20Ridge%20regression%20is%0A%20%20%20%20linear%20regression%20with%20a%20penalty%20on%20large%20weights%2C%20which%20keeps%20the%20fit%0A%20%20%20%20stable.%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%20Training%20data%0A%0A%20%20%20%20The%20corpus%20sampler%20is%20deterministic.%20Regenerating%20it%20here%20with%20the%0A%20%20%20%20experiment's%20own%20constants%20gives%20back%20the%20same%20training%20data%20the%20model%20saw%2C%0A%20%20%20%20and%20these%20are%20its%20first%20lines%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%20train_pairs%2C%20holdout%20%3D%20colors.split_named_pairs(CORPUS_SEED%2C%20HOLDOUT_FRAC)%0A%20%20%20%20corpus%20%3D%20colors.sample_corpus(N_EXAMPLES%2C%20CORPUS_SEED%2C%20train_pairs)%0A%0A%20%20%20%20def%20_form(ex)%20-%3E%20str%3A%0A%20%20%20%20%20%20%20%20if%20ex.rhs%20is%20None%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20%22alias%22%0A%20%20%20%20%20%20%20%20return%20%7B0%3A%20%22named%22%2C%203%3A%20%22hex%22%7D.get(ex.prompt.count(%22%23%22)%20%2B%20ex.answer.count(%22%23%22)%2C%20%22cross%22)%0A%0A%20%20%20%20_counts%20%3D%20%7Bf%3A%20sum(_form(ex)%20%3D%3D%20f%20for%20ex%20in%20corpus)%20for%20f%20in%20(%22hex%22%2C%20%22named%22%2C%20%22cross%22%2C%20%22alias%22)%7D%0A%20%20%20%20_pairs%20%3D%20%7Bp%20for%20ex%20in%20corpus%20if%20(p%20%3A%3D%20ex.pair)%20is%20not%20None%7D%0A%20%20%20%20_grid%20%3D%20colors.N_LEVELS**3%0A%20%20%20%20_all_pairs%20%3D%20_grid%20*%20(_grid%20%2B%201)%20%2F%2F%202%0A%20%20%20%20_head%20%3D%20%22%22.join(ex.text%20for%20ex%20in%20corpus%5B%3A10%5D)%0A%20%20%20%20_body%20%3D%20mo.md(f%22%60%60%60%5Cn%7B_head%7D%60%60%60%22).text%0A%20%20%20%20_caption%20%3D%20mo.md(f%22%22%22%0A%20%20%20%20%20%20%20%20%7Blen(corpus)%3A%2C%7D%20lines%20in%20total%3A%20%7B%22%2C%20%22.join(f%22%7Bn%3A%2C%7D%20%7Bf%7D%22%20for%20f%2C%20n%20in%20_counts.items())%7D.%0A%20%20%20%20%20%20%20%20%22%22%22).text%0A%20%20%20%20mo.md(f%22%22%22%0A%20%20%20%20%7Bfigure_html(_body%2C%20caption%3D_caption%2C%20class_%3D%22report-figure%22)%7D%0A%0A%20%20%20%20Between%20them%20they%20cover%20%7Blen(_pairs)%3A%2C%7D%20distinct%20operand%20pairs%2C%20**%7Blen(_pairs)%20%2F%20_all_pairs%3A.2%25%7D**%0A%20%20%20%20of%20the%20grid's%20%7B_all_pairs%20%2F%201e6%3A.1f%7DM.%20So%20the%20unseen-pair%20eval%20sets%2C%20sampled%20to%20steer%20clear%20of%0A%20%20%20%20all%20of%20them%2C%20test%20the%20mixing%20rule%20rather%20than%20recall.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%20holdout%2C%20train_pairs%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%20The%20color%20space%0A%0A%20%20%20%20Every%20color%20is%20a%20point%20on%20an%20RGB%20grid%20with%2016%20levels%20per%20channel%2C%20so%2016%C2%B3%20%3D%0A%20%20%20%204096%20points%20in%20all.%20If%20we%20rotate%20the%20cube%20so%20its%20black-to-white%20diagonal%0A%20%20%20%20stands%20vertical%2C%20*value*%20runs%20up%20the%20page%20and%20hue%20wraps%20around%20it.%20That%20is%0A%20%20%20%20the%20figure%20below%2C%20seen%20front-on%20toward%20the%20*red*%20corner.%20Hex%20and%20cross%0A%20%20%20%20equations%20draw%20their%20operands%20from%20anywhere%20in%20this%20cube.%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%20%40themed(%0A%20%20%20%20%20%20%20%20name%3D%22color-space-cube%22%2C%0A%20%20%20%20%20%20%20%20alt_text%3D(%0A%20%20%20%20%20%20%20%20%20%20%20%20%22An%20orthographic%20front%20view%20of%20the%20RGB%20grid%2C%20rotated%20so%20the%20black-to-white%20diagonal%20is%20vertical%3A%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%22black%20at%20the%20bottom%2C%20white%20at%20the%20top%2C%20hues%20fanned%20around%20the%20middle%2C%20showing%20the%20red%2C%20green%2C%20and%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%22magenta%20faces.%20Each%20of%20the%204096%20grid%20colors%20is%20a%20filled%20dot%2C%20packed%20densely%20enough%20to%20read%20as%20a%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%22smooth%20solid.%22%0A%20%20%20%20%20%20%20%20)%2C%0A%20%20%20%20%20%20%20%20caption%3D%22The%2016%C2%B3%20hex%20grid%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(4.6%2C%204.4))%0A%20%20%20%20%20%20%20%20%23%20The%20grid%20fills%20its%20own%20silhouette%2C%20so%20the%20hexagon%20bound%20would%20only%20trace%20what%20the%0A%20%20%20%20%20%20%20%20%23%20data%20already%20draws%3B%20%60grid_diameter%60%20sizes%20the%20dots%20to%20tile%20it%20exactly.%0A%20%20%20%20%20%20%20%20plot_rgb_cube(ax%2C%20cube.grid()%2C%20diameter%3Dgrid_diameter(colors.N_LEVELS)%2C%20bound%3DFalse)%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%20The%2027%20named%20colors%20sit%20only%20on%20the%20%7B0%2C%208%2C%2015%7D%C2%B3%20sub-lattice%2C%20the%20cube's%0A%20%20%20%20corners%20and%20edge%20midpoints.%20Note%20that%20no%20*color*%20is%20held%20out%3A%20every%20point%0A%20%20%20%20shows%20up%20in%20training%2C%20since%20hex%20operands%20are%20sampled%20over%20the%20whole%20grid%20and%0A%20%20%20%20each%20name%20appears%20in%20an%20alias%20line.%20What%20we%20hold%20out%20is%20operand%20pairs%2C%20both%0A%20%20%20%20named%20and%20hex.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(holdout%2C%20train_pairs)%3A%0A%20%20%20%20%23%20Split%20the%20two-panel%20lattice%20into%20two%20independent%20figures%20so%20they%20reflow%20and%20shrink%0A%20%20%20%20%23%20separately%3A%20on%20a%20narrow%20screen%20the%20pair%20stacks%20instead%20of%20shrinking%20as%20a%20block%2C%0A%20%20%20%20%23%20keeping%20each%20panel%20legible.%20The%20panels%20used%20to%20share%20a%20y-axis%3B%20now%20that%20they%20are%0A%20%20%20%20%23%20separate%20figures%2C%20an%20identical%20figsize%20and%20the%20cube%20panel's%20fixed%20limits%20give%20them%20the%0A%20%20%20%20%23%20same%20lattice%20scale%20%E2%80%94%20and%2C%20since%20the%20tight%20crop%20is%20dominated%20by%20that%20shared%20axes%20box%2C%0A%20%20%20%20%23%20the%20same%20size%20%E2%80%94%20without%20a%20shared%20axis.%20The%20lettered%20tags%20sit%20just%20outside%20those%20limits%0A%20%20%20%20%23%20(annotation_clip%3DFalse)%20and%20are%20picked%20up%20by%20the%20crop.%0A%20%20%20%20_vals%20%3D%20list(colors.PALETTE.values())%0A%20%20%20%20_idx%20%3D%20%7Bc%3A%20i%20for%20i%2C%20c%20in%20enumerate(_vals)%7D%0A%20%20%20%20_train_edges%20%3D%20%5Bp%20for%20p%20in%20train_pairs%20if%20p%5B0%5D%20!%3D%20p%5B1%5D%5D%20%20%23%20self-pairs%20are%20just%20the%20vertices%0A%20%20%20%20_named%20%3D%20cube.named()%0A%20%20%20%20%23%20A%20single%20front%20view%20suffices%3A%20the%20lattice%20is%20mostly%20empty%2C%20so%20nothing%20hides%20behind%20it.%0A%20%20%20%20%23%20Drawn%20by%20hand%20rather%20than%20through%20%60plot_rgb_cube%60%2C%20because%20the%20edges%20and%20lettered%20tags%0A%20%20%20%20%23%20need%20the%20projected%20coordinates%20and%20the%20per-vertex%20depth%20to%20order%20themselves.%0A%20%20%20%20_xy%20%3D%20project_cube(_named)%0A%20%20%20%20_x%2C%20_y%20%3D%20_xy%5B%3A%2C%200%5D%2C%20_xy%5B%3A%2C%201%5D%0A%20%20%20%20_depth%20%3D%20_named%20%40%20CUBE_VIEWS%5B%22solid%22%5D.toward%0A%20%20%20%20_dmin%2C%20_dspan%20%3D%20_depth.min()%2C%20_depth.max()%20-%20_depth.min()%0A%20%20%20%20_cx%2C%20_cy%20%3D%20_x.mean()%2C%20_y.mean()%0A%0A%20%20%20%20def%20_panel(bold%2C%20other%2C%20examples)%20-%3E%20plt.Figure%3A%0A%20%20%20%20%20%20%20%20fig%2C%20ax%20%3D%20plt.subplots(figsize%3D(4.2%2C%204.4))%0A%20%20%20%20%20%20%20%20faint%2C%20vedge%20%3D%20light_dark(%22%230001%22%2C%20%22%23fff1%22)%2C%20light_dark(%22%230006%22%2C%20%22%23fff7%22)%0A%20%20%20%20%20%20%20%20ink%2C%20halo%20%3D%20light_dark(%22%23111%22%2C%20%22%23eee%22)%2C%20light_dark(%22%23fff%22%2C%20%22%23111%22)%0A%0A%20%20%20%20%20%20%20%20def%20_edge(pair%2C%20lw_lo%2C%20lw_hi%2C%20**kw)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20u%2C%20v%20%3D%20_idx%5Bpair%5B0%5D%5D%2C%20_idx%5Bpair%5B1%5D%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20mid%20%3D%20(_depth%5Bu%5D%20%2B%20_depth%5Bv%5D)%20%2F%202%20%20%23%20orders%20each%20edge%20against%20the%20vertices%20for%20occlusion%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20Taper%20by%20depth%3A%20front-facing%20edges%20read%20heavy%2C%20back%2Finterior%20ones%20recede.%0A%20%20%20%20%20%20%20%20%20%20%20%20lw%20%3D%20lw_lo%20%2B%20(lw_hi%20-%20lw_lo)%20*%20(mid%20-%20_dmin)%20%2F%20_dspan%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.plot(%5B_x%5Bu%5D%2C%20_x%5Bv%5D%5D%2C%20%5B_y%5Bu%5D%2C%20_y%5Bv%5D%5D%2C%20lw%3Dlw%2C%20zorder%3Dfloat(mid)%2C%20solid_capstyle%3D%22round%22%2C%20**kw)%0A%0A%20%20%20%20%20%20%20%20def%20_letter(name%2C%20ch)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20i%20%3D%20_idx%5Bcolors.PALETTE%5Bname%5D%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20ang%20%3D%20np.arctan2(_y%5Bi%5D%20-%20_cy%2C%20_x%5Bi%5D%20-%20_cx)%20%20%23%20nudge%20the%20tag%20radially%20outward%2C%20clear%20of%20the%20lattice%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20name%20%3D%3D%20%22white%22%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ang%20%3D%20np.radians(150)%20%20%23%20apex%20points%20straight%20at%20the%20title%3B%20send%20it%20up-left%20instead%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.annotate(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ch%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(_x%5Bi%5D%2C%20_y%5Bi%5D)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(_x%5Bi%5D%20%2B%20np.cos(ang)%20*%200.14%2C%20_y%5Bi%5D%20%2B%20np.sin(ang)%20*%200.14)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ha%3D%22center%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20va%3D%22center%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20fontsize%3D11%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20fontweight%3D%22bold%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20fontstyle%3D%22italic%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20color%3Dink%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20zorder%3D100%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20annotation_clip%3DFalse%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20path_effects%3D%5Bpe.withStroke(linewidth%3D3%2C%20foreground%3Dhalo)%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20)%0A%0A%20%20%20%20%20%20%20%20for%20_p%20in%20other%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20_edge(_p%2C%200.4%2C%202.0%2C%20color%3Dfaint)%0A%20%20%20%20%20%20%20%20for%20_p%20in%20bold%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20_result%20%3D%20tuple(np.array(colors.mix(*_p))%20%2F%20(colors.N_LEVELS%20-%201))%0A%20%20%20%20%20%20%20%20%20%20%20%20_edge(_p%2C%201.4%2C%203.0%2C%20color%3D_result)%0A%20%20%20%20%20%20%20%20%23%20Vertices%20in%20true%20color%3B%20%2B%CE%B5%20on%20zorder%20so%20a%20vertex%20wins%20a%20depth%20tie%20with%20an%20edge.%0A%20%20%20%20%20%20%20%20for%20_i%20in%20range(len(_vals))%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.scatter(_x%5B_i%5D%2C%20_y%5B_i%5D%2C%20c%3D%5B_named%5B_i%5D%5D%2C%20s%3D60%2C%20edgecolors%3Dvedge%2C%20lw%3D0.6%2C%20zorder%3Dfloat(_depth%5B_i%5D)%20%2B%201e-3)%0A%20%20%20%20%20%20%20%20_u%2C%20_v%2C%20_chs%20%3D%20examples%0A%20%20%20%20%20%20%20%20_letter(_u%2C%20_chs%5B0%5D)%0A%20%20%20%20%20%20%20%20_letter(_v%2C%20_chs%5B1%5D)%0A%20%20%20%20%20%20%20%20draw_cube_bound(ax)%0A%20%20%20%20%20%20%20%20return%20fig%0A%0A%20%20%20%20_train_alt%20%3D%20(%0A%20%20%20%20%20%20%20%20%22An%20orthographic%20front%20view%20of%20the%2027%20named%20colors%20as%20a%20lattice%20in%20the%20rotated%20RGB%20cube%2C%20value%20%22%0A%20%20%20%20%20%20%20%20%22vertical%20with%20black%20at%20the%20bottom%20and%20white%20at%20the%20top.%20Each%20named%20color%20is%20a%20small%20dot%20in%20its%20true%20%22%0A%20%20%20%20%20%20%20%20%22color.%20The%20pairs%20used%20as%20named%20equations%20in%20training%20are%20bold%20and%20colored%20by%20the%20color%20their%20two%20%22%0A%20%20%20%20%20%20%20%20%22operands%20mix%20to%3B%20the%20held-out%20pairs%20are%20drawn%20faint%20for%20context.%20One%20training%20edge%20is%20picked%20out%20on%20%22%0A%20%20%20%20%20%20%20%20%22the%20cube's%20silhouette%20with%20italic%20letters%20a%20and%20b%20at%20its%20endpoints%20(white%20and%20magenta)%2C%20the%20worked%20%22%0A%20%20%20%20%20%20%20%20%22example%20a%20%2B%20b%20%3D%20orchid.%20The%20panel%20has%20no%20background%20fill%20or%20axes%3B%20front-facing%20edges%20are%20heavier%20than%20%22%0A%20%20%20%20%20%20%20%20%22back%20and%20interior%20ones%2C%20so%20the%20lattice%20reads%20three-dimensionally.%20Titled%20'train'.%22%0A%20%20%20%20)%0A%20%20%20%20_holdout_alt%20%3D%20(%0A%20%20%20%20%20%20%20%20%22The%20same%20orthographic%20front%20view%20of%20the%2027%20named%20colors%20in%20the%20rotated%20RGB%20cube%2C%20same%20orientation%20and%20%22%0A%20%20%20%20%20%20%20%20%22styling%20as%20the%20train%20panel.%20Here%20the%20pairs%20held%20out%20for%20the%20named-holdout%20evaluation%20are%20bold%20and%20%22%0A%20%20%20%20%20%20%20%20%22colored%20by%20their%20mixed%20result%2C%20with%20the%20training%20pairs%20drawn%20faint%20for%20context.%20One%20held-out%20edge%20is%20%22%0A%20%20%20%20%20%20%20%20%22picked%20out%20on%20the%20cube's%20silhouette%20with%20italic%20letters%20c%20and%20d%20at%20its%20endpoints%20(magenta%20and%20blue)%2C%20%22%0A%20%20%20%20%20%20%20%20%22the%20worked%20example%20c%20%2B%20d%20%3D%20violet.%20Titled%20'held%20out%20for%20eval'.%22%0A%20%20%20%20)%0A%20%20%20%20_left%20%3D%20themed(%0A%20%20%20%20%20%20%20%20lambda%3A%20_panel(_train_edges%2C%20holdout%2C%20(%22white%22%2C%20%22magenta%22%2C%20%22ab%22))%2C%0A%20%20%20%20%20%20%20%20name%3D%22named-pair-lattice-train%22%2C%0A%20%20%20%20%20%20%20%20alt_text%3D_train_alt%2C%0A%20%20%20%20%20%20%20%20caption%3D%22Train%22%2C%0A%20%20%20%20)()%0A%20%20%20%20_right%20%3D%20themed(%0A%20%20%20%20%20%20%20%20lambda%3A%20_panel(holdout%2C%20_train_edges%2C%20(%22magenta%22%2C%20%22blue%22%2C%20%22cd%22))%2C%0A%20%20%20%20%20%20%20%20name%3D%22named-pair-lattice-holdout%22%2C%0A%20%20%20%20%20%20%20%20alt_text%3D_holdout_alt%2C%0A%20%20%20%20%20%20%20%20caption%3D%22Held%20out%20for%20eval%22%2C%0A%20%20%20%20)()%0A%20%20%20%20%23%20Two%20sub-figures%20under%20one%20caption%3A%20figure_html%20nests%20the%20themed%20panels%20in%20a%20%3Cfigure%3E%0A%20%20%20%20%23%20that%20the%20%60figure%3Ahas(%3E%20figure)%60%20rule%20in%20report.css%20reflows%20to%20a%20stack%20on%20a%20narrow%20screen.%0A%20%20%20%20mo.Html(%0A%20%20%20%20%20%20%20%20figure_html(%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22%7B_left%7D%7B_right%7D%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20caption%3D%22%22%22%0A%20%20%20%20Named%20pairs%20on%20the%20cube.%0A%20%20%20%20%3Cb%3Ea-b%3C%2Fb%3E%3A%20white%20%2B%20magenta%20%3D%20orchid.%0A%20%20%20%20%3Cb%3Ec-d%3C%2Fb%3E%3A%20magenta%20%2B%20blue%20%3D%20violet.%0A%20%20%20%20%22%22%22%2C%0A%20%20%20%20%20%20%20%20)%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(rf%22%22%22%0A%20%20%20%20Both%20figures%20show%20the%20same%20lattice%20from%20the%20front.%20The%20vertices%20are%20the%0A%20%20%20%20named%20colors%2C%20and%20each%20edge%20joins%20the%20two%20operands%20of%20a%20named%20pair.%20An%20edge's%0A%20%20%20%20midpoint%2C%20is%20the%20answer%20that%20equation%20should%0A%20%20%20%20produce.%0A%0A%20%20%20%20Two%20edges%20are%20labeled%20as%20worked%20examples%3A%0A%0A%20%20%20%20-%20%24%5Coverline%7B%7Bab%7D%7D%24%3A%20%7Bcolors.swatch(%22white%22)%7D%20%2B%20%7Bcolors.swatch(%22magenta%22)%7D%20%3D%20%7Bcolors.swatch(%22orchid%22)%7D%20(train)%0A%20%20%20%20-%20%24%5Coverline%7B%7Bcd%7D%7D%24%3A%20%7Bcolors.swatch(%22magenta%22)%7D%20%2B%20%7Bcolors.swatch(%22blue%22)%7D%20%3D%20%7Bcolors.swatch(%22violet%22)%7D%20(held%20out)%0A%0A%20%20%20%20Only%20the%20connected%20pairs%20ever%20appear%20as%20named%20equations%20*with%20a%20named%0A%20%20%20%20answer*.%20Every%20other%20operand%20pair%20the%20model%20sees%20is%20written%20in%20hex%20or%20cross%0A%20%20%20%20form%2C%20and%20those%20draw%20their%20operands%20from%20the%20full%2016%C2%B3%20grid.%0A%0A%20%20%20%20A%20held-out%20edge%20like%20%60magenta%20%2B%20blue%20%3D%20violet%60%20can%20be%20answered%20two%20ways.%20One%0A%20%20%20%20is%20recall%2C%20which%20is%20ruled%20out%20here%2C%20since%20that%20named%20rendering%20never%20appears%0A%20%20%20%20in%20training.%20The%20other%20is%20composition%3A%20recognize%20both%20names%20as%20colors%2C%0A%20%20%20%20mix%20them%20as%20if%20they%20had%20been%20written%20in%20hex%2C%20and%20translate%20the%20result%0A%20%20%20%20back%20into%20a%20name.%20Composition%20is%20what%20the%20%60named_holdout%60%20eval%20set%20measures.%0A%0A%20%20%20%20The%20%60hex_unseen%60%20and%20%60cross_unseen%60%20sets%20are%20sampled%20at%20evaluation%20time%20from%0A%20%20%20%20the%20full%20grid%2C%20steering%20clear%20of%20every%20operand%20pair%20the%20corpus%20used.%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%20and%20probe%20weights%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.1%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%20weights%20%3D%20loaded%0A%20%20%20%20return%20metrics%2C%20weights%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(metrics)%3A%0A%20%20%20%20_hex%20%3D%20%5Bacc(metrics%2C%20w%2C%20d%2C%20s%2C%20%22hex_unseen%22)%20for%20w%20in%20WIDTHS%20for%20d%20in%20DEPTHS%20for%20s%20in%20SEEDS%5D%0A%20%20%20%20_hold%20%3D%20%5Bacc(metrics%2C%20w%2C%20d%2C%20s%2C%20%22named_holdout%22)%20for%20w%20in%20WIDTHS%20for%20d%20in%20DEPTHS%20for%20s%20in%20SEEDS%5D%0A%20%20%20%20mo.md(f%22%22%22%0A%20%20%20%20Results%3A%20Accuracy%20on%20unseen%20hex%20pairs%20spans%0A%20%20%20%20**%7Bmin(_hex)%3A.2f%7D%E2%80%93%7Bmax(_hex)%3A.2f%7D**%20across%20the%20sweep%2C%20while%20held-out%20named%0A%20%20%20%20pairs%2C%20the%20compositional%20test%2C%20span%20**%7Bmin(_hold)%3A.2f%7D%E2%80%93%7Bmax(_hold)%3A.2f%7D**.%0A%20%20%20%20The%20figures%20below%20break%20this%20down%20by%20cell%20and%20eval%20set.%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%20Completion%20accuracy%20across%20the%20sweep%0A%0A%20%20%20%20The%20figure%20below%20shows%20accuracy%20vs.%20model%20width%2C%20with%20one%20panel%20per%20eval%20set.%0A%20%20%20%20Each%20panel%20has%20one%20line%20per%20model%20depth%20(the%20mean%20over%20seeds).%0A%20%20%20%20Individual%20seeds%20are%20shown%20as%20faint%20points.%0A%0A%20%20%20%20The%20named-holdout%20panel%20is%20interesting.%20It%20can%20only%20be%20solved%20by%0A%20%20%20%20combining%20the%20alias%20dictionary%20with%20the%20mixing%20arithmetic%2C%20and%20we%20find%20that%0A%20%20%20%20the%20model%20never%20learns%20to%20do%20that.%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%22accuracy-sweep%22%2C%0A%20%20%20%20%20%20%20%20alt_text%3D(%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Four%20line%20charts%20of%20completion%20accuracy%20(0%20to%201)%20against%20model%20width%20(16%2C%2032%2C%2064)%2C%20one%20panel%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%22per%20eval%20set%3A%20named%20seen%2C%20named%20holdout%2C%20hex%20unseen%2C%20and%20cross%20unseen.%20Each%20panel%20has%20one%20line%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%22per%20depth%20(2%20and%204%20layers%2C%20darker%20is%20deeper)%2C%20averaged%20over%20three%20seeds%2C%20with%20individual%20seeds%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%22as%20faint%20points.%22%0A%20%20%20%20%20%20%20%20)%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%204%2C%20figsize%3D(11.5%2C%203.2)%2C%20sharey%3DTrue)%0A%20%20%20%20%20%20%20%20_stops%20%3D%20light_dark(%5B0.6%2C%200.2%5D%2C%20%5B0.7%2C%200.4%5D)%0A%20%20%20%20%20%20%20%20shades%20%3D%20dict(zip(DEPTHS%2C%20plt.cm.viridis(_stops)%2C%20strict%3DTrue))%0A%20%20%20%20%20%20%20%20for%20ax%2C%20es%20in%20zip(axes%2C%20EVAL_SETS%2C%20strict%3DTrue)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20for%20d%20in%20DEPTHS%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20per_seed%20%3D%20np.array(%5B%5Bacc(metrics%2C%20w%2C%20d%2C%20s%2C%20es)%20for%20s%20in%20SEEDS%5D%20for%20w%20in%20WIDTHS%5D)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20for%20s%20in%20range(len(SEEDS))%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ax.plot(WIDTHS%2C%20per_seed%5B%3A%2C%20s%5D%2C%20%22o%22%2C%20color%3Dshades%5Bd%5D%2C%20alpha%3D0.3%2C%20ms%3D3)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ax.plot(WIDTHS%2C%20per_seed.mean(axis%3D1)%2C%20%22o-%22%2C%20color%3Dshades%5Bd%5D%2C%20label%3Df%22%7Bd%7D%20layers%22%2C%20lw%3D2)%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%20xlabel%3D%22width%22%2C%20xscale%3D%22log%22%2C%20ylim%3D(-0.03%2C%201.03))%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.set_xticks(WIDTHS%2C%20labels%3D%5Bstr(w)%20for%20w%20in%20WIDTHS%5D)%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.set_xticks(%5B%5D%2C%20minor%3DTrue)%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(%22completion%20accuracy%22)%0A%20%20%20%20%20%20%20%20axes%5B0%5D.legend(fontsize%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_(metrics)%3A%0A%20%20%20%20_w%2C%20_d%20%3D%20pick_arch(metrics)%0A%20%20%20%20mo.md(rf%22%22%22%0A%20%20%20%20%23%23%20Watching%20it%20answer%2C%20character%20by%20character%0A%0A%20%20%20%20Let's%20see%20where%20in%20each%20sequence%20the%20model%20was%20unsure.%0A%0A%20%20%20%20For%20the%20d%7B_w%7D-L%7B_d%7D%20model%20(seed%20%7BSEEDS%5B0%5D%7D)%2C%20we%20plot%20one%20example%20per%20eval%20set%0A%20%20%20%20and%20draw%20two%20series%20beneath%20the%20text%2C%20both%20as%20fractions%20of%20%24%5Clog%20%7CV%7C%24%2C%20the%0A%20%20%20%20value%20a%20uniform%20guess%20over%20the%20vocabulary%20would%20give.%20The%20first%20is%20the%0A%20%20%20%20model's%20surprisal%20at%20each%20character%3A%20how%20%22surprised%22%20it%20is%20by%20the%20character%20that%0A%20%20%20%20actually%20comes%20next.%20The%20second%20is%20the%20entropy%20of%20its%20predictive%0A%20%20%20%20distribution%2C%20the%20surprisal%20it%20expected%20on%20average%20before%20seeing%20that%0A%20%20%20%20character.%0A%0A%20%20%20%20Operands%20are%20unpredictable%2C%20so%20both%20series%20should%20spike%20at%20the%0A%20%20%20%20first%20characters%20of%20each%20operand%20and%20settle%20as%20the%20prefix%20pins%20down%20the%20rest.%0A%20%20%20%20Everything%20after%20%60%3D%60%20can%20be%20computed%20from%20the%20operands%2C%20so%20a%20model%20that%20has%20learnt%0A%20%20%20%20color%20mixing%20should%20coast%20through%20the%20answer%20at%20near-zero%20surprisal%2C%20even%20on%0A%20%20%20%20operand%20pairs%20it%20has%20never%20seen.%20If%20instead%20it%20guesses%20the%20answer%2C%0A%20%20%20%20surprisal%20should%20spike%20across%20the%20answer%20characters.%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_w%2C%20_d%20%3D%20pick_arch(metrics)%0A%20%20%20%20(_cell%2C)%20%3D%20%5Br%20for%20r%20in%20metrics%20if%20r%5B%22label%22%5D%20%3D%3D%20label(_w%2C%20_d%2C%20SEEDS%5B0%5D)%5D%0A%20%20%20%20%23%20named_holdout's%20index%201%20is%20%60lime%20%2B%20black%20%3D%20green%60%2C%20the%20example%20%22Why%20the%0A%20%20%20%20%23%20named%20answers%20fail%22%20walks%20through%20below%3B%20index%200%20is%20a%20same-set%20spare.%0A%20%20%20%20_idx%20%3D%20%7B%22named_holdout%22%3A%201%7D%0A%20%20%20%20rows%20%3D%20%5B(es%2C%20_cell%5B%22surprisal%22%5D%5Bes%5D%5B_idx.get(es%2C%200)%5D)%20for%20es%20in%20EVAL_SETS%5D%0A%20%20%20%20log_v%20%3D%20np.log(len(colors.alphabet()))%0A%20%20%20%20sub_width%20%3D%20min(max(len(r%5B%22text%22%5D)%20for%20_%2C%20r%20in%20rows)%2C%2080)%0A%20%20%20%20%23%20Match%20the%20sublines'%20dark%20background%20to%20this%20notebook's%2C%20rather%20than%20subline's%0A%20%20%20%20%23%20neutral%20default%3B%20light%20mode%20already%20matches.%20%60css%60%20overrides%20the%20library's%20own%0A%20%20%20%20%23%20%60--bg-color%60%20(later%20rule%20wins).%0A%20%20%20%20sub_css%20%3D%20%22svg%20%7B%20--bg-color%3A%20light-dark(%23fff%2C%20%23181c1a)%3B%20%7D%22%0A%0A%20%20%20%20def%20sublines(rows%3A%20list%5Btuple%5Bstr%2C%20dict%5D%5D%2C%20series%2C%20aria_label%3A%20str%2C%20name%3A%20str)%20-%3E%20mo.Html%3A%0A%20%20%20%20%20%20%20%20%22%22%22Lay%20out%20one%20captioned%20subline%20per%20eval%20set%3B%20%60series(row)%60%20builds%20its%20series%20list.%0A%0A%20%20%20%20%20%20%20%20The%20block%20is%20inlined%20(so%20the%20SVGs%20share%20the%20page's%20CSS)%20*and*%20externalized%20as%0A%20%20%20%20%20%20%20%20%60_assets%2F%3Cname%3E.html%60%20%E2%80%94%20a%20plain%20file%20for%20tooling%20that%20can't%20run%20the%20frontend.%0A%20%20%20%20%20%20%20%20%22%22%22%0A%0A%20%20%20%20%20%20%20%20def%20one(name%3A%20str%2C%20row%3A%20dict)%20-%3E%20str%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20svg%20%3D%20Subline(chars_per_line%3Dsub_width%2C%20css%3Dsub_css).plot(row%5B%22text%22%5D%2C%20series(row))%0A%20%20%20%20%20%20%20%20%20%20%20%20label%20%3D%20f'%3Cspan%20style%3D%22font-size%3A%2011px%3B%20font-family%3A%20monospace%3B%20opacity%3A%200.65%22%3E%7Bname%7D%3C%2Fspan%3E'%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20figure_html(svg%2C%20caption%3Dlabel%2C%20style%3D%22display%3A%20inline-block%3B%20margin%3A%200%20.5em%22)%0A%0A%20%20%20%20%20%20%20%20strip%20%3D%20%22%22.join(one(name%2C%20row)%20for%20name%2C%20row%20in%20rows)%0A%20%20%20%20%20%20%20%20return%20mo.Html(externalize_html(figure_html(strip%2C%20aria_label%3Daria_label)%2C%20name%3Dname))%0A%0A%20%20%20%20def%20pad(row%3A%20dict%2C%20key%3A%20str)%20-%3E%20np.ndarray%3A%0A%20%20%20%20%20%20%20%20%22%22%22Scale%20to%20fractions%20of%20log%20%7CV%7C%20and%20align%20with%20the%20text%3A%20position%200%20has%20no%20prediction.%22%22%22%0A%20%20%20%20%20%20%20%20return%20np.concatenate(%5B%5Bnp.nan%5D%2C%20np.asarray(row%5Bkey%5D)%20%2F%20log_v%5D)%0A%0A%20%20%20%20return%20pad%2C%20rows%2C%20sublines%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(pad%2C%20rows%2C%20sublines)%3A%0A%20%20%20%20def%20_series(row%3A%20dict)%20-%3E%20list%5BSeries%5D%3A%0A%20%20%20%20%20%20%20%20return%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20Series(raw%3Dnp.clip(pad(row%2C%20%22nll%22)%2C%200%2C%201)%2C%20label%3D%22surprisal%22)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20Series(raw%3Dnp.clip(pad(row%2C%20%22entropy%22)%2C%200%2C%201)%2C%20label%3D%22entropy%22%2C%20dasharray%3D%223%202%22)%2C%0A%20%20%20%20%20%20%20%20%5D%0A%0A%20%20%20%20sublines(%0A%20%20%20%20%20%20%20%20rows%2C%0A%20%20%20%20%20%20%20%20_series%2C%0A%20%20%20%20%20%20%20%20%22Four%20short%20mixing%20equations%2C%20one%20per%20eval%20set%2C%20each%20with%20a%20sparkline%20of%20per-character%20%22%0A%20%20%20%20%20%20%20%20%22surprisal%20(solid)%20and%20predictive%20entropy%20(dashed)%20drawn%20under%20the%20text%2C%20on%20a%20shared%20%22%0A%20%20%20%20%20%20%20%20%220-to-log-V%20scale.%20The%20two%20series%20track%20each%20other%2C%20spiking%20at%20operand%20starts%20and%20%22%0A%20%20%20%20%20%20%20%20%22staying%20near%20zero%20across%20the%20answers%20%E2%80%94%20except%20named%20holdout%2C%20where%20surprisal%20rises%20%22%0A%20%20%20%20%20%20%20%20%22well%20above%20entropy%20on%20the%20answer%20characters.%22%2C%0A%20%20%20%20%20%20%20%20name%3D%22sublines-surprisal%22%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%20The%20gap%20between%20those%20two%20series%20is%20%5Bthe%20surprisal%20beyond%20what%20the%20model%20expected%5D(https%3A%2F%2Fwww.lesswrong.com%2Fposts%2FKjo64rSWkFfc3sre5%2Fdetecting-out-of-distribution-text-with-surprisal-and%235__Surprise_surprise__A_new_metric)%2C%0A%0A%20%20%20%20%24%24s_2%20%3D%20%5Cfrac%7Bi%20-%20h%7D%7B%5Clog%20%7CV%7C%7D%24%24%0A%0A%20%20%20%20where%20%24i%24%20is%20the%20surprisal%20and%20%24h%24%20the%20entropy.%20This%20sits%20near%20zero%20when%20the%0A%20%20%20%20model's%20confidence%20matched%20the%20outcome%2C%20whether%20it%20was%20confident%20and%20right%20or%0A%20%20%20%20unsure%20and%20appropriately%20surprised.%20It%20goes%20positive%20when%20the%20model%20was%20confidently%0A%20%20%20%20wrong%2C%20and%20negative%20when%20the%20character%20was%20more%20predictable%20than%20its%0A%20%20%20%20distribution%20suggested.%20The%20sparkline%20clips%20at%20zero%2C%20so%20we%20draw%20the%20negative%0A%20%20%20%20values%20as%20a%20second%2C%20flipped%20series%2C%20%24-s_2%24.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(pad%2C%20rows%2C%20sublines)%3A%0A%20%20%20%20def%20_s2(row%3A%20dict)%20-%3E%20np.ndarray%3A%0A%20%20%20%20%20%20%20%20return%20pad(row%2C%20%22nll%22)%20-%20pad(row%2C%20%22entropy%22)%0A%0A%20%20%20%20def%20_series(row%3A%20dict)%20-%3E%20list%5BSeries%5D%3A%0A%20%20%20%20%20%20%20%20return%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20Series(raw%3Dnp.clip(_s2(row)%2C%20None%2C%201)%2C%20label%3D%22s%E2%82%82%22)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20Series(raw%3Dnp.clip(-_s2(row)%2C%20None%2C%201)%2C%20label%3D%22%E2%88%92s%E2%82%82%22%2C%20dasharray%3D%223%202%22)%2C%0A%20%20%20%20%20%20%20%20%5D%0A%0A%20%20%20%20sublines(%0A%20%20%20%20%20%20%20%20rows%2C%0A%20%20%20%20%20%20%20%20_series%2C%0A%20%20%20%20%20%20%20%20%22The%20same%20four%20equations%2C%20now%20with%20sparklines%20of%20surprise-surprise%3A%20surprisal%20minus%20%22%0A%20%20%20%20%20%20%20%20%22entropy%20as%20a%20fraction%20of%20log%20V.%20The%20solid%20series%20shows%20the%20positive%20part%20(more%20surprised%20%22%0A%20%20%20%20%20%20%20%20%22than%20expected)%3B%20the%20dashed%20series%20shows%20the%20negative%20part%20flipped%20above%20zero%20(less%20%22%0A%20%20%20%20%20%20%20%20%22surprised%20than%20expected).%20Three%20sets%20stay%20close%20to%20the%20baseline%3B%20named%20holdout%20shows%20%22%0A%20%20%20%20%20%20%20%20%22tall%20positive%20spikes%20across%20its%20answer%20characters.%22%2C%0A%20%20%20%20%20%20%20%20name%3D%22sublines-surprise-surprise%22%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%20None%20spike%20except%20%60named_holdout%60%2C%20the%20one%20set%20this%20sweep%20never%20solves%0A%20%20%20%20(accuracy%200%20above).%20The%20model%20is%20confident%20even%20on%20those%20wrong%20answers%3A%20entropy%0A%20%20%20%20stays%20low%20while%20the%20true%20characters%20arrive%20as%20a%20surprise.%20What%20is%20the%20model%20so%20sure%20of%3F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(name_prob)%3A%0A%20%20%20%20def%20_p(prompt%3A%20str%2C%20word%3A%20str)%20-%3E%20float%3A%0A%20%20%20%20%20%20%20%20return%20name_prob(SEEDS%5B0%5D%2C%20prompt%2C%20word)%0A%0A%20%20%20%20_p_blue%20%3D%20name_prob(SEEDS%5B0%5D%2C%20%22lime%20%2B%20bl%22%2C%20%22u%22)%0A%0A%20%20%20%20mo.md(rf%22%22%22%0A%20%20%20%20%23%23%20Why%20the%20named%20answers%20fail%0A%0A%20%20%20%20The%20sparklines%20above%20are%20teacher-forced%3A%20the%20model%20is%20shown%20the%20true%20answer%0A%20%20%20%20from%20the%20validation%20set%2C%20and%20we%20watch%20how%20much%20each%20one%20surprises%20it.%0A%20%20%20%20%60lime%20%2B%20black%20%3D%20green%60%20is%20an%20interesting%20case.%0A%0A%20%20%20%20Left%20to%20choose%2C%20this%20seed%20opens%20%60lime%20%2B%20black%60%20with%20%60t%60%2C%20for%20*teal*%2C%20so%20the%0A%20%20%20%20true%20%60g%60%20is%20mildly%20surprising.%20Once%20it%20is%20forced%20onto%20%60g%60%2C%20the%20model%20guesses%0A%20%20%20%20%60r%60%20correctly%2C%20since%20*gray*%20and%20*green*%20share%20the%20prefix%20%60gr%60.%20Then%20the%20true%0A%20%20%20%20%60e%60%20is%20very%20surprising%3A%20on%20the%20%60gr%E2%80%A6%60%20branch%20the%20model%20is%20all%20but%20sure%20the%0A%20%20%20%20word%20is%20*gray*%2C%20but%20%60e%60%20rules%20that%20out.%20The%20spike%20is%20the%20model%20fluently%0A%20%20%20%20spelling%20a%20different%20palette%20name%2C%20then%20being%20surprised%20when%20the%20truth%0A%20%20%20%20arrives.%0A%0A%20%20%20%20*Teal*%20is%20a%20one-channel%20neighbor%20of%20the%20true%20mix%2C%20and%20the%20tall%20spike%20on%20the%0A%20%20%20%20%60a%60%20of%20%60black%60%20hints%20at%20why.%20After%20%60lime%20%2B%20bl%60%20the%20model%20puts%0A%20%20%20%20%7B_p_blue%3A.1%25%7D%20on%20%60u%60%2C%20so%20it%20is%20all%20but%20certain%20the%20second%20operand%20is%20*blue*%2C%0A%20%20%20%20and%20%60lime%20%2B%20blue%20%3D%20teal%60%20is%20an%20equation%20it%20trained%20on.%0A%0A%20%20%20%20When%20it%20sees%20that%20the%20operand%20is%20different%2C%20the%20correction%20barely%20reaches%20the%0A%20%20%20%20answer.%20Going%20from%20the%20%60lime%20%2B%20blue%20%3D%20%60%20prompt%20to%20%60lime%20%2B%20black%20%3D%20%60%20lifts%0A%20%20%20%20*gray*%20by%20a%20factor%20of%20%7B_p(%22lime%20%2B%20black%20%3D%20%22%2C%20%22gray%22)%20%2F%20_p(%22lime%20%2B%20blue%20%3D%20%22%2C%20%22gray%22)%3A.0f%7D%2C%0A%20%20%20%20from%20%7B_p(%22lime%20%2B%20blue%20%3D%20%22%2C%20%22gray%22)%3A.1%25%7D%20to%20%7B_p(%22lime%20%2B%20black%20%3D%20%22%2C%20%22gray%22)%3A.0%25%7D.%0A%20%20%20%20The%20true%20answer%20*green*%20moves%20by%20a%20similar%20factor%20and%20stays%20negligible%2C%20from%0A%20%20%20%20%7B_p(%22lime%20%2B%20blue%20%3D%20%22%2C%20%22green%22)%3A.0e%7D%20to%20%7B_p(%22lime%20%2B%20black%20%3D%20%22%2C%20%22green%22)%3A.0e%7D%2C%0A%20%20%20%20while%20the%20trained%20*teal*%20keeps%20the%20top%20spot%20at%20%7B_p(%22lime%20%2B%20black%20%3D%20%22%2C%20%22teal%22)%3A.0%25%7D.%0A%20%20%20%20So%20the%20operand%20correction%20redistributes%20mass%20among%20wrong%20names%20rather%20than%0A%20%20%20%20finding%20the%20arithmetic.%20The%20model%20does%20learn%20the%20result-form%20rule%2C%20which%20says%0A%20%20%20%20a%20named%20answer%20appears%20iff%20both%20operands%20are%20named.%20The%20difficulty%20is%20choosing%0A%20%20%20%20which%20name%2C%20and%20a%20trained%20neighbor%20seems%20to%20overrule.%0A%0A%20%20%20%20Below%20is%20every%20held-out%20pair%2C%20prompted%20exactly%20as%20in%20the%20%60named_holdout%60%0A%20%20%20%20eval%20set%2C%20with%20one%20column%20per%20seed%20of%20the%20chosen%20architecture.%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%20import%20jax%0A%20%20%20%20import%20jax.numpy%20as%20jnp%0A%0A%20%20%20%20from%20sca.compute.evaluation%20import%20greedy_completions%0A%20%20%20%20from%20sca.compute.model%20import%20load_checkpoint%0A%20%20%20%20from%20sca.data.tokenizer%20import%20CharTokenizer%0A%0A%20%20%20%20arch%20%3D%20pick_arch(metrics)%0A%20%20%20%20_store%20%3D%20project_store()%0A%20%20%20%20_refs%20%3D%20%7Bs%3A%20f%22%7BCKPT_REF%7D%2F%7Blabel(*arch%2C%20s)%7D%22%20for%20s%20in%20SEEDS%7D%0A%20%20%20%20_resolved%20%3D%20_store.get_refs(_refs.values())%0A%20%20%20%20_arts%20%3D%20%7Bs%3A%20a%20for%20s%2C%20r%20in%20_refs.items()%20if%20(a%20%3A%3D%20_resolved%5Br%5D)%20is%20not%20None%7D%0A%20%20%20%20mo.stop(%0A%20%20%20%20%20%20%20%20len(_arts)%20%3C%20len(SEEDS)%2C%0A%20%20%20%20%20%20%20%20mo.md(%22The%20checkpoints%20aren't%20in%20the%20store%20yet%20%E2%80%94%20re-run%20the%20experiment%20to%20publish%20them.%22)%2C%0A%20%20%20%20)%0A%20%20%20%20_models%20%3D%20%7B%7D%0A%20%20%20%20with%20tempfile.TemporaryDirectory()%20as%20_tmp%3A%0A%20%20%20%20%20%20%20%20_store.get_many(%5B(_art%2C%20Path(_tmp)%20%2F%20str(_s)%20%2F%20%22model%22)%20for%20_s%2C%20_art%20in%20_arts.items()%5D)%0A%20%20%20%20%20%20%20%20for%20_s%20in%20_arts%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20_model%2C%20_config%2C%20_%20%3D%20load_checkpoint(Path(_tmp)%20%2F%20str(_s))%0A%20%20%20%20%20%20%20%20%20%20%20%20_models%5B_s%5D%20%3D%20(_model%2C%20CharTokenizer(_config.tokenizer))%0A%0A%20%20%20%20def%20complete(seed%3A%20int%2C%20prompts%3A%20list%5Bstr%5D)%20-%3E%20list%5Bstr%5D%3A%0A%20%20%20%20%20%20%20%20%22%22%22Greedy%20completions%20from%20the%20chosen%20cell%20trained%20with%20*seed*.%22%22%22%0A%20%20%20%20%20%20%20%20model%2C%20tok%20%3D%20_models%5Bseed%5D%0A%20%20%20%20%20%20%20%20return%20greedy_completions(model%2C%20tok%2C%20prompts%2C%2012)%0A%0A%20%20%20%20def%20name_prob(seed%3A%20int%2C%20prompt%3A%20str%2C%20word%3A%20str)%20-%3E%20float%3A%0A%20%20%20%20%20%20%20%20%22%22%22P(word%20%7C%20prompt)%2C%20the%20product%20of%20its%20per-character%20probabilities.%22%22%22%0A%20%20%20%20%20%20%20%20model%2C%20tok%20%3D%20_models%5Bseed%5D%0A%20%20%20%20%20%20%20%20p%20%3D%201.0%0A%20%20%20%20%20%20%20%20for%20i%2C%20ch%20in%20enumerate(word)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20logits%20%3D%20model(jnp.array(tok.encode(%5Bprompt%20%2B%20word%5B%3Ai%5D%5D)%5B0%5D)%5BNone%5D)%5B0%2C%20-1%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20q%20%3D%20jax.nn.softmax(logits)%0A%20%20%20%20%20%20%20%20%20%20%20%20p%20*%3D%20float(q%5Btok.stoi%5Bch%5D%5D)%0A%20%20%20%20%20%20%20%20return%20p%0A%0A%20%20%20%20return%20arch%2C%20complete%2C%20name_prob%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(arch%2C%20complete%2C%20holdout)%3A%0A%20%20%20%20named_holdout_exs%20%3D%20colors.as_named(holdout%2C%20seed%3D2)%20%20%23%20the%20eval%20set%2C%20verbatim%0A%20%20%20%20_by_seed%20%3D%20%7Bs%3A%20complete(s%2C%20%5Bex.prompt%20for%20ex%20in%20named_holdout_exs%5D)%20for%20s%20in%20SEEDS%7D%0A%0A%20%20%20%20_head%20%3D%20(%0A%20%20%20%20%20%20%20%20f%22%3Ctr%3E%3Cth%3Eprompt%3C%2Fth%3E%3Cth%3E%7Bcolors.swatch(None)%7D%20expected%3C%2Fth%3E%22%0A%20%20%20%20%20%20%20%20%2B%20%22%22.join(f%22%3Cth%3E%7Bcolors.swatch(None)%7D%20seed%20%7Bs%7D%3C%2Fth%3E%22%20for%20s%20in%20SEEDS)%0A%20%20%20%20%20%20%20%20%2B%20%22%3C%2Ftr%3E%22%0A%20%20%20%20)%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%7Bex.prompt%7D%3C%2Fcode%3E%3C%2Ftd%3E%3Ctd%3E%7Bcolors.swatch(ex.answer)%7D%3C%2Ftd%3E%22%0A%20%20%20%20%20%20%20%20%2B%20%22%22.join(f%22%3Ctd%3E%7Bcolors.swatch(_by_seed%5Bs%5D%5Bi%5D)%7D%3C%2Ftd%3E%22%20for%20s%20in%20SEEDS)%0A%20%20%20%20%20%20%20%20%2B%20%22%3C%2Ftr%3E%22%0A%20%20%20%20%20%20%20%20for%20i%2C%20ex%20in%20enumerate(named_holdout_exs)%0A%20%20%20%20)%0A%20%20%20%20_w%2C%20_d%20%3D%20arch%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'%0A%20%20%20%20%20%20%20%20f'%3Ctable%20class%3D%22report-table%22%20style%3D%22font-size%3A%200.9em%22%3E%7B_head%7D%7B_rows%7D%3C%2Ftable%3E'%0A%20%20%20%20%20%20%20%20%22%3C%2Fdiv%3E%22%0A%20%20%20%20)%0A%20%20%20%20_caption%20%3D%20mo.md(f%22Greedy%20completions%20of%20the%20%60named_holdout%60%20prompts%2C%20d%7B_w%7D-L%7B_d%7D%2C%20all%20seeds.%22).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%20(named_holdout_exs%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(complete%2C%20holdout%2C%20named_holdout_exs)%3A%0A%20%20%20%20_rng%20%3D%20np.random.default_rng(9)%0A%20%20%20%20_sets%20%3D%20%7B%0A%20%20%20%20%20%20%20%20%22named%22%3A%20named_holdout_exs%2C%0A%20%20%20%20%20%20%20%20%22cross%22%3A%20%5Bcolors.make_example(%22cross%22%2C%20a%2C%20b%2C%20_rng)%20for%20a%2C%20b%20in%20holdout%5D%2C%0A%20%20%20%20%20%20%20%20%22hex%22%3A%20%5Bcolors.make_example(%22hex%22%2C%20a%2C%20b%2C%20_rng)%20for%20a%2C%20b%20in%20holdout%5D%2C%0A%20%20%20%20%7D%0A%20%20%20%20_scores%20%3D%20%7B%7D%0A%20%20%20%20for%20_form%2C%20_exs%20in%20_sets.items()%3A%0A%20%20%20%20%20%20%20%20_got%20%3D%20complete(SEEDS%5B0%5D%2C%20%5Bex.prompt%20for%20ex%20in%20_exs%5D)%0A%20%20%20%20%20%20%20%20_scores%5B_form%5D%20%3D%20sum(g%20%3D%3D%20ex.answer%20for%20g%2C%20ex%20in%20zip(_got%2C%20_exs%2C%20strict%3DTrue))%0A%20%20%20%20_n%20%3D%20len(named_holdout_exs)%0A%0A%20%20%20%20%23%20%22A%20neighbor%20of%20the%20mix%22%20is%20only%20interesting%20against%20how%20many%20neighbors%20there%0A%20%20%20%20%23%20are%3A%20the%2027-color%20palette%20gives%20each%20mix%20four%20to%20six%2C%20out%20of%2027%20names.%0A%20%20%20%20_pal%20%3D%20np.array(list(colors.PALETTE.values()))%0A%20%20%20%20_shell%20%3D%20bl.shell_mask((0%2C%208%2C%2015)%2C%20_pal%2C%20%5Bex.result%20for%20ex%20in%20named_holdout_exs%5D)%0A%20%20%20%20_null%20%3D%20float(_shell.mean())%0A%20%20%20%20_hits%20%3D%20_tot%20%3D%20_agree%20%3D%200%0A%20%20%20%20for%20_i%2C%20_ex%20in%20enumerate(named_holdout_exs)%3A%0A%20%20%20%20%20%20%20%20_guesses%20%3D%20%5Bcomplete(_s%2C%20%5B_ex.prompt%5D)%5B0%5D%20for%20_s%20in%20SEEDS%5D%0A%20%20%20%20%20%20%20%20_agree%20%2B%3D%20len(set(_guesses))%20%3D%3D%201%20and%20_guesses%5B0%5D%20!%3D%20_ex.answer%0A%20%20%20%20%20%20%20%20for%20_g%20in%20_guesses%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20_tot%20%2B%3D%201%0A%20%20%20%20%20%20%20%20%20%20%20%20_hits%20%2B%3D%20_g%20in%20colors.PALETTE%20and%20_shell%5B_i%5D%5Blist(colors.PALETTE).index(_g)%5D%0A%0A%20%20%20%20mo.md(rf%22%22%22%0A%20%20%20%20The%20model%20never%20answers%20these%20in%20hex.%20It%20always%20reaches%20for%20a%20name%2C%20and%0A%20%20%20%20usually%20one%20adjacent%20to%20the%20true%20mix%3A%20%7B_hits%7D%20of%20%7B_tot%7D%20guesses%20land%20in%20the%0A%20%20%20%20mix's%20one-step%20neighborhood%2C%20against%20%7B_null%3A.0%25%7D%20for%20a%20name%20drawn%20uniformly%0A%20%20%20%20from%20the%20palette.%20Sometimes%20the%20name%20is%20an%20echo%20of%20one%20operand%0A%20%20%20%20(%60olive%20%2B%20lavender%20%3D%20lavender%60)%2C%20though%20on%20this%20palette%20an%20operand%20is%20often%20a%0A%20%20%20%20neighbor%20anyway%2C%20so%20that%20part%20is%20weaker%20evidence%20than%20it%20looks.%0A%0A%20%20%20%20The%20seeds%20mostly%20agree%3A%20%7B_agree%7D%20of%20the%20%7B_n%7D%20pairs%20draw%20the%20same%20wrong%20answer%0A%20%20%20%20from%20all%20three.%20Independent%20guessing%20inside%20the%20neighborhood%20would%20produce%0A%20%20%20%20well%20under%20one%20such%20pair%2C%20so%20the%20bias%20is%20systematic%3B%20perhaps%20retrieval%20of%20the%0A%20%20%20%20nearest%20memorized%20named%20equation.%0A%0A%20%20%20%20The%20mixing%20arithmetic%20itself%20is%20fine.%20Prompted%20with%20the%20same%20held-out%20value%0A%20%20%20%20pairs%2C%20seed%20%7BSEEDS%5B0%5D%7D%20solves%20**%7B_scores%5B%22hex%22%5D%7D%2F%7B_n%7D**%20in%20hex%20form%20and%0A%20%20%20%20**%7B_scores%5B%22cross%22%5D%7D%2F%7B_n%7D**%20in%20cross%20form%2C%20against%0A%20%20%20%20**%7B_scores%5B%22named%22%5D%7D%2F%7B_n%7D**%20as%20named%20equations.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(train_pairs)%3A%0A%20%20%20%20_reps%20%3D%20round(N_EXAMPLES%20*%20colors.FORM_WEIGHTS%5B%22named%22%5D%20%2F%20len(train_pairs))%0A%20%20%20%20mo.md(rf%22%22%22%0A%20%20%20%20The%20corpus%20may%20make%20this%20hard%20for%20the%20model.%20Possible%20causes%3A%0A%0A%20%20%20%20-%20Named%20equations%20draw%20on%20only%20%7Blen(train_pairs)%7D%20distinct%20pairs%2C%20so%20each%0A%20%20%20%20%20%20one%20is%20seen%20about%20%7B_reps%7D%20times%20in%20training.%20A%20lookup%20table%20is%20enough%2C%20and%0A%20%20%20%20%20%20the%20model%20may%20build%20one%20(%60named_seen%60%20%E2%89%88%201).%20Once%20the%20loss%20on%20that%20slice%0A%20%20%20%20%20%20reaches%20zero%2C%20nothing%20nudges%20the%20model%20toward%20the%20compositional%20route.%0A%20%20%20%20-%20The%20alias%20dictionary%20runs%20one%20way.%20Alias%20lines%20are%20always%20%60name%20%3D%20hex%60.%0A%20%20%20%20%20%20This%20may%20be%20an%20instance%20of%20the%20*reversal%20curse*%2C%20where%20training%20on%20%60A%20%3D%20B%60%0A%20%20%20%20%20%20doesn't%20teach%20%60B%20%3D%20A%60.%0A%20%20%20%20-%20A%20hex%20answer%20can%20be%20computed%20channel-by-channel%2C%20whereas%20a%20name's%20first%0A%20%20%20%20%20%20character%20depends%20on%20all%20three%20channels%20and%20the%20inverted%20dictionary%20at%20the%0A%20%20%20%20%20%20same%20time.%20The%20probe%20section%20below%20looks%20at%20this%20more.%0A%0A%20%20%20%20A%20few%20corpus%20changes%20might%20help%3A%20reverse%20some%20alias%20lines%20(%60%23f00%20%3D%20red%60)%3B%0A%20%20%20%20add%20named%20operands%20whose%20off-palette%20mix%20forces%20a%20hex%20answer%0A%20%20%20%20(%60red%20%2B%20navy%20%3D%20%23804%60)%2C%20so%20that%20%60name%20%2B%20name%60%20prompts%20have%20to%20engage%20the%0A%20%20%20%20arithmetic%20instead%20of%20the%20lookup%20table%3B%20and%20use%20a%20denser%20named%20palette%2C%20so%0A%20%20%20%20memorization%20is%20harder.%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_%2C%20_d%20%3D%20pick_arch(metrics)%0A%20%20%20%20mo.md(rf%22%22%22%0A%20%20%20%20%23%23%20Where%20color%20is%20represented%0A%0A%20%20%20%20Here%20we%20fit%20the%20probes%20at%20each%20residual-stream%20depth%20(depth%200%20is%20the%0A%20%20%20%20embedding)%20and%20plot%20their%20R%C2%B2%20against%20depth%5B%5Ersquare%5D.%20The%20figure%20has%20one%0A%20%20%20%20panel%20per%20probe%20target%20and%20one%20line%20per%20width.%20We%20test%20only%20the%20deepest%0A%20%20%20%20models%20(L%7B_d%7D)%20and%20show%20the%20mean%20over%20seeds.%0A%0A%20%20%20%20%5B%5Ersquare%5D%3A%20This%20R%C2%B2%20is%20the%20fraction%20of%20the%20target's%20variance%20the%20probe%0A%20%20%20%20recovers%2C%20so%201%20means%20the%20color%20is%20fully%20readable%20from%20the%20stream%20and%200%20means%0A%20%20%20%20it%20is%20not%20there%20linearly.%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_probes%20%3D%20%5B%22operand_rgb%22%2C%20%22result_rgb%22%2C%20%22result_redness%22%5D%0A%0A%20%20%20%20%40themed(%0A%20%20%20%20%20%20%20%20name%3D%22probe-r2%22%2C%0A%20%20%20%20%20%20%20%20alt_text%3D(%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Three%20line%20charts%20of%20probe%20R-squared%20against%20residual-stream%20depth%20for%20the%20four-layer%20models%2C%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%22one%20panel%20per%20probe%20target%3A%20operand%20RGB%2C%20result%20RGB%2C%20and%20result%20redness.%20One%20line%20per%20width%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%22(16%2C%2032%2C%2064%3B%20darker%20is%20wider)%2C%20averaged%20over%20seeds.%20R-squared%20for%20the%20operand%20rises%20within%20the%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%22first%20layers%3B%20the%20result%20targets%20rise%20later%20in%20depth.%22%0A%20%20%20%20%20%20%20%20)%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%203%2C%20figsize%3D(9.8%2C%203.2)%2C%20sharey%3DTrue)%0A%20%20%20%20%20%20%20%20shades%20%3D%20width_shades()%0A%20%20%20%20%20%20%20%20d%20%3D%20max(DEPTHS)%0A%20%20%20%20%20%20%20%20for%20ax%2C%20probe%20in%20zip(axes%2C%20_probes%2C%20strict%3DTrue)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20for%20w%20in%20WIDTHS%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20rows%20%3D%20%5Br%5B%22probe_r2%22%5D%5Bprobe%5D%20for%20r%20in%20metrics%20if%20r%5B%22label%22%5D.startswith(f%22d%7Bw%7D-L%7Bd%7D-%22)%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ax.plot(np.mean(rows%2C%20axis%3D0)%2C%20%22o-%22%2C%20color%3Dshades%5Bw%5D%2C%20label%3Df%22width%20%7Bw%7D%22%2C%20lw%3D2)%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.set(title%3Dprobe.replace(%22_%22%2C%20%22%20%22)%2C%20xlabel%3D%22residual%20depth%22%2C%20ylim%3D(-0.05%2C%201.05))%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.set_xticks(range(max(DEPTHS)%20%2B%201))%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(held-out%20half)%22)%0A%20%20%20%20%20%20%20%20axes%5B0%5D.legend(fontsize%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%20Rising%20R%C2%B2%20for%20the%20*result*%20means%20the%20mix%20becomes%20partly%20readable%20before%20the%0A%20%20%20%20answer%20starts.%20It%20plateaus%20well%20below%20the%20operand's%20R%C2%B2%2C%20though%2C%20even%20in%0A%20%20%20%20cells%20whose%20hex%20accuracy%20is%20perfect.%20Probing%20every%20answer%20position%2C%20per%0A%20%20%20%20channel%2C%20would%20map%20that%20spread-out%20schedule%20(to%20do).%0A%0A%20%20%20%20The%20probes%20read%20the%20residual%20stream%20at%20two%20positions%2C%20marked%20below.%20The%20first%0A%20%20%20%20is%20the%20first%20operand's%20last%20character%2C%20where%20the%20whole%20operand%20has%20been%20read%0A%20%20%20%20in%2C%20so%20its%20value%20can%20be%20represented.%20The%20second%20is%20the%20space%20after%20%60%3D%60%2C%20the%0A%20%20%20%20last%20position%20before%20the%20answer%20begins%2C%20where%20the%20result%20has%20to%20be%20ready.%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%20_rng%20%3D%20np.random.default_rng(7)%0A%20%20%20%20_exs%20%3D%20%5B%0A%20%20%20%20%20%20%20%20colors.make_example(%22named%22%2C%20colors.PALETTE%5B%22red%22%5D%2C%20colors.PALETTE%5B%22blue%22%5D%2C%20_rng)%2C%0A%20%20%20%20%20%20%20%20colors.make_example(%22cross%22%2C%20colors.PALETTE%5B%22orange%22%5D%2C%20(2%2C%2012%2C%207)%2C%20_rng)%2C%0A%20%20%20%20%5D%0A%0A%20%20%20%20def%20_mark(ex)%20-%3E%20str%3A%0A%20%20%20%20%20%20%20%20p%20%3D%20ex.prompt%0A%20%20%20%20%20%20%20%20_i%2C%20_j%20%3D%20len(p.split(%22%20%22)%5B0%5D)%20-%201%2C%20len(p)%20-%201%0A%20%20%20%20%20%20%20%20hl%20%3D%20lambda%20ch%2C%20c%2C%20t%3A%20f'%3Cspan%20style%3D%22background%3A%20%7Bc%7D%3B%20border-radius%3A%202px%22%20title%3D%22%7Bt%7D%22%3E%7Bch%7D%3C%2Fspan%3E'%20%20%23%20noqa%3A%20E731%0A%20%20%20%20%20%20%20%20chars%20%3D%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20hl(c%2C%20%22%23e4572e66%22%2C%20%22operand%20read-out%22)%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20k%20%3D%3D%20_i%0A%20%20%20%20%20%20%20%20%20%20%20%20else%20hl(%22%E2%90%A3%22%2C%20%22%234d9de066%22%2C%20%22result%20read-out%22)%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20k%20%3D%3D%20_j%0A%20%20%20%20%20%20%20%20%20%20%20%20else%20c%0A%20%20%20%20%20%20%20%20%20%20%20%20for%20k%2C%20c%20in%20enumerate(p)%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%20%20return%20%22%22.join(chars)%20%2B%20f'%3Cspan%20style%3D%22opacity%3A%200.55%22%3E%7Bex.answer%7D%3C%2Fspan%3E'%0A%0A%20%20%20%20mo.Html(%0A%20%20%20%20%20%20%20%20figure_html(%0A%20%20%20%20%20%20%20%20%20%20%20%20'%3Cpre%20style%3D%22line-height%3A%202.2%3B%20font-size%3A%201.05em%22%3E'%20%2B%20%22%3Cbr%3E%22.join(_mark(ex)%20for%20ex%20in%20_exs)%20%2B%20%22%3C%2Fpre%3E%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20caption%3D%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cspan%20style%3D%22background%3A%20%23e4572e66%3B%20border-radius%3A%202px%22%3E%26nbsp%3Boperand%26nbsp%3B%3C%2Fspan%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20probes%20read%20the%20first%20operand's%20color%20at%20this%20character%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cspan%20style%3D%22background%3A%20%234d9de066%3B%20border-radius%3A%202px%22%3E%26nbsp%3Bresult%26nbsp%3B%3C%2Fspan%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20probes%20read%20the%20result's%20color%20and%20redness%20at%20the%20space%20just%20before%20the%20answer%20(shown%20as%20%E2%90%A3).%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20The%20dimmed%20answer%20is%20never%20probed.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22%22%22%2C%0A%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)%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%20Do%20seeds%20agree%20on%20where%20*redness*%20points%3F%0A%0A%20%20%20%20For%20each%20pair%20of%20seeds%20trained%20with%20the%20same%20architecture%2C%20we%20take%20their%0A%20%20%20%20fitted%20redness-probe%20directions%20and%20measure%20the%20absolute%20cosine%20similarity%0A%20%20%20%20between%20them%2C%20layer%20by%20layer.%20Two%20random%20directions%20in%20n%20dimensions%20should%0A%20%20%20%20have%20%7Ccos%7C%20%E2%89%88%200.8%2F%E2%88%9An%2C%20drawn%20here%20as%20the%20dashed%20line.%0A%0A%20%20%20%20If%20this%20geometry%20were%20stable%20across%20seeds%2C%20there%20would%20be%20little%20point%20in%0A%20%20%20%20anchoring.%20The%20spread%20we%20see%20is%20part%20of%20why%20we%20want%20to%20pin%20the%20direction%0A%20%20%20%20down%20at%20training%20time.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(weights)%3A%0A%20%20%20%20def%20_redness_cosines(w%3A%20int%2C%20d%3A%20int)%20-%3E%20np.ndarray%3A%0A%20%20%20%20%20%20%20%20%22%22%22Pairwise%20%7Ccos%7C%20between%20seeds'%20redness%20probe%20directions%3A%20(n_pairs%2C%20depth%2B1).%22%22%22%0A%20%20%20%20%20%20%20%20vecs%20%3D%20%5Bweights%5Bf%22%7Blabel(w%2C%20d%2C%20s)%7D%2Fresult_redness%22%5D%5B%3A%2C%20%3A%2C%200%5D%20for%20s%20in%20SEEDS%5D%20%20%23%20(L%2B1%2C%20C)%20each%0A%20%20%20%20%20%20%20%20unit%20%3D%20%5Bv%20%2F%20np.linalg.norm(v%2C%20axis%3D1%2C%20keepdims%3DTrue)%20for%20v%20in%20vecs%5D%0A%20%20%20%20%20%20%20%20return%20np.array(%5Bnp.abs((unit%5Bi%5D%20*%20unit%5Bj%5D).sum(axis%3D1))%20for%20i%20in%20range(3)%20for%20j%20in%20range(i%20%2B%201%2C%203)%5D)%0A%0A%20%20%20%20%40themed(%0A%20%20%20%20%20%20%20%20name%3D%22probe-direction-agreement%22%2C%0A%20%20%20%20%20%20%20%20alt_text%3D(%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Line%20chart%20of%20the%20absolute%20cosine%20similarity%20between%20redness%20probe%20directions%20fitted%20on%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%22different%20seeds%2C%20against%20residual-stream%20depth%2C%20one%20line%20per%20width%20for%20the%20four-layer%20models.%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%22A%20dashed%20horizontal%20line%20marks%20the%20expected%20similarity%20of%20random%20directions%20for%20each%20width.%22%0A%20%20%20%20%20%20%20%20)%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(6.2%2C%203.6))%0A%20%20%20%20%20%20%20%20shades%20%3D%20width_shades()%0A%20%20%20%20%20%20%20%20d%20%3D%20max(DEPTHS)%0A%20%20%20%20%20%20%20%20for%20w%20in%20WIDTHS%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20cos%20%3D%20_redness_cosines(w%2C%20d)%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.plot(cos.mean(axis%3D0)%2C%20%22o-%22%2C%20color%3Dshades%5Bw%5D%2C%20label%3Df%22width%20%7Bw%7D%22%2C%20lw%3D2)%0A%20%20%20%20%20%20%20%20%20%20%20%20ax.axhline(0.8%20%2F%20np.sqrt(w)%2C%20color%3Dshades%5Bw%5D%2C%20lw%3D1%2C%20ls%3D%22--%22%2C%20alpha%3D0.6)%0A%20%20%20%20%20%20%20%20ax.set(xlabel%3D%22residual%20depth%22%2C%20ylabel%3D%22cross-seed%20%7Ccos%7C%20of%20redness%20direction%22%2C%20ylim%3D(0%2C%201))%0A%20%20%20%20%20%20%20%20ax.set_xticks(range(max(DEPTHS)%20%2B%201))%0A%20%20%20%20%20%20%20%20ax.grid(alpha%3D0.3)%0A%20%20%20%20%20%20%20%20ax.legend(fontsize%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_(metrics)%3A%0A%20%20%20%20_best%20%3D%20pick_arch(metrics)%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20f%22%22%22%0A%20%20%20%20%23%23%20Findings%0A%0A%20%20%20%20The%20smallest%20cell%20that%20saturates%20the%20unseen-pair%20eval%20sets%20is%0A%20%20%20%20**width%20%7B_best%5B0%5D%7D%2C%20%7B_best%5B1%5D%7D%20layers**.%20For%20D2.1%2C%20we%20can%20take%20that%0A%20%20%20%20architecture%20as%20the%20baseline%20and%20add%20the%20anchor%2C%20which%20pulls%20sequences%0A%20%20%20%20labeled%20*red-ish*%20(supplied%20as%20sparse%2C%20noisy%20labels)%20toward%20a%20chosen%0A%20%20%20%20direction%20at%20chosen%20layers.%20Then%20we%20can%20re-run%20these%20measurements%20and%0A%20%20%20%20compare%20the%20anchored%20and%20baseline%20versions.%0A%0A%20%20%20%20The%20held-out%20named%20pairs%20sit%20at%20zero%20validation%20accuracy%2C%20so%20that%20set%20gives%0A%20%20%20%20the%20anchored%20runs%20no%20headroom%20and%20probably%20can't%20help%20us%20spot%20any%20unintended%0A%20%20%20%20degradation.%0A%20%20%20%20%22%22%22%0A%20%20%20%20)%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
3a1d30566ade21b3ace30f480d5e08a2