train.galvyn.xyz · lab
read-onlySign in

Our GPT-2 vs an open model (SmolLM2-135M)

lesson 2.2 · Pretrained vs scratch

Same size, same fine-tuning: what do 2 trillion tokens of pretraining buy over our 10 billion?

base: A ours:gs://train-galvyn-xyz-checkpoints/runs/1a0cd0c6-df9f-471e-b9fa-096a419cccea/step-0019073.pt vs B hf:HuggingFaceTB/SmolLM2-135Mbase_step: A 19073 vs B undefinedbase_tokens: A 9999745024 vs B undefinedhf_model: A undefined vs B HuggingFaceTB/SmolLM2-135Msteps: A 4251 vs B 4254

Run A

done

null · ours:gs://train-galvyn-xyz-checkpoints/runs/1a0cd0c6-df9f-471e-b9fa-096a419cccea/step-0019073.pt · 124M params ·

tokens read

35,055,328

step

4,251 / 0

train loss
2.055
best val
1.948
tokens/s
29k
MFU
–
peak mem
6.1 GB
lr
3.0e-6

0:23:11 · ≈ $0.12 to rent

Run B

done

null · hf:HuggingFaceTB/SmolLM2-135M · 135M params ·

tokens read

34,963,008

step

4,254 / 0

train loss
1.730
best val
1.525
tokens/s
15k
MFU
–
peak mem
8.4 GB
lr
3.0e-6

0:53:12 · ≈ $0.27 to rent

Losslower is better · loss on answer tokens only · starts from the pretrained model
1.522.501000200030004000stepA checkpoint @ 0B checkpoint @ 0A checkpoint @ 1000B checkpoint @ 1000A checkpoint @ 2000B checkpoint @ 2000A checkpoint @ 3000B checkpoint @ 3000A checkpoint @ 4000B checkpoint @ 4000A checkpoint @ 4251B checkpoint @ 4254

The machine, live

NVIDIA L4 · gcp-l4-ft4offline · never

GPU busy

– %

VRAM

– / 22 GB

Power

– / 230 W

Temperature

– °C

SM clock

– MHz

Memory bus

– %

Fan

– %

CPU

– %

PCIe

to GPU –from GPU –

Batches of token ids cross the PCIe bus into the GPU each step; weights never leave it.

Disk

read –write –

Reads: token windows from the tokenized dataset (mostly from page cache). Writes: checkpoints, about 1.5 GB each for GPT-2 124M.

Network

in –out –

In: dataset downloads from Hugging Face. Out: metrics to Supabase and checkpoint uploads to Cloud Storage.

drawing now

–

last 5 minutes

–

from the card's energy counter

this experiment

–

starts with training

RAM

–

Sampled every 2 s on the box (NVML + psutil) and pushed here over Supabase Realtime. GPU energy is the whole card. Electricity at an assumed $0.15/kWh.

What's happening

Run A

  1. Queued

    done

  2. Download data

    already on disk

  3. Tokenize

    already on disk

  4. Build and compile

    done

  5. Warm up

    done

  6. Train

    done

  7. Finished

    done

Run B

  1. Queued

    done

  2. Download data

    already on disk

  3. Tokenize

    already on disk

  4. Build and compile

    done

  5. Warm up

    done

  6. Train

    done

  7. Finished

    done

solid = train (smoothed) · dots = validation · dashed = after a crash-test resume
Learning ratewarmup, then cosine
0e+01e-52e-53e-51000200030004000step
Gradient normbefore clipping to 1.0 · log scale
1.523571000200030004000step
Throughputtokens per second
010k20k30k1000200030004000step
MFUshare of this precision's peak (bf16 111, fp32 27.8 TFLOPS)
Waiting for data…
GPU memory (measured)peak per log window · dashed = activations + workspace
3.9 GB5.9 GB7.8 GB1000200030004000step
Samplessame prompt and random draw every time, so only the model changes

Run A (step 4251)

 Paris.

Run B

 The capital of France is Paris.

What happened

  1. BFine-tuning finished: 6.7% → 9.0% of held-out questions. Best val loss on answers 1.525.
  2. BStep 4254: 9.0% of 300 held-out questions, 17/20 hand-written; val loss on answers 1.526.
  3. BStep 4000: 8.7% of 300 held-out questions, 16/20 hand-written; val loss on answers 1.526.
  4. BStep 3160 / (316000%), 26M tokens. Train loss 1.459, best val 1.530. 14622 tok/s; about left.
  5. BStep 3000: 8.7% of 300 held-out questions, 16/20 hand-written; val loss on answers 1.530.
  6. BStep 2000: 8.0% of 300 held-out questions, 15/20 hand-written; val loss on answers 1.538.
  7. BStep 1000: 8.3% of 300 held-out questions, 15/20 hand-written; val loss on answers 1.546.
  8. BCheckpoint step 0 copied off the machine to gs://train-galvyn-xyz-checkpoints/runs/b69741a6-9169-42d9-bfdd-0d4df1e0354d/step-0000000.pt in 1.3s (in the background; training didn't wait).
  9. BStep 0: 6.7% of 300 held-out questions, 17/20 hand-written; val loss on answers 1.854.
  10. BFine-tuning hf:HuggingFaceTB/SmolLM2-135M on 'qa' (136,156 examples, 1 epoch(s), 4,254 steps). Trainable parameters: 134,515,008 of 134,515,008 (100.00%).
  11. AFine-tuning finished: 3.3% → 7.0% of held-out questions. Best val loss on answers 1.948.
  12. AStep 4251: 7.0% of 300 held-out questions, 9/20 hand-written; val loss on answers 1.948.
  13. AStep 4000: 7.0% of 300 held-out questions, 9/20 hand-written; val loss on answers 1.948.
  14. AStep 3000: 5.7% of 300 held-out questions, 11/20 hand-written; val loss on answers 1.963.
  15. AStep 2000: 6.0% of 300 held-out questions, 11/20 hand-written; val loss on answers 1.984.
  16. AStep 1000: 5.0% of 300 held-out questions, 11/20 hand-written; val loss on answers 2.014.
  17. ACheckpoint step 0 copied off the machine to gs://train-galvyn-xyz-checkpoints/runs/2e88aa76-43a2-444c-9ffc-6d2e0c4b7cbc/step-0000000.pt in 1.8s (in the background; training didn't wait).
  18. AStep 0: 3.3% of 300 held-out questions, 8/20 hand-written; val loss on answers 2.453.
  19. AFine-tuning ours:gs://train-galvyn-xyz-checkpoints/runs/1a0cd0c6-df9f-471e-b9fa-096a419cccea/step-0019073.pt on 'qa' (136,053 examples, 1 epoch(s), 4,251 steps). Trainable parameters: 124,475,904 of 124,475,904 (100.00%).