gitwtfhub

wtf is attention-span?

sumanentc/attention-span — explained in plain English

Analysis updated 2026-05-18

0Jupyter NotebookAudience · researcherComplexity · 4/5Setup · hard

TL;DR

A personal project documenting a from-scratch build of a small GPT-style language model, including pretraining and instruction fine tuning on TinyStories.

Mindmap

mindmap
  root((repo))
    What it does
      Trains GPT from scratch
      Instruction fine tunes model
      Documents learning notes
    Tech stack
      Python
      PyTorch
      Jupyter Notebook
    Use cases
      Study transformer architecture
      Reproduce GPT-124M training
      Learn instruction fine tuning
    Audience
      Researchers
      Developers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Study a from-scratch implementation of a GPT-124M style model.

REASON 2

Reproduce pretraining on the TinyStories dataset.

REASON 3

Learn how instruction fine tuning changes model behavior with before and after results.

REASON 4

Review documented training optimizations like mixed precision and gradient accumulation.

What's in the stack?

PythonPyTorchJupyter Notebook

How it stacks up

sumanentc/attention-spanagostynah/distributed-vector-memory-routingakashsingh3031/python-libraries
Stars00
LanguageJupyter NotebookJupyter NotebookJupyter Notebook
Last pushed2020-12-03
MaintenanceDormant
Setup difficultyhardmoderateeasy
Complexity4/53/51/5
Audienceresearcherresearchervibe coder

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · hard Time to first run · 1h+

Training was run on an A100 GPU via Google Colab, reproducing it costs roughly $1.50 in compute.

The README does not state a license.

Wtf does this do

attention-span is a personal learning project that builds small language models from scratch and documents everything the author learns along the way. It is organized as a collection of training scripts, Jupyter notebooks, and written notes rather than a packaged tool, so it reads more like a study log than a product. The first and main model in the repository is a GPT-124M style model, meaning it has roughly 124 million parameters, built with 12 layers and 12 attention heads. It is trained on TinyStories, a public dataset of short, simple children's stories designed for training small models that can still write coherent narrative text. The notebooks walk through building the model architecture step by step, then take that pretrained model and instruction fine tune it on a synthetic set of instruction and response examples generated from the same TinyStories dataset. The repo includes before and after results from this fine tuning process. Before fine tuning, the model ignored instructions entirely and produced unrelated text. After two epochs of fine tuning on a single A100 GPU, it consistently followed the expected instruction and response format and its ROUGE score, a measure of how closely generated text matches a reference, roughly doubled. The author also notes clear remaining weaknesses, including trouble following multiple required keywords at once and a tendency to repeat similar characters and plots under simple decoding. Beyond the core training script, the project documents a long list of performance optimizations it applies, such as mixed precision training, gradient accumulation to simulate larger batches, and techniques borrowed from Andrej Karpathy's nanoGPT project. The full training run described costs roughly a dollar and a half in cloud GPU time on Google Colab. The full README is longer than what was shown.

Yoink these prompts

Prompt 1
Walk me through how sumanentc/attention-span builds a GPT-124M model from scratch.
Prompt 2
Explain the instruction fine tuning pipeline used in Instruction_finetune_gpt.ipynb.
Prompt 3
Help me reproduce the TinyStories training run described in this repo on a GPU.
Prompt 4
Explain the training optimizations like FlashAttention and gradient accumulation used here.

Frequently asked questions

wtf is attention-span?

A personal project documenting a from-scratch build of a small GPT-style language model, including pretraining and instruction fine tuning on TinyStories.

What language is attention-span written in?

Mainly Jupyter Notebook. The stack also includes Python, PyTorch, Jupyter Notebook.

What license does attention-span use?

The README does not state a license.

How hard is attention-span to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is attention-span for?

Mainly researcher.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.