You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"This notebook runs a **pinned upstream nanochat d12** baseline suitable for RG optimizer comparisons.\n",
10
+
"\n",
11
+
"nanochat uses depth 12 as its reference/tuning scale. At d12, upstream chooses a 768-wide transformer and transfers the tuned optimization recipe using its scaling-law / μP-style rules. We preserve the upstream architecture, initialization, separate embedding/unembedding/scalar/matrix learning rates, hybrid AdamW+Muon optimizer, automatic token horizon and batch size, LR/momentum/weight-decay schedules, BOS-aligned packing, and tokenizer pipeline.\n",
12
+
"\n",
13
+
"Three independent seeds are run. The RG wrapper pins nanochat commit `92d63d4e8bb4df75c3b71618f31ddde2378b2bcd` and only changes the upstream hard-coded seed 42 to read `NANOCHAT_SEED`; it does not replace nanochat training logic.\n"
14
+
]
15
+
},
16
+
{
17
+
"cell_type": "code",
18
+
"execution_count": null,
19
+
"metadata": {},
20
+
"outputs": [],
21
+
"source": [
22
+
"from pathlib import Path\n",
23
+
"import os, sys\n",
24
+
"import pandas as pd\n",
25
+
"\n",
26
+
"ROOT = None\n",
27
+
"for path in [Path.cwd(), *Path.cwd().parents]:\n",
28
+
" candidate = path / 'baseline'\n",
29
+
" if (candidate / 'rg_baselines').is_dir():\n",
30
+
" ROOT = candidate\n",
31
+
" break\n",
32
+
" if (path / 'rg_baselines').is_dir():\n",
33
+
" ROOT = path\n",
34
+
" break\n",
35
+
"if ROOT is None:\n",
36
+
" raise RuntimeError('Run from a clone of CalculatedContent/rg_optimizers.')\n",
"## 1. Pin nanochat and create its environment\n",
66
+
"\n",
67
+
"The checkout is detached at the audited commit. nanochat's own `uv` environment and dependency configuration are used.\n"
68
+
]
69
+
},
70
+
{
71
+
"cell_type": "code",
72
+
"execution_count": null,
73
+
"metadata": {},
74
+
"outputs": [],
75
+
"source": [
76
+
"CHECKOUT = ensure_checkout(CHECKOUT)\n",
77
+
"ensure_environment(CHECKOUT, gpu=True)\n",
78
+
"print('nanochat checkout:', CHECKOUT)\n"
79
+
]
80
+
},
81
+
{
82
+
"cell_type": "markdown",
83
+
"metadata": {},
84
+
"source": [
85
+
"## 2. Prepare upstream data and tokenizer\n",
86
+
"\n",
87
+
"This follows nanochat's miniseries setup: 1000 dataset shards and a 32,768-token tokenizer trained from up to 2B characters. Run once; later replicates reuse the cache.\n"
88
+
]
89
+
},
90
+
{
91
+
"cell_type": "code",
92
+
"execution_count": null,
93
+
"metadata": {},
94
+
"outputs": [],
95
+
"source": [
96
+
"prepare_data(CHECKOUT, CACHE, CONFIG)\n",
97
+
"print('nanochat cache:', CACHE)\n"
98
+
]
99
+
},
100
+
{
101
+
"cell_type": "markdown",
102
+
"metadata": {},
103
+
"source": [
104
+
"## 3. Run three d12 reference replicates\n",
105
+
"\n",
106
+
"These are full reference runs, not smoke tests. Upstream nanochat computes the training horizon from 12 tokens per scaling parameter, auto-computes total token batch size, and applies its internal depth/batch LR and weight-decay scaling. Checkpoints and validation are emitted every 250 steps; CORE is evaluated at the final step.\n"
"WeightWatcher runs after training so spectral diagnostics do not contaminate timed baseline performance. Every saved checkpoint is analyzed with `ERG=True, randomize=True`; all returned columns are retained, including alpha, randomized correlation-trap fields, and ERG metrics when supplied by WeightWatcher.\n"
"Do not silently update the nanochat commit in an optimizer comparison. A new upstream commit constitutes a new baseline version. The persisted logs, checkpoints, configuration snapshots, training/validation metrics, CORE score, and WeightWatcher diagnostics define the reference control.\n"
0 commit comments