train.galvyn.xyz · lab
read-onlySign in

GPT-2 tokens vs raw bytes

lesson 1.5 · Tokens vs bytes

Same web text, same model: what changes when it reads bytes instead of GPT-2 tokens?

dataset: A fineweb_edu vs B fineweb_edu_bytes

Run A

done

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

tokens read

16,384,000

step

2,000 / 2,000

train loss
5.325
best val
5.300
tokens/s
23k
MFU
3.9%
peak mem
6.4 GB
lr
1.0e-4

0:13:53 · 0.016 kWh ≈ <$0.01 power · ≈ $0.07 to rent

Run B

done

fineweb_edu_bytes · 6L·384d · 11M params · bf16

tokens read

16,384,000

step

2,000 / 2,000

train loss
1.460
best val
1.400
tokens/s
66k
MFU
4.3%
peak mem
0.9 GB
lr
1.0e-4

0:04:18 · 0.005 kWh ≈ <$0.01 power · ≈ $0.02 to rent

Losslower is better · starts near ln(vocab)
510500100015002000stepB checkpoint @ 50A checkpoint @ 50A checkpoint @ 100B checkpoint @ 100A checkpoint @ 250B checkpoint @ 250A checkpoint @ 500B checkpoint @ 500B checkpoint @ 750A checkpoint @ 750B checkpoint @ 1000A checkpoint @ 1000B checkpoint @ 1250A checkpoint @ 1250B checkpoint @ 1500A checkpoint @ 1500B checkpoint @ 1750A checkpoint @ 1750A checkpoint @ 2000B checkpoint @ 2000

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.021 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 · Losses aren't comparable as-is: one GPT-2 token covers several bytes of English text, so divide A's loss by its bytes per token to get loss per byte. With the same step budget A also reads several times more text. Compare samples: B has to learn spelling before it can learn words.

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+05e-41e-3500100015002000step
Gradient normbefore clipping to 1.0 · log scale
110500100015002000step
Throughputtokens per second
0100k200k300k500100015002000step
MFUshare of this precision's peak (bf16 111, fp32 27.8 TFLOPS)
0.0%10.0%20.0%500100015002000step
GPU memory (measured)peak per log window · dashed = activations + workspace
2.0 GB3.9 GB5.9 GB500100015002000step
Does it know? Fact probesP(right word) / P(right + wrong): 0.5 = no idea, 1 = sure and right
0.350.40.45500100015002000step
The questions
arithmeticA 0.49B –
iceA 0.64B –
oceanA 0.54B –
orbitA 0.71B –
parisA 0.56B –
planetA 0.27B –
skyA 0.68B –
waterA 0.42B –
whaleA 0.03B –

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 the most important part of the future. This can also be the most important part of the water, so the energy is necessary for our body, and it’s important to help you will be to keep your body off. You’re not only interested in making sure to find some of these reasons to help your body and the best needed to get rid of your body. You can’t see to get you on the energy, but also that’s not yet important. This is when you do not know with it.
The new way to make your body to take your first step. You’re not trying to do with your body, and you will try it to put on to the heart and heart of your body up in a side of the body. It will always be sure to do with your body and make you ready for your body.
It’s a good way to do not know that you need to do it. A more severe

Run B

Water is an extinguished to make and the primarily boost. Sometimes drink a protection not the forevers have more alternative in the energy and numerous conductions to be able to be to sure than the capacity 

