A Rough Idea LLM Explorables/How a Model Gets Made
Workshops

How a Model Gets Made Download PDF slides

A model’s behavior comes from how it was made. Its makers decided what text it was trained on, which vocabulary it has, how it learns and for how long. Those decisions are design decisions, and this page puts four of them in your hands.

A high-level walk through the basic three-step pipeline. This is enough to understand where a model’s behavior comes from, not enough to build a model.

How one session runs

Esc to close
Workflow of one autoresearch session, with what each box saves and where You choose a dataset, a tokenizer and the lengths; the session starts a record holding the starter script. The first three runs train the starter script unchanged: the baseline, and a measure of the noise. Each run trains a new model for a fixed time and scores it. If the result is better than the best so far, the agent keeps the change; if it is not, or the run crashed, the agent undoes it. With 20 minutes or more left, the agent changes one thing in the best version of the script and trains again; otherwise the session ends, and you read the results and start the next session. Start YOU CHOOSE the dataset the tokenizer the session's length each run's length THE SESSION BEGINS WITH RECORD a new folder the starter script, its first version a pointer to the best version: for now, this one no runs, no score yet the agent's instructions program.md fixed for the session first runs: the baseline, 3 times THE RECORD the session's folder sessions/<name>/ every version of train.py versions/ one entry for every run: its score, keep, discard or crash, what was tried, and its sample stories runs/ a pointer to the best version best.json every RECORD tag in the diagram adds to this folder SESSION If the agent stops early, the session runner, a small program, restarts the agent. Train a new language model a small GPT, from scratch the model's weights change with each batch: a step the model reads on through the data: one full pass is an epoch, and writes sample stories at set moments during training SAVES RECORD this run's train.py versions/<id>.py LAPTOP the model's weights checkpoint_pre_eval.pt the run crashed Score the model val_bpb how surprised the model is by text kept out of training: a fixed test; lower is better SAVES RECORD the run's entry: the score and the sample stories Better than the best so far? yes no Keep the change a new best so far SAVES RECORD the decision: keep, and what was tried RECORD the pointer moves to this version best.json LAPTOP a copy of the model, to try later checkpoints/<run>.pt Undo the change the best is unchanged SAVES RECORD the decision: discard, or crash, and what was tried LAPTOP train.py back to the best version the tried version stays in the record model not kept 20 min or more left in the session? yes no Change the script: train.py start from the best version and change one thing: the next idea SAVES LAPTOP train.py, with the change the record stores this version when the run starts training Session ends at the end of the session YOU, BETWEEN SESSIONS Read the results, share the session's folder, and choose what to run next. you start the next session

Three stages of training a language model

Esc to close