roneneldan/TinyStories
Viewer β’ Updated β’ 2.14M β’ 243k β’ 1.35k
Hedwig is a ChatGPT-style language model built 100% from scratch in pure PyTorch (no HF Trainer, no Lightning) β including its own BPE tokenizer, modern Transformer (RoPE + RMSNorm + SwiGLU + SDPA + bf16), Stage 2 SFT, Stage 3 Anchored DPO, and from-scratch 8-bit / packed 4-bit quantization.
97,581,824 (~97.6M knobs: 12 layers, 768 width, 12 heads, block_size = 256)tokenizer.json)366.7 MB TinyStories (roneneldan/TinyStories)262.1 MB FineWeb-Edu (karpathy/fineweb-edu-100b-shuffle, ODC-By)30,930 mixed pairs (TinyStories-Instruct + 15,000 Apache-2.0 grammarly/coedit grammar/tone rewrites)22,236 π chosen vs π rejected pairs| Checkpoint | Precision | File Size | Val / Test Loss | Notes |
|---|---|---|---|---|
brain.pt |
bfloat16 |
195.6 MB | 2.619 |
Stage 1 pretrain (20,000 steps, 8k vocab) |
brain_chat.pt |
bfloat16 |
195.6 MB | 1.336 |
Stage 2 SFT (1,500 steps) |
brain_chat_int8.pt |
int8 |
98.2 MB | 1.3577 |
From-scratch 8-bit quantization |
brain_chat_int4.pt |
int4 |
55.2 MB | 1.3693 |
From-scratch packed 4-bit quantization |
brain_dpo.pt |
bfloat16 |
195.6 MB | 1.235 |
Stage 3 DPO (96.7% peak / 95.0% saved win-rate) |
brain_dpo_int8.pt |
int8 |
98.2 MB | 1.4000 |
From-scratch 8-bit quantization |
brain_dpo_int4.pt |
int4 |
55.2 MB | 1.4118 |
From-scratch packed 4-bit quantization |
Prompt:
Write a story about a boy named Harry Potter.Harry Potter was a humble boy who liked to play. One day, he decided to go out and play. He walked down the street, laughing and having so much fun. Suddenly, Harry saw something shiny in a store window...
Full pure-PyTorch training scripts, interactive Brain X-Ray UI (app.py), and learning logs live at https://github.com/ansarbuilds/hedwig.