Views
No views yet
1n_embd = 512 # hidden size
2n_heads = 8 # attention heads (head_size = 64)
3n_transformers = 12 # layers
4block_size = 2048 # context length
5vocab_size = 50304 # padded gpt2 vocab (real: 50257)
6dropout = 0.0 # (disabled for pretraining)
7# Total: ~90.4M parametersscaled_dot_product_attention (FlashAttention-2 when on NVIDIA).| Property | Value |
|---|---|
| Data | chanind/openwebtext-gpt2 — 15 shards = 1.8B tokens |
| Splits | 1.62B train / 180M val |
| Optimizer | Hybrid Muon (Moonshot) for 2D block params (37.7M) + Fused AdamW for embeddings, lm_head, norms |
| LR peak | 3e-4 (AdamW) / 0.02 (Muon) |
| LR schedule | Cosine with 500-step warmup, decay to 10% of peak |
| Gradient clipping | 1.0 |
| Weight decay | 0.1 on 2D params, 0 on 1D |
| Precision | bf16 (model + activations) + fp32 optimizer states |
| Compile | torch.compile (default mode) |
| Batch | 64 sequences × 2048 tokens = 131,072 tokens/step |
| Hardware | Single NVIDIA RTX PRO 6000 Blackwell Server (96 GB GDDR7) |
| Throughput | ~418,000 tokens/sec |
| Steps to step 30000 | ~2.5 effective epochs over the 1.8B train corpus |
| Step | Train loss | Val loss |
|---|---|---|
| 0 | 11.00 | — |
| 1000 | 4.80 | 4.80 |
| 6000 | 4.05 | 4.07 |
| 12000 (end epoch 1) | 3.97 | 3.96 |
| 18000 | 3.89 | 3.93 |
| 24000 (end epoch 2) | 3.89 | 3.89 |
| 30000 | 3.85 | 3.89 |
exp(3.89) ≈ 49.1import torch, tiktoken
2from huggingface_hub import hf_hub_download
3
4# Download checkpoint
5ckpt_path = hf_hub_download(
6 repo_id="juliannunezb/llm-training-v1-checkpoints",
7 filename="checkpoint.pt",
8 repo_type="model",
9)
10ckpt = torch.load(ckpt_path, map_location="cuda", weights_only=False)
11
12# Rebuild model (see full model code in the original training repo)
13from transformer_lm_v1 import TransformerLM
14model = TransformerLM().cuda().to(torch.bfloat16)
15model.load_state_dict(ckpt["model"], strict=True)
16model.eval()
17
18# Generate
19tok = tiktoken.get_encoding("gpt2")
20prompt_ids = torch.tensor([tok.encode("Once upon a time")], dtype=torch.long, device="cuda")
21with torch.no_grad():
22 for _ in range(200):
23 logits = model(prompt_ids[:, -2048:])
24 # Mask phantom vocab-padding tokens (ids >= 50257)
25 logits[:, -1, 50257:] = float("-inf")
26 probs = torch.softmax(logits[:, -1, :] / 0.9, dim=-1)
27 # Optional top-k filter
28 v, _ = torch.topk(probs, 40)
29 probs[probs < v[:, [-1]]] = 0
30 probs = probs / probs.sum(dim=-1, keepdim=True)
31 next_id = torch.multinomial(probs, 1)
32 prompt_ids = torch.cat([prompt_ids, next_id], dim=1)
33print(tok.decode(prompt_ids[0].tolist()))"Once upon a time", temperature=0.9, top_k=40."Once upon a time there were more than 100,000 registered voters in the United States today. For those who may be voting for Obama, that's a huge increase, but also a staggering increase. One of the biggest obstacles to getting to it is to keep the election from running through the next election process..."
"The best way to cook pasta is""The best way to cook pasta is to cook the first, then add a quick food solution, then choose a simple recipe. The next step is the simple way to cook your bread..."
"In 2010, scientists discovered""In 2010, scientists discovered that the earliest known human tissue in the human brain was present in the brain. The discovery was the first in the history of human DNA in the UK..."
@misc{juliannunezb_transformerlm_90m_2026,
author = {Juli{\'a}n N{\'u}{\~n}ez Barrero},
title = {TransformerLM 90M (OpenWebText pretraining)},
year = 2026,
howpublished = {\url{https://huggingface.co/juliannunezb/llm-training-v1-checkpoints}}
}