roneneldan/TinyStories
Viewer β’ Updated β’ 2.14M β’ 243k β’ 1.35k
A tiny GPT (Task-oriented Intelligent Architecture) trained from scratch on TinyStories. Written by a 12th-grade student on free Kaggle GPUs.
| Architecture | Decoder-only Transformer (GPT-style) |
| Parameters | 49.39M |
| Layers | 6 |
| Heads | 6 |
| Embedding dim | 384 |
| Context length | 256 |
| Vocab | 50,257 (GPT-2 BPE via tiktoken) |
| Dropout | 0.2 |
| Source | roneneldan/TinyStories |
| Stories | 2,119,719 |
| Total tokens | ~474M (train 426.6M / val 47.4M) |
| Tokens processed in training | ~164M positions |
| Split | 90% / 10% |
| Hardware | Kaggle GPU T4 Γ2 (free tier) |
| Steps | 19,999 |
| Batch size | 32 |
| Optimizer | AdamW (Ξ²1=0.9, Ξ²2=0.95) |
| LR | 1e-3 with 500-step warmup + cosine decay |
| Gradient clipping | 1.0 |
| Metric | Value |
|---|---|
| Train loss | 1.7690 |
| Val loss (best) | 1.7604 |
| Perplexity | 5.81 |
| Train/val gap | 0.0086 |
Prompt: Once upon a time
Once upon a time, there was a little girl named Lily. She loved to play outside in the sun. One day, she saw a big, scary dog in the park. The dog was very big and scary. Lily's mommy told her to be careful and stay away from the dog. β¦ From that day on, Lily learned that sometimes it's okay to have something scary and that it's okay to ask for help when you need it.
Prompt: Lily went to the park and
Lily went to the park and saw a boy playing with a ball. She asked him if he wanted to play too. The boy said yes and they started to play together. β¦
import torch, tiktoken
from huggingface_hub import hf_hub_download, login
login()
# 1. Download checkpoint
ckpt = hf_hub_download("prashilmankar/aethel-gaze-TIA",
"tinystories_latest.pt")
# 2. Build model (see model.py in repo)
# model = AethelGazeTIA(50257)
# state = torch.load(ckpt, map_location="cpu")
# model.load_state_dict(state["model"])
# 3. Generate
enc = tiktoken.get_encoding("gpt2")
# ...