train.galvyn.xyz · lab
read-onlySign in

Overfit one batch

lesson 1.1 · Overfit one batch

Can the model memorise a single batch? (If it can't, the training loop is broken.)

overfit_batch: A true vs B false

Run A

done

fineweb_edu · 6L·384d · 30M params · bf16

tokens read

4,096,000

step

500 / 500

train loss
0.000
best val
8.841
tokens/s
22k
MFU
3.7%
peak mem
6.4 GB
lr
3.0e-4

0:05:09 · 0.006 kWh ≈ <$0.01 power · ≈ $0.03 to rent

Run B

done

fineweb_edu · 6L·384d · 30M params · bf16

tokens read

4,096,000

step

500 / 500

train loss
6.057
best val
6.081
tokens/s
22k
MFU
3.6%
peak mem
6.4 GB
lr
3.0e-4

0:05:09 · 0.006 kWh ≈ <$0.01 power · ≈ $0.03 to rent

Losslower is better · starts near ln(vocab)
0510100200300400500stepA checkpoint @ 50B checkpoint @ 50B checkpoint @ 100A checkpoint @ 100B checkpoint @ 250A checkpoint @ 250A checkpoint @ 500B checkpoint @ 500

The machine, live

NVIDIA L4 · gcp-l4-laboffline · just now

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

0.012 kWh

≈ <$0.01 of electricity

RAM

–

of 31.3 GB in WSL

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

What to watch · A's train loss should head to near zero: the first sanity check of any training loop. Its val loss should rise at the same time, because memorising one batch teaches nothing general. B trains normally for comparison.

Run A

  1. Queued

    done

  2. Download data

    done

  3. Tokenize

    done

  4. Build and compile

    done

  5. Warm up

    done

  6. Train

    done

  7. Finished

    done

Run B

  1. Queued

    done

  2. Download data

    done

  3. Tokenize

    done

  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-32e-33e-3100200300400500step
Gradient normbefore clipping to 1.0 · log scale
1.0e-30.010.1110100200300400500step
Throughputtokens per second
500010k15k20k100200300400500step
MFUshare of this precision's peak (bf16 111, fp32 27.8 TFLOPS)
1.0%2.0%3.0%100200300400500step
GPU memory (measured)peak per log window · dashed = activations + workspace
5.9 GB6.3 GB100200300400500step
Does it know? Fact probesP(right word) / P(right + wrong): 0.5 = no idea, 1 = sure and right
0.40.5100200300400500step
The questions
arithmeticA 0.27B 0.51
iceA 0.14B 0.92
oceanA 0.71B 0.68
orbitA 1.00B 0.78
parisA 0.03B 0.35
planetA 0.35B 0.25
skyA 0.27B 0.54
waterA 0.87B 0.09
whaleA 0.35B 0.00

Prompts include "Q: Is water a liquid at room temperature? A:" (Yes vs No), "The capital of France is" (Paris vs London) and "The largest planet in our solar system is" (Jupiter vs Mars). Full list: trainer/src/galtrain/train.py.

Samplessame prompt and random draw every time, so only the model changes

Run A

Water is with it� air all away for our environment.
People can make it to within his finger seven times before the most important political management of the postane to eat.
In sediment.
The study also found that state, and entrails; and they threw cedar-wood, and hyssop, Research, Table Mountain
In March 2015 the Peninsula burnt. The biggest veld fire since 2000 raged across Table Mountain National Park. People lost homes and businesses. Bees Marais, one of the country’s top helicopter rescue pilots, tragically lost his life in the line of duty while fighting fire at Cape Point. The blaze and the acrid smoke cloyed the air all over Cape Town, turning the sky scarlet and orange as the sun went down each day.
by Zoë Poulsen - Cape Town Botanist | Mar 3, 2015 | Cape Floristic Region, Cape Peninsula, Conservation, Ecology, Fire, Fynbos, Geophytes

Run B

Water is the other factors called a few people. This can need to the body for the main system that can develop the health system.
The case of any kind of the results of the first place of the number of the body can result of a particular way or another. For example, the most important to be the condition that the risk of the development of the body of the problem of your baby's.
There are to get in the patient is an individual is that of the condition.
This is in which can be a lot of the risk of symptoms of a simple. If you can be aware of your symptoms that your body.
You can need to be done.
Here has a child has been a child to do the same time? You may be in a result in your child with a lot of these symptoms.
What is the most of the brain is to treat the children.
This is a good way to have been able to be the children.
In this is the

What happened

  1. BFinished 500 steps. Best val loss 6.081.
  2. AFinished 500 steps. Best val loss 8.841.
  3. ACheckpoint at step 500: 360.9 MB (weights, AdamW state, schedule position, RNG states) in 2.49s.
  4. BCheckpoint at step 500: 360.9 MB (weights, AdamW state, schedule position, RNG states) in 2.58s.
  5. AStep 500: val 13.352, train 0.000 (gap +13.351).
  6. BStep 500: val 6.081, train 6.036 (gap +0.045).
  7. AStep 450: val 13.096, train 0.000 (gap +13.096).
  8. BStep 450: val 6.116, train 6.082 (gap +0.034).
  9. AStep 400: val 12.855, train 0.001 (gap +12.854).
  10. BStep 400: val 6.211, train 6.140 (gap +0.071).
  11. AStep 350: val 12.269, train 0.001 (gap +12.267).
  12. BStep 350: val 6.277, train 6.257 (gap +0.020).
  13. AStep 300: val 14.136, train 0.000 (gap +14.135).
  14. BStep 300: val 6.372, train 6.316 (gap +0.056).
  15. ACheckpoint at step 250: 360.9 MB (weights, AdamW state, schedule position, RNG states) in 2.55s.
  16. BCheckpoint at step 250: 360.9 MB (weights, AdamW state, schedule position, RNG states) in 2.62s.
  17. AStep 250: val 13.636, train 0.000 (gap +13.636).
  18. BStep 250: val 6.512, train 6.408 (gap +0.103).
  19. AStep 200: val 12.982, train 0.000 (gap +12.982).
  20. BStep 200: val 6.599, train 6.578 (gap +0.021).
  21. AStep 150: val 12.603, train 0.001 (gap +12.602).
  22. BStep 150: val 6.728, train 6.700 (gap +0.028).
  23. ACheckpoint at step 100: 360.9 MB (weights, AdamW state, schedule position, RNG states) in 2.41s.
  24. BCheckpoint at step 100: 360.9 MB (weights, AdamW state, schedule position, RNG states) in 2.59s.
  25. AStep 100: val 11.832, train 0.001 (gap +11.831).
  26. BStep 100: val 6.950, train 6.936 (gap +0.014).
  27. BCheckpoint at step 50: 360.9 MB (weights, AdamW state, schedule position, RNG states) in 2.61s.
  28. ACheckpoint at step 50: 360.9 MB (weights, AdamW state, schedule position, RNG states) in 2.58s.
  29. AStep 50: val 8.841, train 2.478 (gap +6.363).
  30. BStep 50: val 7.304, train 7.275 (gap +0.029).
  31. BCheckpoint step 0 copied off the machine to gs://train-galvyn-xyz-checkpoints/runs/d5a01448-3e4a-4462-8100-3bfb2cd4a236/step-0000000.pt in 1.1s (in the background; training didn't wait).
  32. ACheckpoint step 0 copied off the machine to gs://train-galvyn-xyz-checkpoints/runs/d15c2887-11b4-48c9-8407-ee65790c0fbd/step-0000000.pt in 1.1s (in the background; training didn't wait).
  33. ACheckpoint at step 0: 120.3 MB (weights, AdamW state, schedule position, RNG states) in 1.46s.
  34. BCheckpoint at step 0: 120.3 MB (weights, AdamW state, schedule position, RNG states) in 1.54s.
  35. AOverfit-one-batch is on: every step sees the same batch. Train loss should go to ~0 while val gets worse.
  36. BExpected loss before training ≈ ln(vocab) = 10.83.
  37. AExpected loss before training ≈ ln(vocab) = 10.83.
  38. BTraining 30.06M params on fineweb_edu for 500 steps (bf16, batch 32×1, ctx 256).
  39. ATraining 30.06M params on fineweb_edu for 500 steps (bf16, batch 32×1, ctx 256).