What happened

  1. AFinished 2000 steps. Best val loss 5.300.
  2. ACheckpoint at step 2000: 360.9 MB (weights, AdamW state, schedule position, RNG states) in 1.61s.
  3. AStep 2000: val 5.300, train 5.318 (gap -0.018).
  4. AStep 1800: val 5.362, train 5.304 (gap +0.057).
  5. ACheckpoint at step 1750: 360.9 MB (weights, AdamW state, schedule position, RNG states) in 2.69s.
  6. AStep 1600: val 5.435, train 5.367 (gap +0.068).
  7. ACheckpoint at step 1500: 360.9 MB (weights, AdamW state, schedule position, RNG states) in 1.54s.
  8. AStep 1400: val 5.462, train 5.411 (gap +0.050).
  9. ACheckpoint at step 1250: 360.9 MB (weights, AdamW state, schedule position, RNG states) in 1.62s.
  10. AStep 1200: val 5.596, train 5.556 (gap +0.040).
  11. ACheckpoint at step 1000: 360.9 MB (weights, AdamW state, schedule position, RNG states) in 1.55s.
  12. AStep 1000: val 5.673, train 5.627 (gap +0.046).
  13. AStep 800: val 5.782, train 5.786 (gap -0.004).
  14. ACheckpoint at step 750: 360.9 MB (weights, AdamW state, schedule position, RNG states) in 1.54s.
  15. AStep 600: val 5.975, train 5.990 (gap -0.015).
  16. ACheckpoint at step 500: 360.9 MB (weights, AdamW state, schedule position, RNG states) in 1.56s.
  17. BFinished 2000 steps. Best val loss 1.400.
  18. BCheckpoint at step 2000: 130.2 MB (weights, AdamW state, schedule position, RNG states) in 0.49s.
  19. BStep 2000: val 1.400, train 1.386 (gap +0.014).
  20. BStep 1800: val 1.411, train 1.385 (gap +0.026).
  21. BCheckpoint at step 1750: 130.2 MB (weights, AdamW state, schedule position, RNG states) in 0.48s.
  22. AStep 400: val 6.265, train 6.193 (gap +0.072).
  23. BStep 1600: val 1.421, train 1.408 (gap +0.013).
  24. BCheckpoint at step 1500: 130.2 MB (weights, AdamW state, schedule position, RNG states) in 0.50s.
  25. BStep 1400: val 1.465, train 1.448 (gap +0.017).
  26. BCheckpoint at step 1250: 130.2 MB (weights, AdamW state, schedule position, RNG states) in 0.56s.
  27. BStep 1200: val 1.487, train 1.488 (gap -0.001).
  28. ACheckpoint at step 250: 360.9 MB (weights, AdamW state, schedule position, RNG states) in 1.55s.
  29. BCheckpoint at step 1000: 130.2 MB (weights, AdamW state, schedule position, RNG states) in 0.55s.
  30. BStep 1000: val 1.563, train 1.551 (gap +0.012).
  31. AStep 200: val 6.571, train 6.549 (gap +0.022).
  32. BStep 800: val 1.637, train 1.631 (gap +0.005).
  33. BCheckpoint at step 750: 130.2 MB (weights, AdamW state, schedule position, RNG states) in 0.49s.
  34. BStep 600: val 1.746, train 1.739 (gap +0.007).
  35. BCheckpoint at step 500: 130.2 MB (weights, AdamW state, schedule position, RNG states) in 0.56s.
  36. ACheckpoint at step 100: 360.9 MB (weights, AdamW state, schedule position, RNG states) in 1.57s.
  37. BStep 400: val 1.945, train 1.947 (gap -0.001).
  38. BCheckpoint at step 250: 130.2 MB (weights, AdamW state, schedule position, RNG states) in 1.57s.
  39. ACheckpoint at step 50: 360.9 MB (weights, AdamW state, schedule position, RNG states) in 1.85s.
  40. BStep 200: val 2.466, train 2.462 (gap +0.004).
  41. BCheckpoint at step 100: 130.2 MB (weights, AdamW state, schedule position, RNG states) in 0.49s.
  42. ACheckpoint step 0 copied off the machine to gs://train-galvyn-xyz-checkpoints/runs/b652b55a-b875-4458-ada8-87780502967b/step-0000000.pt in 1.1s (in the background; training didn't wait).
  43. ACheckpoint at step 0: 120.3 MB (weights, AdamW state, schedule position, RNG states) in 1.51s.
  44. BCheckpoint at step 50: 130.2 MB (weights, AdamW state, schedule position, RNG states) in 1.16s.
  45. AExpected loss before training ≈ ln(vocab) = 10.83.
  46. ATraining 30.06M params on fineweb_edu for 2000 steps (bf16, batch 32×1, ctx 256).
  47. BCheckpoint step 0 copied off the machine to gs://train-galvyn-xyz-checkpoints/runs/98d90ac3-ec3c-416b-bd6c-8ae0a2a6e9cc/step-0000000.pt in 0.5s (in the background; training didn't wait).
  48. BCheckpoint at step 0: 43.4 MB (weights, AdamW state, schedule position, RNG states) in 0.15s.
  49. BExpected loss before training ≈ ln(vocab) = 5.55.
  50. BTraining 10.84M params on fineweb_edu_bytes for 2000 steps (bf16, batch 32×1, ctx 256).