Don Stephenson Don Stephenson

The AI Ecosystem Stack

What a modern AI system is built from, layer by layer, and who builds each layer.

Overview · How the layers fit together

Modern AI is not a single invention. A request passes through an application, a serving engine, a trained model and the silicon beneath it, and every answer depends on weights fixed long before, during training. Select a box to open its tab.
ONLINE · ANSWERING A REQUEST OFFLINE · BUILDING THE MODEL User or system tools and data Data text, code, images, human preferences Agents & Apps prompt, retrieval, tools, agent loop OPEN › Inference & Serving tokenize, batch, KV cache, decode OPEN › Models forward pass through N transformer blocks OPEN › Compute GPU / TPU matrix math OPEN › Training & Alignment pretrain, fine-tune, preference & RL OPEN › tokens stream back, one at a time call result trained weights training runs on accelerators
Who builds each part → the Landscape tab maps the labs, open models and platforms. Where to go deeper → the building blocks have pages of their own: Neural Networks, Mechanics, Attention, Interpretability and History.

Layer 1 · Compute

Training and running a neural network is matrix multiplication at enormous scale. The hardware layer sets what a model costs to train, how fast it answers, and where it can run.

GPUs

Thousands of parallel cores built for matrix math, with dedicated tensor units for low-precision arithmetic. NVIDIA's data-center GPUs (Hopper, Blackwell) train most frontier models; AMD's Instinct line is the main alternative.

Custom accelerators

Chips designed only for neural networks. Google's TPUs (now in their seventh generation) train and serve Gemini; AWS (Trainium, Inferentia) and Microsoft (Maia) build their own. Groq and Cerebras specialize in very fast inference.

On-device NPUs

Neural processing units in phones and laptops (Apple Neural Engine, Qualcomm Hexagon, Intel and AMD NPUs) run smaller models locally. Large unified memory lets some laptops run mid-size models.

