AETERNAE AI RESEARCH LLC INDEPENDENT RESEARCH
ÆAETERNAERESEARCH
Sign inRequest access
← Malware catalog

Attributed metadata history

REPORTPUBLIC METADATA

Building GPT-2 (124M) in PyTorch: weight parity, a speed ladder and about 150 GPU-minutes of my own training

"I implemented GPT-2" can mean three very different things. You can load OpenAI's weights into your own code and show it computes the same function. You can make the training loop fast. Or you can start from random weights and train a model that actually learns something. All three happened in my repository neuron-to-gpt, my weekly submissions for a 12-week AI program that went from a single neuron to GPT-2. Keeping their numbers apart turned out to be harder than producing them. The GPT-2 weeks follow the outline of Andrej Karpathy's "Let's reproduce GPT-2 (124M)" lecture, so the model itself will look familiar. This post is about what I added around it: a full-logit parity test on English, Turkish and emoji prompts that guards the weight import, a speed ladder where every stage is timed on its own and the flash stage cannot silently fall back, a resumable training run with its interruption written into the record, and a paired comparison against GPT-2 on a held-out HellaSwag cohort. TL;DR Stage What it is Headline number What it proves Week 10 My GPT-2 holding OpenAI's weights max logit diff 5.3e-05 to 8.4e-05 on an A100 (rtol = atol = 1e-4 per logit) my code computes the reference function Week 11 Cumulative speed stages on an L4 53.75 → 36.23 ms per update, 1.48× which change actually helped, at one small shape Week 12 Random init, 60 min on an NVIDIA L4 validation NLL 11.01 → 4.98; HellaSwag 27.6% my training pipeline learns G4 That checkpoint, 90 more minutes on an RTX PRO 6000 NLL 4.98 → 3.67; HellaSwag 27.6% → 32.3% on the first 1,000 examples, 30.5% vs GPT-2's 33.7% on a held-out 1,000 real progress; below GPT-2 on both cohorts' point estimates The model Standard GPT-2 small: 12 blocks, 12 heads, width 768, 1,024 positions, pre-LayerNorm, tanh-approximate GELU, learned absolute positions and a fused Q/K/V projection. The token embedding and the output layer share one matrix (weight tying), which saves 50,257 × 768 = 38,597,376 parameters: the tied model has 124,439,808 unique parameters, the untied one would have 163,037,184. Initialization follows GPT-2: std 0.02 for weight matrices, and std 0.02/√(2L) for the two residual output projections in each block. Every block adds two contributions to the residual stream, so without the smaller scale the variance of the stream grows with depth. Week 10: weight parity is a correctness test, not training To check the implementation, I import the published OpenAI weights (the Hugging Face copy, pinned to a fixed revision) into my own modules and compare outputs. The trap is in the import. Hugging Face's GPT-2 uses a historical Conv1D layer that stores weights as (input, output). nn.Linear expects (output, input). So four weight matrices per block must be transposed. For three of them a forgotten transpose fails loudly with a shape error. The attention output projection is 768 × 768, so a missing transpose there loads without complaint and silently computes a different function. From load_hf_weights in week10/model.py: transposed_suffixes = ( ".attn.c_attn.weight", ".attn.c_proj.weight", ".mlp.c_fc.weight", ".mlp.c_proj.weight", ) ... tensor = source[name].t() if name.endswith(transposed_suffixes) else source[name] destination.copy_(tensor) The loader validates every key and every shape before copying anything, so a late mismatch cannot leave a half-loaded model behind. The parity check compares full logits, not a sample. Both models get the same input in FP32, with eager attention, TF32 off and dropout off, and every logit must agree within rtol = atol = 1e-4. I used three prompts on purpose: an English sentence, a Turkish one, and a mixed string with an emoji, so that multi-byte BPE paths are exercised too. On an A100 the largest absolute difference per prompt was between 5.3e-05 and 8.4e-05, and all three passed; the same check also passed on a T4. That proves my code computes the same function as

Reference details

Source category
research-report
First reported
Nov 26, 2026 17:39 UTC
Last reported
Nov 26, 2026 17:39 UTC
Catalog updated
Nov 26, 2026 17:53 UTC
Record ID
f6c5f2671380bf71eb2177a47fb9cff1948961b30ee2838612abf8588e5ad076

Published indicators

Network indicators are visibly defanged. This page does not make them clickable or send them to another service.

No validated file hashes or network indicators are stored for this record.

Source observations

intelligence_src_6dc544294b7f21f98a

Source-provided label
Publisher RSS metadata
Evidence class
mentioned in report
Confidence
Not reported
Observed
Nov 26, 2026 17:39 UTC
Retrieved
Nov 26, 2026 17:53 UTC

This record contains metadata and attribution only. It does not host, download, unpack, render, or execute malware samples.

Feed collection status

Sources represented on this page. Publication and observation dates describe the content; successful batch dates describe local collection. A recent batch does not certify complete coverage or current provider availability.

1 sources: 0 stale, 0 needing attention, 0 paused, 0 unverified.

Review source update dates and status
  • intelligence_src_6dc544294b7f21f98aRecent successful batchLast successful batch: Last attempt:

Stale means older than twice the recorded collection interval, with a minimum of one hour; without an interval, the threshold is 24 hours. Cached content remains available while a feed is stale, paused, or unverified.