AIExplorer

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.

01Neural network

Train a network and watch it learn

A small teaching network. It really learns, using gradient descent, right here in your browser.

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

02Architectures

Fourteen network families, side by side

03Transformer

Inside a decoder-only transformer

The attention maths is real, run on a tiny 2-layer, 4-head model with untrained attention weights. Its next-word guesses come from word statistics it learns here from my case studies. It holds up to 16 tokens.

    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.

    04Attention lab

    Attention, one number at a time

    Real attention maths on small 4-number vectors. The weights are random, so the patterns don’t mean anything yet, but every number here is computed live. Head counts come from each model’s config.

    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

    05Model configs

    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.

    ModelFamilyLayersHiddenHeads (Q / KV)AttentionFFNContextVocabParams ≈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.

    06Inference

    From prompt to answer, one token at a time

    A real decoding loop over a tiny word-level language model that learns word pairs from my case studies when the page loads. Decoding, beam search, the cache and batching all really run. GPU numbers are worked out from published configs.

      Tokens · grey is your prompt, orange is generated

      Serving many requests: static vs continuous batching

      Will it fit? GPU memory for a real model

      07Training & fine-tuning

      From a batch to a better model

      1. 01Dataset
      2. 02Preprocess
      3. 03Tokenize
      4. 04Batch
      5. 05Forward pass
      6. 06Loss
      7. 07Backprop
      8. 08Optimizer step
      9. 09LR schedule
      10. 10Validate
      11. 11Checkpoint
      12. 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

      MethodWhat changesDataGPU memoryUse when
      Full fine-tuningAll weightsLarge labelled setHighest: weights, gradients and optimizer statesYou have the data and the GPUs, and want the best quality
      SFT / instruction tuningAll or adapter weightsPrompt → ideal response pairsDepends on methodTeach a format, tone or task
      LoRASmall A and B matrices on chosen projectionsSmall to mediumLow, the base stays frozenMost domain adaptation on one GPU
      QLoRALoRA on a 4-bit (NF4) frozen baseSmall to mediumLowest, the base is 4-bitBig models on a single consumer GPU
      PEFT (family)Adapters, prefixes, LoRA, IA³SmallLowMany tasks sharing one base model
      DPOThe policy, compared against a frozen copyPairs of preferred and rejected answersModerate, two models in memoryTeach preferences without training a reward model
      RLHF (PPO)The policy, guided by a learned reward modelHuman preference rankingsHigh: policy, reference, reward and value modelsLarge-scale alignment with ongoing feedback
      DistillationA smaller studentTeacher outputs / logitsStudent-sizedShip a fast model that mimics a big one
      Quantization (PTQ / QAT)Numeric precision of weightsCalibration set (PTQ) or training (QAT)Cuts weight memory 2–8×Serve on less memory; QAT keeps accuracy at INT4
      08Embeddings

      Text turns into numbers, and close numbers mean similar text

      Real vector maths. The quick mode uses hashed word vectors. Switch to all-MiniLM-L6-v2 to run a real sentence-embedding model in your browser (about 23 MB).

      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

      09RAG pipeline

      Searching this site, live

      A real retrieval pipeline over my case studies. It uses simple hashed word vectors and BM25 in place of a neural embedding model, and no LLM is connected.

      Chunk vectors squashed to 2D with PCA. ◆ is your question, orange dots are the chunks it pulled back

        10Data layer

        Where the data lives, and how a query moves through it

        Five small stores built in your browser from my case studies: a semantic cache, a SQL table, a vector index, a keyword index and a graph. They stand in for Redis, PostgreSQL, Qdrant, OpenSearch and Neo4j. Every lookup really runs and is timed.

        Cache

        SQL filter

        Keyword index · BM25

        Vector index · cosine

        Fused ranking

        Graph traversal

        11Agent memory

        A-MEM, step by step, running for real

        Real: the note store, the links, the evolution bookkeeping and the vector search. You can also switch on the real all-MiniLM-L6-v2 embedding model. The two LLM calls are replaced by simple rules that return the same JSON the real code expects.

        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.

        Quick hashed vectors with a few concept words (384-dim). Pick all-MiniLM-L6-v2 for real meaning-based search.
           
          12Model Context Protocol

          An agent calling tools over MCP, message by message

          A real MCP server runs in a Web Worker on this page and answers JSON-RPC 2.0 requests with tools over my case studies. Every arrow is a message that was actually sent. The agent picks tools with simple rules, not an LLM.

          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.

            13Knowledge graph

            How every project, agent, database and tool connects

            Built from the case studies and design documents · 263 entities · 292 links
            14Agent orchestration

            Agents handing work to each other

            These agents follow simple rules instead of an LLM, but they really run here, call real tools over this site’s data and time every step.

            Where a batch of real questions ended up

              15System map

              How neural nets, RAG, memory and agents fit together

              A reference design drawn from my projects. The trace is a guided walkthrough, not live monitoring.