iris-gpt-tinystories

A 15.7M-parameter modern GPT language model trained from scratch on TinyStories in FP16 mixed precision on integrated Intel Iris Xe Graphics (iris:0) using torch-iris (OpenCL backend).

Training & inference code: adityaanilraut/llm-training-scripts (iris-gpt/)

Model Architecture

Parameter Value
Architecture Decoder-only Transformer (modern)
Parameters 15,736,192 (~15.7M, tied token embeddings)
Layers (n_layer) 8
Attention Heads (n_head) 6 (head dim 64)
Embedding Dim (n_embd) 384
FFN Hidden Dim (mlp_hidden) 1024 (SwiGLU)
Normalization RMSNorm + QK-Norm
Positional Encoding RoPE (theta = 10000.0)
Context Length (block_size) 256 tokens
Tokenizer Custom ByteLevel BPE (vocab_size = 4096)
Linear Bias False

Training Summary

Metric / Setting Value
Dataset TinyStoriesV2-GPT4 (150 MB slice: 39.0M train tokens, 3.1M val tokens)
Hardware / Backend Intel Iris Xe Graphics (iris:0, torch-iris 0.19.0, PyTorch 2.15.0)
Precision FP16 mixed precision (torch.autocast("iris", float16) + GradScaler)
Optimizer AdamW (lr = 6e-4 -> 6e-5 cosine decay, 150-step warmup, wd = 0.1, betas = (0.9, 0.95))
Effective Batch Size 64 sequences x 256 tokens (16,384 tokens/iter)
Iterations 2,000 (~32.8M tokens seen, ~3.7 hours at ~2,470 tok/s)
Final Train Loss 1.6484
Best Validation Loss 1.6989
Best Validation Perplexity 5.47

Training and Validation Loss

Example Generation

Prompt: "Once upon a time, a little robot" (seed=42, CPU decode at ~92 tok/s):

Once upon a time, a little robot named Tom lived in a big room. The robot had many friends, but he was also very fast. Tom liked to play with the robot every day. One day, Tom was playing with the robot when it started to move. The robot didn't like to leave. Tom was sad and angry. He didn't want to play with the robot. He just wanted to play with his friends. Tom saw that the robot was not happy. He wanted to help. So, he ran to the robot and said, "Don't be sad. We can make the robot stop!" The robot looked at Tom and said, "We can be friends and play together." They played and had fun

Usage

This checkpoint (best.pt) is self-contained (includes model_state_dict, model_config, and the embedded ByteLevel BPE tokenizer) and works directly with the iris-gpt repository on CPU or Intel Iris Xe (iris:0).

git clone https://github.com/adityaanilraut/llm-training-scripts.git
cd llm-training-scripts/iris-gpt
pip install -r requirements.txt
pip install huggingface_hub

Download best.pt into runs/tinystories-a2/best.pt:

from pathlib import Path
from huggingface_hub import hf_hub_download

out = Path("runs/tinystories-a2")
out.mkdir(parents=True, exist_ok=True)
hf_hub_download(
    repo_id="rautaditya/iris-gpt-tinystories",
    filename="best.pt",
    local_dir=str(out),
)

Run interactive generation or a single prompt:

# Interactive terminal chat (use --device cpu if not on Intel Iris Xe)
python chat.py --run-name tinystories-a2 --device cpu

# One-shot story generation
python chat.py --run-name tinystories-a2 --device cpu --prompt "Once upon a time, a little robot" --max-new-tokens 200

Files in This Repository

  • best.pt β€” Inference-ready PyTorch checkpoint (weights, config, and embedded BPE-4096 tokenizer).
  • config.json β€” Model architecture and training hyperparameters.
  • tokenizer.json β€” Standalone Hugging Face tokenizers ByteLevel BPE tokenizer (4096 vocab).
  • loss.png β€” Training and validation loss curve over 2,000 iterations.
  • train_log.jsonl β€” Full per-10-step training and evaluation metrics log.

Limitations

  • Trained exclusively on short children's stories (TinyStories) with a 256-token context window and 4096-token vocabulary.
  • Intended as an educational / from-scratch pretraining experiment on integrated GPU hardware rather than a general-purpose assistant.
Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Dataset used to train rautaditya/iris-gpt-tinystories