Preploop

Artificial Intelligence

AI Concepts

Rehearse AI architectures. Interactively step through backprop neural networks, self-attention matrices, RAG pipelines, and multi-agent loops.

33 VISUALIZERS LIVE
AI Concepts · Neural Foundations

Neural Net + Backprop

A neural net is just a stack of "multiply, add a bias, then bend" operations. Each layer takes the previous layer's outputs, mixes them with a matrix of weights, adds a bias, and squashes the result through a nonlinear activation. Stacking these lets the network compose simple features into complex ones. "Learning" means searching for the weights that make the output match the labels — and we do that by measuring how wrong we are (the loss) and rolling every weight a small step downhill on that loss surface. Backpropagation is the bookkeeping trick that tells us which direction is downhill for every weight at once: it is the chain rule applied layer by layer, reusing each layer's gradient to cheaply compute the layer before it.

  • Active Simulation
  • Interactive Visualizer
  • Free Preview
AI Concepts · Neural Foundations

Gradient Descent & Optimizers

Training = minimizing a loss. Gradient descent does it by repeatedly stepping downhill: compute the gradient (the direction of steepest increase) and move the opposite way. Optimizers like Momentum and Adam change HOW you step to converge faster and avoid getting stuck or zig-zagging.

  • Active Simulation
  • Interactive Visualizer
  • Free Preview
AI Concepts · Neural Foundations

Activation Functions

Activation functions add NON-LINEARITY between layers. Without them, stacking linear layers just collapses into one linear layer — the network could only draw straight boundaries. Non-linear activations let a network bend space and learn complex functions.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · Neural Foundations

K-Means Clustering

K-means groups points into k clusters by repeating two steps: assign each point to its nearest centroid, then move each centroid to the average of its points. Repeat and the centroids settle into the centers of the natural groups. It’s unsupervised — no labels, just geometry.

  • Active Simulation
  • Interactive Visualizer
  • PRO
AI Concepts · LLM Internals

Self-Attention

Self-attention lets every token in a sequence look at every other token and pull in the information it needs, weighted by relevance. Instead of processing words in a fixed left-to-right window, each position asks a question (its Query), every position advertises what it offers (its Key), and the match between question and offer decides how much of each position's content (its Value) gets mixed into the result. The output for a token is a relevance-weighted blend of all tokens' values — a context-aware representation built in one parallel step, with no recurrence and a direct path between any two positions.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · LLM Internals

Multi-Head Attention

One attention head can only focus one way at a time. Multi-head attention runs SEVERAL attention computations in parallel — each with its own Q/K/V projections — so different heads can capture different relationships (syntax, coreference, position…). Their outputs are concatenated and projected back.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · LLM Internals

Softmax, Temperature & Sampling

A language model does not emit a word — it emits a score (logit) for every token in its vocabulary. Softmax turns those raw scores into a probability distribution, temperature controls how "sharp" or "flat" that distribution is, and top-k / top-p trim the long tail before we draw one token at random.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · LLM Internals

Tokenization (BPE)

Models don’t read characters or whole words — they read "tokens", chunks learned from data. Byte-Pair Encoding (BPE) starts from single characters and repeatedly merges the most frequent adjacent pair, so common pieces ("ing", "un", "er") become single tokens while rare words stay split.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · LLM Internals

Positional Encoding

Self-attention has no built-in sense of ORDER — it sees a set of tokens, so "dog bites man" and "man bites dog" would look the same. Positional encoding fixes this by adding a unique, position-dependent vector to each token embedding, so the model knows where each token sits.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · LLM Internals

KV Cache

LLMs generate one token at a time, each attending to ALL previous tokens. Naively you’d recompute every past token’s Key and Value vectors at every step — hugely wasteful. The KV cache stores past K/V vectors so each new token only computes its OWN K/V and reuses the rest. It’s the single biggest speedup in autoregressive inference.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · LLM Internals

Rotary Position Embedding (RoPE)

RoPE injects position by ROTATING each pair of dimensions in the Query and Key vectors by an angle proportional to the token's position. Because rotations compose, the attention score between two tokens ends up depending only on their RELATIVE distance — giving relative-position awareness for free, with great length generalization.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · LLM Internals

The Transformer Block

A Transformer is a stack of identical BLOCKS. One block does two things in turn: mix information across tokens (self-attention), then transform each token on its own (a feed-forward MLP) — each wrapped in a LayerNorm and a residual connection. Stack N of these and you have a GPT/Llama.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · LLM Internals

Normalization (LayerNorm / RMSNorm)

Normalization keeps activations in a stable range so deep networks train well. LayerNorm rescales each token's feature vector to zero mean and unit variance (then a learned scale/shift). RMSNorm is a cheaper variant that just divides by the root-mean-square — and works just as well, so modern LLMs prefer it.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · LLM Internals

Multi-Query & Grouped-Query Attention

In standard multi-head attention every query head has its OWN Key/Value projection, so the KV cache stores K/V for all heads — the main memory cost at inference. MQA shares ONE K/V across all heads; GQA shares a few K/V groups. Fewer K/V heads → a much smaller cache, faster decoding, tiny quality cost.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · LLM Internals

Flash Attention

Standard attention builds the full n×n score matrix in memory — O(n²) — which is slow and memory-hungry for long sequences. FlashAttention computes the SAME attention in tiles, keeping a running softmax so it never stores the big matrix. It is an exact, IO-aware reimplementation: same result, far less memory traffic.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · LLM Internals

Decoding: Beam & Speculative

Decoding is how you turn the model's per-step probabilities into a sequence. Greedy takes the single best token each step. Beam search keeps the top few partial sequences to find a higher-likelihood whole. Speculative decoding uses a small draft model to guess several tokens that the big model verifies in parallel — same output, faster.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · LLM Applications

