About

How Forward Pass works

Forward Pass is an instrument for looking inside AI. It runs a real language model in your browser and shows every number it computes, and it runs teams of AI agents so you can watch how they split up and merge their work.

The model

The model is stories15M, a 15.2-million-parameter transformer with the same architecture as Llama 2 (RMSNorm, rotary position embeddings, SwiGLU feed-forward layers, tied input and output embeddings): 6 layers, 6 attention heads, 288-number vectors, a 32,000-token vocabulary and a 256-token context window. It was trained by Andrej Karpathy (llama2.c, MIT license) on TinyStories, a dataset of simple stories written in the vocabulary of a young child, which is why it writes children's stories and nothing else.

The original weights are 32-bit floats (61 MB). This site ships them as 8-bit integers with one scale per 48 values (16.5 MB). The effect was measured before shipping: over a test passage the next-token distributions of the two versions differ by a mean KL divergence below 0.0001, and they agree on the most likely token at every position.

The engine

The forward pass is written from scratch in TypeScript and runs in a background thread. Unlike a normal inference engine it keeps everything: the embedding, every query, key and value, every attention score and weight, all 768 neuron activations of every layer, the residual stream after every step, and the scores for all 32,000 tokens. It was checked against an independent reference implementation of the same model, with logits matching to within 0.00001.

The “guesses” shown inside the machine are the logit lens: the residual stream after each layer, passed through the model's final normalization and output layer, as if the model stopped there. The vocabulary galaxy is a UMAP projection (cosine distance) of the embedding rows of the 4,965 tokens that appear at least 10 times in the TinyStories validation split; the token counts come from that same split.

The agents

The local team runs on your CPU threads. Each thread holds its own copy of the model (kept as 8-bit integers and computed on directly, 16.5 MB each) and its own key-value cache, so the writers genuinely work at the same time. The plan is a fixed rule of four story beats; the drafts, the probabilities and the judge's scores all come from the model. The judge scores each draft on fluency (its average log-probability) plus relevance (how much more likely the draft is after this story than after a generic opening), minus a penalty for repeated phrases.

The frontier team is Claude, called from your browser with your own Anthropic API key, using the official SDK. A lead agent splits your question and delegates the parts in parallel to researcher agents that search and read Wikipedia and run code in a sandbox. Your key is kept only in the memory of the open tab and sent only to Anthropic; it never reaches this site's server. The cost shown is computed from the token counts the API reports and published per-token prices.

What is real, and what is simplified

Real: every token, probability, activation, attention weight, score, timing and cost on the site is computed live, on your device or by the API. Nothing is pre-recorded. Simplified: the model is tiny, so it only knows children's stories; animations are slowed down so you can follow them; and the local team's plan is a rule rather than a decision made by a model.

Credits