roneneldan/TinyStories
Viewer • Updated • 2.14M • 83.5k • 1.13k
A 24.6M parameter GPT trained from scratch (random init → coherent children's stories) on the TinyStories corpus. Designed as the base model of the mara project: a small-model-first family targeting browser inference and microcontrollers.
Live demo (runs in your browser, no server): https://huggingface.co/spaces/jaswanthsanjay88/mara-demo
| Config | Value |
|---|---|
| Parameters | 24,648,192 |
| Layers | 6 |
| d_model | 512 |
| Heads | 8 (head_dim 64) |
| FFN | SwiGLU, hidden 1,536 |
| Positional | RoPE |
| Norm | RMSNorm (pre-norm) |
| Context | 512 tokens |
| Vocab | 8,192 custom byte-level BPE (trained on TinyStories) |
| File | Size | Purpose |
|---|---|---|
model.safetensors |
~50 MB | fp16 PyTorch weights (training/fine-tuning) |
model_fp16.onnx |
50 MB | browser inference via WebGPU |
model_int8.onnx |
27 MB | browser inference via WASM (all browsers) |
tokenizer.json |
— | custom 8k BPE (`< |
config.json |
— | architecture hyperparameters |
The architecture is custom (mara/model.py in the source repo): RoPE + SwiGLU + tied embeddings. Load weights like so:
import json, torch
from safetensors.torch import load_file
from mara.model import Mara, MaraConfig # from the mara repo
from mara.tokenizer import load_tokenizer
cfg = MaraConfig(**json.load(open("config.json")))
model = Mara(cfg)
model.load_state_dict({k: v.float() for k, v in load_file("model.safetensors").items()})
model.eval()
tok = load_tokenizer("tokenizer.json")
ids = torch.tensor([tok.encode("Once upon a time")])
print(tok.decode(model.generate(ids, max_new_tokens=200)[0].tolist()))
This model is the teacher for a distilled intent-parsing student that runs fully offline on an ESP32-S3 for smart-home control.