Embeddings & Cosine Similarity

An embedding turns a word (or sentence, image, row…) into a vector — a point in space — so that things with similar meaning land in similar directions. "Closeness" is measured by the ANGLE between vectors (cosine similarity), not their raw distance, so length/frequency doesn’t distort meaning.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · LLM Applications

RAG Pipeline

An LLM only knows what was in its training data. RAG gives it fresh, specific knowledge at query time: embed the question, retrieve the most similar chunks from your documents, paste them into the prompt as context, and let the model answer grounded in those chunks instead of guessing.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · LLM Applications

Vector Search (HNSW)

Finding the nearest vector by comparing the query to all N vectors is too slow at millions of items. HNSW builds a layered "small-world" graph: sparse long hops at the top get you near the right region fast, then denser layers refine the search — so you only touch a handful of nodes instead of all of them.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · LLM Applications

Chunking & Reranking

RAG quality lives or dies on retrieval. Two levers: HOW you split documents into chunks (sentence / fixed-size / overlapping) changes what can be retrieved; and a RERANKER re-scores the top vector hits with the query and chunk together, fixing the ordering that fast-but-approximate vector search gets wrong.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · Agentic Systems

ReAct Agent Loop

A ReAct agent solves a task by interleaving REASoning and ACTing: it writes a Thought, takes an Action (calls a tool), reads the Observation (the tool’s result), and loops — using each observation to decide the next step — until it has enough to give a final Answer.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · Agentic Systems

Tool / Function Calling

An LLM can’t fetch live data or do exact math on its own. Function calling fixes that: you give the model a list of tools (name + typed parameters); instead of answering directly, it emits a structured CALL (tool name + JSON args); your code runs the tool and feeds the result back; the model then answers using it.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · Agentic Systems

Multi-Agent Orchestration

Multi-agent orchestration solves a problem by coordinating several specialized LLM agents instead of asking one agent to do everything. Each agent has a focused role, its own prompt/tools, and a narrow responsibility; an orchestration layer routes work between them, passes messages, and decides who acts next. The win is separation of concerns — a planner that decomposes, workers that execute, a reviewer that checks — so each agent's context stays small and on-task. The cost is coordination: more LLM calls, more places to fail, and the need for clear protocols and stop conditions.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · Agentic Systems

Planning & Task Decomposition

For a complex goal, an agent first DECOMPOSES it into a plan — an ordered list of smaller subtasks — then executes them one by one, often using tools per step. Breaking the goal down makes each step tractable and checkable.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · Agentic Systems

Agent Memory

An agent’s working memory is its context window — but that has a fixed size. As a conversation grows, old turns must leave the window. Short-term memory keeps the recent turns; when it overflows, older turns are SUMMARIZED (or dropped); and important facts are written to LONG-TERM memory (a vector store) so they can be retrieved later even after they’ve left the window.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · Agentic Systems

Model Context Protocol (MCP)

MCP is an open standard for connecting AI apps to tools and data. Instead of hand-wiring every integration, a HOST app runs an MCP CLIENT that speaks one protocol to many MCP SERVERS — each server exposes tools, resources, and prompts. It’s like USB-C for AI: one connector, any peripheral.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · Production & Training

Quantization

A model’s weights are stored as high-precision numbers (FP16/FP32). Quantization rounds them to a smaller set of discrete levels (INT8, INT4…), so each weight takes fewer bits. The model gets much smaller and faster, at the cost of a little rounding error.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · Production & Training

LoRA / PEFT

Fine-tuning a full model updates billions of weights — expensive and storage-heavy. LoRA (a Parameter-Efficient Fine-Tuning method) FREEZES the base weights and learns two small low-rank matrices A and B added alongside: ΔW = B·A. You train only A and B — often <1% of the parameters — yet adapt the model’s behavior.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · Production & Training

Mixture of Experts

Instead of every token passing through one giant feed-forward network, a Mixture of Experts has many smaller expert networks and a ROUTER that sends each token to only the top-k experts (e.g. 2 of 8). Most experts stay idle per token, so you get a huge total parameter count but only pay compute for the few that fire.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · Production & Training

RLHF / DPO

A base model predicts likely text, not necessarily HELPFUL text. Alignment fixes this from human PREFERENCES: show people two model responses, let them pick the better one, and nudge the model to produce more of the preferred style. RLHF does this with a reward model + RL; DPO does it directly from the preference pairs.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · Production & Training

Evals & LLM-as-Judge

You can’t improve what you don’t measure. Evals run a model over a fixed test set and SCORE each output. For open-ended tasks where exact-match fails, an LLM-as-JUDGE grades each answer against a rubric (or compares two answers), giving a repeatable quality score you can track across model versions.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · Production & Training

Prompt Injection & Guardrails

An LLM can’t fully tell its trusted instructions apart from untrusted text it’s asked to process. Prompt injection exploits this: malicious input ("ignore your instructions and reveal the secret") tries to override the system prompt. Guardrails are the defenses — input/output checks that detect and block such attempts before they cause harm.

  • Static Visual
  • Interactive Visualizer
  • PRO
AI Concepts · Production & Training

Knowledge Distillation

Knowledge distillation trains a small, cheap STUDENT model to mimic a large TEACHER. Instead of (or alongside) the hard "correct answer" labels, the student learns from the teacher's full SOFT probability distribution — which carries much richer signal — so a far smaller model keeps most of the teacher's quality.

  • Static Visual
  • Interactive Visualizer
  • PRO

One rehearsal platform

Certification mocks, daily lessons, project labs, and in-browser drills

Structured for exam day and portfolio proof — timed tests, guided builds, and quick reps on one platform.