Loading…
Loading…
A GPT-2 small (124M parameters) language model that I trained from scratch, following Andrej Karpathy's "Let's reproduce GPT-2 (124M)" video. This is a base model: it only predicts the next token. It is not instruction-tuned and has no safety tuning.
| Metric | Value |
|---|---|
| Validation loss (FineWeb-Edu val shard) | 2.9511 |
| HellaSwag, acc_norm (all 10,042 validation examples) | 32.84% |
| OpenAI GPT-2 124M, HellaSwag (reference) | 29.55% |
The comparison with OpenAI's GPT-2 is not like-for-like: this model was trained on FineWeb-Edu (educational web text), OpenAI's on a different data mix. One standard error on HellaSwag at this accuracy is about +/- 0.47 points.
Both models were run through the same EleutherAI lm-evaluation-harness code, zero-shot, in float32. Accuracies are in % with one standard error (±); perplexities are lower-is-better.
| Benchmark | This model | OpenAI GPT-2 124M |
|---|---|---|
| HellaSwag (acc_norm) | 34.60 ± 0.47 | 31.14 ± 0.46 |
| ARC-Easy (acc_norm) | 49.79 ± 1.03 | 39.48 ± 1.00 |
| ARC-Challenge (acc_norm) | 26.79 ± 1.29 | 22.70 ± 1.22 |
| PIQA (acc_norm) | 62.73 ± 1.13 | 62.51 ± 1.13 |
| WinoGrande (acc) | 51.46 ± 1.40 | 51.62 ± 1.40 |
| OpenBookQA (acc_norm) | 29.40 ± 2.04 | 27.20 ± 1.99 |
| SciQ (acc_norm) | 71.10 ± 1.43 | 64.40 ± 1.51 |
| BoolQ (acc) | 52.75 ± 0.87 | 48.72 ± 0.87 |
| COPA (acc) | 66.00 ± 4.76 | 62.00 ± 4.88 |
| TruthfulQA MC2 (acc) | 42.29 ± 1.48 | 40.69 ± 1.49 |
| LAMBADA (acc) | 27.29 ± 0.62 | 32.56 ± 0.65 |
| LAMBADA (perplexity, lower is better) | 72.16 | 40.06 |
| WikiText-2 (word perplexity, lower is better) | 36.76 | 37.37 |
Bold = the better of the two on that row. Many differences are within one or two standard errors so read the ± before claiming a win.
Notes:
acc_norm normalises by byte length, so it reads higher for both models. Compare each model with OpenAI's under the same method, not across methods.The runs/ folder holds the TensorBoard logs of the whole run (see the Training metrics tab) and log.txt the raw loss log.
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "roger33303/gpt2-124m-fineweb-edu"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo)
ids = tok("Hello, I'm a language model,", return_tensors="pt")
out = model.generate(**ids, max_new_tokens=60, do_sample=True, top_k=50, temperature=0.8,
pad_token_id=tok.eos_token_id)
print(tok.decode(out[0]))
model_56383.pt) to the Hugging Face GPT-2 format; the converted model matches the
original's logits (max absolute difference below 1e-3 on random tokens).