← Blog

Self-Evident — A GPT Built From Scratch That Trains Itself Live in the Browser

Most “AI builds” are a wrapper around someone else’s model. I wanted to build the thing itself — the network, the learning, the math — and then prove it’s real.

Self-Evident dashboard mid-training at step 196: a falling loss curve, a populated attention heatmap, generated 1776-cadence text, and a gibberish frozen-twin baseline.

What it is

SELF-EVIDENT is a real char-level GPT: token + positional embeddings, causal multi-head self-attention, the forward pass, the full backpropagation, and the AdamW optimizer, all hand-written in one HTML file. No TensorFlow, no PyTorch, no autograd, no API. It ships no model — it starts as pure noise and teaches itself the voice of the American founding, live, while you watch.

How it’s built

  • The whole transformer + training loop in plain JS, moved into a Web Worker (built by stringifying the verified engine functions) so the UI never stutters.
  • A “Verify the Math” button runs a numerical gradient check — my hand-written backprop agrees with finite differences to 0.04%.
  • Held-out loss falls alongside training loss, so it’s generalizing, not memorizing — and you can paste your own text and watch it learn your voice from scratch.
Close-up of the learning curve (train and held-out cross-entropy both declining) above a triangular causal self-attention heatmap in blue.
The hand-written internals: cross-entropy dropping on train and held-out, and one attention head’s causal mask lighting up.
The “It Writes, Live” panel showing generated founding-era text next to the never-trained frozen twin’s random gibberish.
Same architecture, side by side: the trained model writes in 1776’s cadence; the frozen twin never learns to.

On the theme

Independence as self-origination. Every other AI build depends on something — a provider, a cloud, a pretrained checkpoint, an API key. This one depends on nothing. It declares independence from every model that came before it.

Try it →Code →All the builds →

Shout-out

Part of the competition is cross-referencing other builders. So: shout-out to Eric Rhea — who set the theme and shipped Qwen Franklin (22 LoRA adapters fine-tuning Qwen into Ben Franklin). It’s serious ML, and it’s what made me aim higher.

Built for Summer Into AI 2026 (Competition #2), hosted by Eric Rhea. More in the build log.