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
Layer 1 · Compute
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.
The software beneath the frameworks
| Layer | What it is |
|---|---|
| CUDA | NVIDIA's GPU programming platform and libraries (cuBLAS, cuDNN); the de facto standard since 2007. |
| ROCm | AMD's open GPU software stack, the CUDA alternative. |
| XLA and JAX | Google's compiler and array library; compile one program for TPUs or GPUs. |
| Triton | Write custom GPU kernels in Python; used by PyTorch's compiler. |
| PyTorch | The dominant deep-learning framework, on top of all of the above. |
| Metal, Vulkan, OpenCL | Cross-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.
| Chip | Maker |
|---|---|
| Loihi 2 | Intel |
| TrueNorth, NorthPole | IBM |
| SpiNNaker 2 | TU Dresden, University of Manchester |
| Darwin 3 | Zhejiang University |
Layer 2 · Models
The architecture families
| Family | Core idea | Where it is used today |
|---|---|---|
| MLP / feed-forward | Stacked fully connected layers; can approximate any continuous function (UAT, 1989). | Inside every transformer block, as its feed-forward sub-layer. |
| CNN · convolutional | Small filters slide over an image, sharing weights across positions. | Vision on devices, image encoders, audio. |
| RNN, LSTM · recurrent | A 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 Experts | A 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 models | A recurrent state updated in linear time, trainable in parallel (Mamba, 2023). | Long-sequence models and transformer–SSM hybrids. |
| Diffusion models | Learn to remove noise step by step, generating by denoising from random noise. | Image, video and audio generation. |
Sequence models compared
| RNN / LSTM | Transformer | State-space (Mamba) | |
|---|---|---|---|
| Training | Sequential, step by step | Parallel across the whole sequence | Parallel |
| Memory of context | A fixed-size hidden state | The full context, through attention | A fixed-size, input-dependent state |
| Cost per new token | Constant | Grows with context length (KV cache) | Constant |
| Strength | Simple, small | Precise recall over long contexts; scales best | Very long sequences, cheaply |
Anatomy of a modern transformer block
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
GELU
SiLU (Swish) and SwiGLU
Softmax
Layer 3 · Training & Alignment
From raw data to assistant
Adapting a trained model
| Method | What it does |
|---|---|
| In-context learning | Instructions and examples in the prompt; no weights change (Agents tab). |
| Full fine-tuning | Continue training all weights on task data; most powerful, most expensive. |
| LoRA / QLoRA | Train small low-rank matrices beside frozen (or 4-bit) weights; fine-tuning on a single GPU. |
| Knowledge distillation | A small student model learns to imitate a larger teacher's outputs. |
| Direct Preference Optimization | Prompt → two answers → which is preferred → update. Aligns to preferences without a separate reward model. |
Alignment and safety
| Reward hacking | Scoring well on the training signal without doing the intended task. |
| Sycophancy | Telling users what they want to hear rather than what is true. |
| Hallucination | Fluent, confident statements that are false. |
| Deceptive alignment | Behaving well when observed and differently otherwise; demonstrated in research settings ("alignment faking"). |
| Jailbreaks and prompt injection | Crafted inputs that override instructions or safety training. |
| RLHF and Constitutional AI | Train behavior from human preferences or from written principles with AI feedback. |
| Evaluations and red-teaming | Systematic tests for dangerous capabilities and failure modes before release. |
| Mechanistic interpretability | Reverse-engineer what the network computes internally, feature by feature. |
| Scalable oversight | Methods for supervising tasks too complex for unaided humans to check. |
| Guardrails and monitoring | Classifiers on inputs and outputs, and monitoring of deployed systems. |
Layer 4 · Inference & Serving
The techniques that make serving practical
| Technique | What it does | Effect |
|---|---|---|
| Quantization | Store 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 cache | Keep each past token's keys and values so they are not recomputed. | Fast decode; memory grows with context length. |
| GQA and latent attention | Share or compress keys and values across heads. | A much smaller KV cache, longer contexts. |
| Continuous batching | Add and remove requests from the running batch at every step. | Many users per GPU, high throughput. |
| PagedAttention | Manage KV-cache memory in pages, like an operating system. | Little wasted memory, more concurrent requests. |
| FlashAttention | Compute attention in on-chip memory tiles. | Faster attention, practical long contexts. |
| Prefix caching | Reuse the cache for prompts that share a beginning (system prompts, documents). | Lower latency and cost for repeated context. |
| Speculative decoding | A small draft model proposes tokens; the large model verifies several at once. | 2–3× faster output, identical results. |
Decoding settings
| Setting | Effect on the next token |
|---|---|
| Greedy | Always the most probable token; deterministic. |
| Temperature | Below 1 sharpens the distribution (focused); above 1 flattens it (varied). |
| Top-k | Sample 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
| Engine | Typical use |
|---|---|
| vLLM | High-throughput GPU serving; introduced PagedAttention. |
| SGLang | GPU serving with fast structured output and prefix reuse. |
| TensorRT-LLM | NVIDIA's optimized GPU inference library. |
| llama.cpp | CPU, Apple and consumer-GPU inference; the GGUF format. |
| Ollama | One-command local model runner built on llama.cpp. |
Local or cloud?
| Local (your machine or servers) | Cloud API | |
|---|---|---|
| Data | Never leaves your control. | Sent to the provider. |
| Model size | Limited by memory: a 4-bit 8B model needs about 5 GB; a 70B model about 40 GB. | The largest frontier models. |
| Cost | Hardware up front, then nearly free per token. | Pay per token; no hardware. |
| Availability | Works offline. | Needs a connection; subject to rate limits. |
| Licensing | Open-weights models only, under their licenses. | Any model the provider offers. |
Layer 5 · Agents & Applications
Prompting and in-context learning
| Pattern | Recipe |
|---|---|
| Zero-shot | A task description only. |
| Few-shot | A description plus a few worked examples; behavior adapts without changing weights. |
| Chain of thought | Ask for step-by-step reasoning before the answer. |
| System prompt | Standing instructions that frame every conversation. |
| Structured output | Constrain the answer to a JSON schema a program can read. |
Retrieval-augmented generation (RAG)
RAG grounds answers in current, private or specialized knowledge without retraining the model.
The agent loop
This reason-act-observe loop (ReAct, 2022) underlies coding agents, research assistants and computer-use agents.
Multi-agent systems
| Role | Responsibility |
|---|---|
| Orchestrator | Breaks the goal into tasks and assigns them. |
| Specialists | Agents with focused prompts and tools (researcher, coder, analyst). |
| Critic or verifier | Checks results and sends work back for revision. |
| Memory | A shared store (often a vector database) of facts and progress. |
| Tool executors | Run code and call APIs on the agents' behalf, with permissions. |
Protocols and frameworks
| Model Context Protocol | Anthropic, 2024 — an open standard connecting agents to tools and data sources. |
| Agent2Agent Protocol | Google, 2025 — an open standard for agents to discover and delegate to each other. |
| Function calling | The model emits a structured call; the application executes it. |
| Open-source frameworks | LangChain and LangGraph, LlamaIndex, Microsoft Agent Framework, CrewAI; visual builders such as Flowise. |
Landscape · Who builds the stack
Proprietary frontier models
| OpenAI | GPT, o-series reasoning models |
| Anthropic | Claude |
| Google DeepMind | Gemini |
| xAI | Grok |
Open-weights models
| Meta | Llama |
| Alibaba | Qwen |
| DeepSeek | DeepSeek-V3, R1 |
| Mistral AI | Mistral, Mixtral |
| Moonshot AI | Kimi K2 |
| Google, OpenAI | Gemma, gpt-oss |
Platforms and tools
| Hugging Face | Model and dataset hub |
| Cloud AI platforms | AWS Bedrock, Azure AI Foundry, Google Vertex AI |
| Scale AI | Training data and evaluation |
| LMArena | Public model leaderboard |
Voices shaping the field
| Geoffrey Hinton | Deep-learning pioneer; 2024 Nobel Prize in Physics; warns of AI risk. |
| Yoshua Bengio | Deep-learning pioneer; leading voice for AI safety research. |
| Yann LeCun | Convolutional-network pioneer; advocate of world models and open research. |
| Demis Hassabis | Google DeepMind; 2024 Nobel Prize in Chemistry for AlphaFold. |
| Ilya Sutskever | Safe Superintelligence Inc. |
| Fei-Fei Li | ImageNet; spatial intelligence research. |
| Andrej Karpathy | Researcher and educator on how LLMs work. |
| Tristan Harris | Center for Humane Technology; technology ethics. |
