Problem
Most LLM work starts from someone else’s checkpoint. For a graduate deep learning course (COMP 6970), we wanted to see every stage happen on a model small enough to train on one Colab GPU: build the tokenizer, pretrain from random weights, instruction-tune, and then measure what fine-tuning actually changed inside the model.
Pipeline
| Stage | What we did |
|---|---|
| Tokenizer | 8,000-token BPE tokenizer trained with SentencePiece on Penn Treebank (5.9M characters to 1.3M tokens) |
| Pretraining | 5.2M-parameter GPT-2-style model (4 layers, 4 heads, 256-dim embeddings, 128-token context) trained from scratch on next-token prediction for 3,000 steps |
| Instruction tuning | Supervised fine-tuning on a sample of Dolly-15k, with loss on response tokens only (prompt tokens masked out) |
| Ablation | 200 vs 2,000 instruction examples |
| Decoding | Greedy decoding vs a hand-written top-p sampler, on four checkpoints |
| Representations | Embedding neighbors, contextual word vectors and forgetting, before and after fine-tuning |

Results
| Checkpoint | Validation perplexity |
|---|---|
| Random initialization | 5,411 (Penn Treebank) |
| After pretraining | 178 (Penn Treebank) |
| After SFT on 200 examples | 205 (Dolly) |
| After SFT on 2,000 examples | 94 (Dolly) |
Ten times more instruction data cut fine-tuning perplexity by more than half. The 200-example run also overfit: its validation perplexity bottomed out at 195 in epoch 5 and rose after that while training loss kept falling.
What fine-tuning changed
- Forgetting. Penn Treebank perplexity rose from 179 to 1,157 after fine-tuning. Training on Dolly largely overwrote the Wall Street Journal patterns from pretraining.
- Word senses pulled apart. The cosine similarity between “bank” in a sentence about depositing money and “bank” in a sentence about a river dropped from 0.73 to 0.55, even though neither sentence is in the fine-tuning data.
- Embeddings stayed sensible. Nearest neighbors held up: bank to banks, loan, banking; money to funds, investment, assets.
- Decoding. Greedy decoding collapsed into repeating one token at every checkpoint. Top-p sampling gave varied text, and after 2,000 examples, bits of sentence structure appeared.
What I’d do next
- Train the tokenizer on both datasets. Penn Treebank is all lowercase, so capital letters in Dolly fall back to the unknown token.
- Add an end-of-sequence token to the fine-tuning examples so the model learns when to stop.
- Mix some pretraining data into fine-tuning and measure how much of the forgetting it prevents.