Why memory bandwidth matters most. Generating each token means reading every active weight from memory once. A 70-billion-parameter model at 8 bits is 70 GB; on a GPU with 3.35 TB/s of high-bandwidth memory (HBM), that caps a single stream at about 48 tokens per second, however fast the arithmetic units are. This is why serving systems batch many users together, and why quantization (Inference tab) speeds models up.
Scaling out. Frontier models are trained on clusters of tens of thousands of accelerators joined by fast interconnects (NVLink, InfiniBand, TPU pods). The work is split three ways: data parallelism (each group sees different data), tensor parallelism (one layer's matrices split across chips) and pipeline parallelism (consecutive layers on different chips).

The software beneath the frameworks

LayerWhat it is
CUDANVIDIA's GPU programming platform and libraries (cuBLAS, cuDNN); the de facto standard since 2007.
ROCmAMD's open GPU software stack, the CUDA alternative.
XLA and JAXGoogle's compiler and array library; compile one program for TPUs or GPUs.
TritonWrite custom GPU kernels in Python; used by PyTorch's compiler.
PyTorchThe dominant deep-learning framework, on top of all of the above.
Metal, Vulkan, OpenCLCross-vendor and Apple GPU interfaces, used by local inference engines.

Research frontier: neuromorphic computing

Neuromorphic chips imitate the brain with spiking, event-driven circuits that use very little power. They suit sensing and control tasks; none yet runs large language models.

ChipMaker
Loihi 2Intel
TrueNorth, NorthPoleIBM
SpiNNaker 2TU Dresden, University of Manchester
Darwin 3Zhejiang University

Layer 2 · Models

Every architecture below is built from the same unit, a layer h = σ(Wx + b). They differ in how they connect those layers, and above all in how they handle sequences.

The architecture families

FamilyCore ideaWhere it is used today
MLP / feed-forwardStacked fully connected layers; can approximate any continuous function (UAT, 1989).Inside every transformer block, as its feed-forward sub-layer.
CNN · convolutionalSmall filters slide over an image, sharing weights across positions.Vision on devices, image encoders, audio.
RNN, LSTM · recurrentA hidden state carried from step to step; LSTM gates keep information over long spans.Largely replaced by transformers for language; still in small on-device and time-series models.
Transformer (2017)Self-attention lets every token look at every other token; trains in parallel.All frontier language models. Encoder (BERT) for embeddings and search; decoder-only (GPT, Llama, Qwen, Claude, Gemini) for generation.
Mixture of ExpertsA router sends each token to a few of many expert feed-forward networks.Most of the largest models (DeepSeek-V3, Mixtral, Kimi K2): huge capacity, modest compute per token.
State-space modelsA recurrent state updated in linear time, trainable in parallel (Mamba, 2023).Long-sequence models and transformer–SSM hybrids.
Diffusion modelsLearn to remove noise step by step, generating by denoising from random noise.Image, video and audio generation.

Sequence models compared

RNN / LSTMTransformerState-space (Mamba)
TrainingSequential, step by stepParallel across the whole sequenceParallel
Memory of contextA fixed-size hidden stateThe full context, through attentionA fixed-size, input-dependent state
Cost per new tokenConstantGrows with context length (KV cache)Constant
StrengthSimple, smallPrecise recall over long contexts; scales bestVery long sequences, cheaply

Anatomy of a modern transformer block

RMSNorm Multi-Head Attention Q, K, V projections · RoPE on Q, K grouped-query K/V heads softmax(QKᵀ/√d)·V → output proj. + RMSNorm Feed-Forward (SwiGLU) gate and up projections, d → d_ff SiLU(gate) ⊙ up down projection, d_ff → d + hidden state x (from embeddings or the previous block) to the next block · repeated N times RESIDUAL STREAM
Where the parameters are

Attention holds about 4·d² parameters per block (the Q, K, V and output matrices; fewer with grouped-query attention). A SwiGLU feed-forward holds 3·d·dff; with dff ≈ (8/3)·d that is about 8·d², two-thirds of the block. The original transformer's 4× ReLU feed-forward gives the same 2 : 1 ratio.

In a Mixture-of-Experts model the feed-forward is replaced by many experts, and a router activates only a few per token.

RMSNorm rescales each token's vector before each sub-layer. RoPE encodes position by rotating queries and keys. The residual stream carries each token's vector through all N blocks, and each sub-layer adds its result to it.

Activation functions in use

ReLU

xy
ReLU(x) = max(0, x) · the classic deep-network activation

GELU

xy
GELU(x) = x·Φ(x) · a smooth ReLU, used in BERT and GPT models

SiLU (Swish) and SwiGLU

xy
SiLU(x) = x·σ(x) · SwiGLU = SiLU(xW) ⊙ xV, in Llama, Qwen, Mistral

Softmax

Sum = 1 p₁p₂p₃p₄
softmax(z)ᵢ = ezᵢ / Σⱼ ezⱼ · turns scores into probabilities, in attention and at the output
See also → Neural Networks for the single-layer equation, Activation to explore these curves, and Attention to watch attention weights form.

Layer 3 · Training & Alignment

A model's abilities and its behavior are both set during training. Pretraining gives it knowledge and language; the later stages turn that into a helpful, honest and safe assistant.

From raw data to assistant

DataWeb text, books, code, images — filtered, deduplicated, trillions of tokens.
TokenizationText split into subword tokens (byte-pair encoding).
PretrainingSelf-supervised next-token prediction; weeks to months on large clusters.
Supervised fine-tuningSFT on curated instruction-and-answer examples.
Preference tuningRLHF (reward model + PPO) or DPO, from ranked pairs of answers.
Reasoning RLReinforcement learning on problems with checkable answers (math, code): long chains of thought.
EvaluationBenchmarks, red-teaming and safety testing before release.
Scaling laws. Loss falls predictably as parameters, data and compute grow (Kaplan, 2020). For a fixed training budget, the compute-optimal mix is about 20 tokens per parameter (Chinchilla, 2022). Today's models are trained far past that point, because a smaller model trained longer is cheaper to run for every user.
Reasoning models. Since 2024, models such as OpenAI's o-series and DeepSeek-R1 are trained with reinforcement learning to think step by step before answering. Accuracy then also scales with test-time compute: the more reasoning tokens allowed, the better the answer.

Adapting a trained model

MethodWhat it does
In-context learningInstructions and examples in the prompt; no weights change (Agents tab).
Full fine-tuningContinue training all weights on task data; most powerful, most expensive.
LoRA / QLoRATrain small low-rank matrices beside frozen (or 4-bit) weights; fine-tuning on a single GPU.
Knowledge distillationA small student model learns to imitate a larger teacher's outputs.
Direct Preference OptimizationPrompt → two answers → which is preferred → update. Aligns to preferences without a separate reward model.

Alignment and safety

Failure modes →
Reward hackingScoring well on the training signal without doing the intended task.
SycophancyTelling users what they want to hear rather than what is true.
HallucinationFluent, confident statements that are false.
Deceptive alignmentBehaving well when observed and differently otherwise; demonstrated in research settings ("alignment faking").
Jailbreaks and prompt injectionCrafted inputs that override instructions or safety training.
← Defenses
RLHF and Constitutional AITrain behavior from human preferences or from written principles with AI feedback.
Evaluations and red-teamingSystematic tests for dangerous capabilities and failure modes before release.
Mechanistic interpretabilityReverse-engineer what the network computes internally, feature by feature.
Scalable oversightMethods for supervising tasks too complex for unaided humans to check.
Guardrails and monitoringClassifiers on inputs and outputs, and monitoring of deployed systems.
See also → Interpretability — why single neurons often respond to unrelated concepts (polysemanticity and superposition), and how researchers untangle them; and Gradient Descent for the optimization behind every training stage.

Layer 4 · Inference & Serving

Answering a prompt happens in two phases. Prefill processes the whole prompt in parallel; decode then generates one token at a time, each step reading the model's weights again. Serving is the art of making those two phases cheap, fast and shared by many users.

The techniques that make serving practical

TechniqueWhat it doesEffect
QuantizationStore weights in 8 or 4 bits instead of 16 (formats such as GGUF, GPTQ, AWQ).2–4× less memory, faster decode, small accuracy cost.
KV cacheKeep each past token's keys and values so they are not recomputed.Fast decode; memory grows with context length.
GQA and latent attentionShare or compress keys and values across heads.A much smaller KV cache, longer contexts.
Continuous batchingAdd and remove requests from the running batch at every step.Many users per GPU, high throughput.
PagedAttentionManage KV-cache memory in pages, like an operating system.Little wasted memory, more concurrent requests.
FlashAttentionCompute attention in on-chip memory tiles.Faster attention, practical long contexts.
Prefix cachingReuse the cache for prompts that share a beginning (system prompts, documents).Lower latency and cost for repeated context.
Speculative decodingA small draft model proposes tokens; the large model verifies several at once.2–3× faster output, identical results.

Decoding settings

SettingEffect on the next token
GreedyAlways the most probable token; deterministic.
TemperatureBelow 1 sharpens the distribution (focused); above 1 flattens it (varied).
Top-kSample only among the k most probable tokens.
Top-p (nucleus)Sample among the smallest set of tokens whose probabilities add up to p.

Open-source serving engines

EngineTypical use
vLLMHigh-throughput GPU serving; introduced PagedAttention.
SGLangGPU serving with fast structured output and prefix reuse.
TensorRT-LLMNVIDIA's optimized GPU inference library.
llama.cppCPU, Apple and consumer-GPU inference; the GGUF format.
OllamaOne-command local model runner built on llama.cpp.

Local or cloud?

Local (your machine or servers)Cloud API
DataNever leaves your control.Sent to the provider.
Model sizeLimited by memory: a 4-bit 8B model needs about 5 GB; a 70B model about 40 GB.The largest frontier models.
CostHardware up front, then nearly free per token.Pay per token; no hardware.
AvailabilityWorks offline.Needs a connection; subject to rate limits.
LicensingOpen-weights models only, under their licenses.Any model the provider offers.

Layer 5 · Agents & Applications

A model on its own only continues text. Applications give it context to read, tools to use and a loop to work in. This top layer is where most products, and most current innovation, live.

Prompting and in-context learning

PatternRecipe
Zero-shotA task description only.
Few-shotA description plus a few worked examples; behavior adapts without changing weights.
Chain of thoughtAsk for step-by-step reasoning before the answer.
System promptStanding instructions that frame every conversation.
Structured outputConstrain the answer to a JSON schema a program can read.

Retrieval-augmented generation (RAG)

IndexSplit documents into chunks and embed them as vectors.
RetrieveFind the chunks closest to the question.
AugmentAdd them to the prompt.
GenerateAnswer from the sources, with citations.

RAG grounds answers in current, private or specialized knowledge without retraining the model.

The agent loop

GoalA task from a user or another agent.
ReasonThe model plans the next step.
ActIt calls a tool: search, code, a database, an API.
ObserveThe tool's result returns to the context.
Repeat or finishLoop until the goal is met, then answer.

This reason-act-observe loop (ReAct, 2022) underlies coding agents, research assistants and computer-use agents.

Multi-agent systems

RoleResponsibility
OrchestratorBreaks the goal into tasks and assigns them.
SpecialistsAgents with focused prompts and tools (researcher, coder, analyst).
Critic or verifierChecks results and sends work back for revision.
MemoryA shared store (often a vector database) of facts and progress.
Tool executorsRun code and call APIs on the agents' behalf, with permissions.

Protocols and frameworks

Model Context ProtocolAnthropic, 2024 — an open standard connecting agents to tools and data sources.
Agent2Agent ProtocolGoogle, 2025 — an open standard for agents to discover and delegate to each other.
Function callingThe model emits a structured call; the application executes it.
Open-source frameworksLangChain and LangGraph, LlamaIndex, Microsoft Agent Framework, CrewAI; visual builders such as Flowise.
Research direction: latent communication. Instead of exchanging text, agents pass internal vector representations to each other directly (for example LatentMAS, 2025), avoiding the cost of writing and re-reading tokens.

Landscape · Who builds the stack

Who builds each part of the stack. The field moves quickly; this map reflects 2026.

Proprietary frontier models

OpenAIGPT, o-series reasoning models
AnthropicClaude
Google DeepMindGemini
xAIGrok

Open-weights models

MetaLlama
AlibabaQwen
DeepSeekDeepSeek-V3, R1
Mistral AIMistral, Mixtral
Moonshot AIKimi K2
Google, OpenAIGemma, gpt-oss

Platforms and tools

Hugging FaceModel and dataset hub
Cloud AI platformsAWS Bedrock, Azure AI Foundry, Google Vertex AI
Scale AITraining data and evaluation
LMArenaPublic model leaderboard

Voices shaping the field

Geoffrey HintonDeep-learning pioneer; 2024 Nobel Prize in Physics; warns of AI risk.
Yoshua BengioDeep-learning pioneer; leading voice for AI safety research.
Yann LeCunConvolutional-network pioneer; advocate of world models and open research.
Demis HassabisGoogle DeepMind; 2024 Nobel Prize in Chemistry for AlphaFold.
Ilya SutskeverSafe Superintelligence Inc.
Fei-Fei LiImageNet; spatial intelligence research.
Andrej KarpathyResearcher and educator on how LLMs work.
Tristan HarrisCenter for Humane Technology; technology ethics.

Horizon vectors

↗ Health and discovery. AlphaFold predicts protein structures; Isomorphic Labs builds on it for drug discovery. AI is becoming a tool of science itself.
↘ Loss of control. Scenarios such as AI 2027 (AI Futures Project, Daniel Kokotajlo) describe how rapidly self-improving systems could outrun human oversight.
The frontier of artificial intelligence is no longer only about capability — it is about control.