See how it all works, running live in your browser
Everything here actually runs. The neural network really learns, the transformer really computes attention, and the search pipeline and agent memory really execute and time themselves. I kept the models and data small on purpose, and each section says plainly what is real and what is simplified. The model numbers come straight from each model’s published config.
Train a network and watch it learn
Click a connection to edit its weight, or a neuron to edit its bias.
Decision boundary
Training loss
The same network in 3D. Drag to rotate, double-click to let it spin again · brightness = activation · violet / blue streams = positive / negative weights
Fourteen network families, side by side
Inside a decoder-only transformer
Tokens (id · word) · click one to see what it pays attention to
Attention weights, softmax(QKᵀ/√d) · each row is one query token
Click a cell to read its weight.
Positional encoding (sin and cos), position by dimension
Who the selected token attends to
Next-token distribution after sampling filters
Self vs cross attention
Self-attention: Q, K and V all come from the same sequence. Cross-attention (encoder–decoder, e.g. T5): queries come from the decoder, keys and values from the encoder output.
MHA · GQA · MQA
Multi-head gives every query head its own K/V. GQA shares one K/V head per group of query heads. Llama 3.1 8B and Qwen3-8B both use 32 query heads with 8 K/V heads, according to their configs. MQA shares one K/V across all heads. Fewer K/V heads shrink the KV cache.
Causal masking
A decoder can’t look ahead, so future tokens get a score of −∞ before softmax. That’s the grey upper triangle in the heatmap.
FlashAttention
Computes exactly the same attention, but in tiles kept in fast on-chip memory, never writing the full T×T matrix to GPU memory. Same result, far less memory traffic.
Prefill vs decode
Prefill processes the whole prompt in parallel and fills the KV cache. Decode then generates one token per step, reusing the cached keys and values. This part is limited by memory speed more than by compute.
Decoding
Greedy takes the top token. Temperature sharpens or flattens the distribution; top-k keeps the k best; top-p keeps the smallest set whose probability reaches p. Beam search keeps several candidate sequences.
Attention, one number at a time
Attention weights · each row is a query word, each column a key · click a row
How query heads share key/value heads, on a real model
FlashAttention: the same answer, one tile at a time
Ten real models, straight from their configs
Values copied verbatim from each model’s config.json on Hugging Face (fetched 2026-11-28). Parameters and KV-cache sizes are computed from those dimensions; “context” is the config’s max_position_embeddings.
| Model | Family | Layers | Hidden | Heads (Q / KV) | Attention | FFN | Context | Vocab | Params ≈ | KV / token |
|---|---|---|---|---|---|---|---|---|---|---|
| GPT-2 (124M) | Decoder-only (GPT) | 12 | 768 | 12 / 12 | MHA | — | 1,024 | 50,257 | — | 36 KiB |
| BERT-base (uncased) | Encoder-only (BERT) | 12 | 768 | 12 / 12 | MHA | 3,072 | 512 | 30,522 | — | — |
| T5-base | Encoder–decoder (T5) | 12 | 768 | 12 / 12 | MHA | 3,072 | 512 | 32,128 | — | — |
| Llama 3.1 8B | Decoder-only | 32 | 4,096 | 32 / 8 | GQA | 14,336 | 131,072 | 128,256 | 8.03 B | 128 KiB |
| Qwen3-8B | Decoder-only | 36 | 4,096 | 32 / 8 | GQA | 12,288 | 40,960 | 151,936 | 8.19 B | 144 KiB |
| Mistral 7B v0.1 | Decoder-only | 32 | 4,096 | 32 / 8 | GQA · window 4,096 | 14,336 | 32,768 | 32,000 | 7.24 B | 128 KiB |
| Phi-3-mini-4k | Decoder-only | 32 | 3,072 | 32 / 32 | MHA · window 2,047 | 8,192 | 4,096 | 32,064 | 3.82 B | 384 KiB |
| Gemma 2 9B | Decoder-only | 42 | 3,584 | 16 / 8 | GQA · window 4,096 | 14,336 | 8,192 | 256,000 | 9.24 B | 336 KiB |
| Mixtral 8x7B | Decoder-only · MoE | 32 | 4,096 | 32 / 8 | GQA | 8 experts · 2 / token | 32,768 | 32,000 | — | 128 KiB |
| DeepSeek-V3 | Decoder-only · MoE · MLA | 61 | 7,168 | 128 / 128 | MLA | 256 experts · 8 / token · 1 shared | 163,840 | 129,280 | — | latent 512 |
Params ≈ computed only for dense Llama-style decoders (embeddings + attention + SwiGLU FFN + norms). KV / token = 2 × layers × KV heads × head dim × 2 bytes (BF16). DeepSeek-V3 uses Multi-head Latent Attention, caching a compressed latent (kv_lora_rank) instead of full K/V.
From prompt to answer, one token at a time
Tokens · grey is your prompt, orange is generated
Serving many requests: static vs continuous batching
Will it fit? GPU memory for a real model
From a batch to a better model
- 01Dataset
- 02Preprocess
- 03Tokenize
- 04Batch
- 05Forward pass
- 06Loss
- 07Backprop
- 08Optimizer step
- 09LR schedule
- 10Validate
- 11Checkpoint
- 12Evaluate
Learning-rate schedule · linear warm-up, then cosine decay
LoRA on a real model’s dimensions
Quantization on real numbers · grey is the original FP32 weight, orange is the same weight after quantizing and back
A real training run · a small 2-layer network, 140 training and 60 validation points, the same starting weights for each optimiser, learning rate following the schedule above
| Method | What changes | Data | GPU memory | Use when |
|---|---|---|---|---|
| Full fine-tuning | All weights | Large labelled set | Highest: weights, gradients and optimizer states | You have the data and the GPUs, and want the best quality |
| SFT / instruction tuning | All or adapter weights | Prompt → ideal response pairs | Depends on method | Teach a format, tone or task |
| LoRA | Small A and B matrices on chosen projections | Small to medium | Low, the base stays frozen | Most domain adaptation on one GPU |
| QLoRA | LoRA on a 4-bit (NF4) frozen base | Small to medium | Lowest, the base is 4-bit | Big models on a single consumer GPU |
| PEFT (family) | Adapters, prefixes, LoRA, IA³ | Small | Low | Many tasks sharing one base model |
| DPO | The policy, compared against a frozen copy | Pairs of preferred and rejected answers | Moderate, two models in memory | Teach preferences without training a reward model |
| RLHF (PPO) | The policy, guided by a learned reward model | Human preference rankings | High: policy, reference, reward and value models | Large-scale alignment with ongoing feedback |
| Distillation | A smaller student | Teacher outputs / logits | Student-sized | Ship a fast model that mimics a big one |
| Quantization (PTQ / QAT) | Numeric precision of weights | Calibration set (PTQ) or training (QAT) | Cuts weight memory 2–8× | Serve on less memory; QAT keeps accuracy at INT4 |
Text turns into numbers, and close numbers mean similar text
Hashed word vectors: two sentences only look alike when they share words. Switch to MiniLM to compare meaning.
48 of the 384 numbers in each vector, the ones that vary most here · orange positive, blue negative, faint means zero
Similarity between every pair (numbers match the list above)
Squashed to 2D with PCA · colour = k-means cluster · ◆ = your query
Searching this site, live
Chunk vectors squashed to 2D with PCA. ◆ is your question, orange dots are the chunks it pulled back
Where the data lives, and how a query moves through it
Each case study has its own version of this, built from that project’s real stores. For example, ARGUS runs through Valkey, OpenSearch, Qdrant, Neo4j, Kafka and SeaweedFS.
Cache
SQL filter
Keyword index · BM25
Vector index · cosine
Fused ranking
Graph traversal
A-MEM, step by step, running for real
This follows the open-source code line by line (agiresearch/A-mem, from the NeurIPS 2025 paper A-MEM: Agentic Memory for LLM Agents). Each memory becomes a note, like a card in a Zettelkasten. When a new note arrives, the system finds its five closest notes in ChromaDB and asks the LLM whether to link them and update the older ones. Searching returns the best matches plus anything linked to them.
An agent calling tools over MCP, message by message
Every case study also has its own MCP server with tools for that project alone, such as the medical log analysis or BioAI.
Answer
Call a tool yourself
Messages · click one to see its JSON
Raw JSON-RPC
The spec’s transports are stdio and Streamable HTTP. Here the same JSON-RPC messages travel over postMessage to a Web Worker. In the 2026-07-28 revision the initialize handshake is gone and each request carries the client’s details in _meta.
How every project, agent, database and tool connects
Agents handing work to each other
Where a batch of real questions ended up