How LLMs Work
The architecture and training behind modern LLMs
- Transformer architecture
The Transformer is a neural network architecture built entirely on self-attention and feedforward layers, introduced in the 2017 "Attention Is All You Need" paper, and the foundation of virtually all modern LLMs.
7sourcesupdated 1 week ago - Autoregressive text generation
LLMs generate text by iteratively predicting one token at a time, converting final-layer vectors into probability distributions over vocabulary via an unembedding matrix and softmax, with temperature and decoding strategies controlling the creativity–coherence tradeoff.
6sourcesupdated 1 week ago - Word embeddings and tokenization
LLMs represent language as high-dimensional numeric vectors, converting raw text into tokens and then embeddings that encode semantic relationships geometrically — the foundation on which attention and all downstream computation operate.
6sourcesupdated 1 week ago - Self-attention mechanism
Self-attention is the core computational primitive of the Transformer, allowing every position in a sequence to directly attend to every other position by computing query, key, and value vectors and weighting their contributions via scaled dot-product scores.
6sourcesupdated 1 week ago - LLM training and pretraining
Training a modern LLM happens in two main stages — expensive self-supervised pretraining on massive text corpora followed by cheaper supervised finetuning and optional RLHF — with performance scaling predictably as a power law of parameters and data.
5sourcesupdated 1 week ago - LLM capabilities, limits, and future directions
Beyond text generation, LLMs are increasingly framed as general-purpose reasoning kernels that coordinate tools, memory, and multimodal inputs — but they remain System 1 thinkers, constrained by context windows, unidirectional knowledge, and the absence of robust deliberate reasoning.
3sourcesupdated 1 week ago - Reinforcement learning from human feedback (RLHF)
RLHF aligns LLMs with human preferences by training a reward model on ranked human comparisons and then optimizing the language model policy against it via proximal policy optimization, with DPO and related direct alignment algorithms offering simpler alternatives.
2sourcesupdated 1 week ago - Retrieval-augmented generation (RAG)
RAG extends LLMs by retrieving relevant documents from an external knowledge base at inference time and injecting them into the prompt, grounding responses in up-to-date or domain-specific information without retraining the model.
1sourceupdated 1 week ago - Mixture of Experts (MoE)
Mixture of Experts is an ensemble architecture where a learned gating function routes each input to a subset of specialized sub-networks, enabling massive parameter counts while keeping per-token compute tractable — a key strategy for scaling modern LLMs.
1sourceupdated 1 week ago - Fine-tuning and parameter-efficient adaptation
Fine-tuning adapts a pretrained model to a downstream task by continuing training on new data, with parameter-efficient methods like LoRA and adapters enabling this at a fraction of the cost by updating only a small subset of weights.
1sourceupdated 1 week ago - LLM security vulnerabilities
As LLMs are deployed as agentic systems that read external data and take actions, they become vulnerable to jailbreaking, prompt injection, and data poisoning — three distinct attack classes that exploit the model's inability to distinguish trusted instructions from adversarial inputs.
1sourceupdated 1 week ago