LLM

A large language model (LLM) is a neural network with billions of parameters, trained on internet-scale text to do one deceptively simple thing: predict the next token given the tokens so far. Scaled up far enough, that single objective produces systems that write fluent prose, answer questions, generate working code, translate languages, and follow instructions — capabilities nobody explicitly programmed in. GPT, Claude, Llama, and Gemini are all LLMs. The diagram traces what actually happens between a prompt going in and a word coming out.

Anatomy of a Large Language Model text in, one token out — repeated until the answer is complete "Write me a poem"raw text prompt Tokenizertext → integer token IDs Embeddings + positionIDs → vectors the model reads × N layers Self-attentiontokens exchange information Feed-forward (MLP)each token processed alone Unembed → logitsvector → score per token Next-token probabilitiessample one → append → repeat autoregressive loop Scale Parameters 10^9 – 10^12 weights Training tokens trillions of words Context window thousands – millions Objective predict the next token Emerges language, reasoning, code The whole model does one thing — predict the next token — and everything else is an emergent consequence of doing it at scale.

Everything is next-token prediction. During training the model sees enormous amounts of text with the next word hidden, and it adjusts its weights to raise the probability it would have assigned to the real next token. There is no separate "reasoning module" or "fact database" — grammar, world knowledge, translation, and arithmetic are all compressed into the weights as a side effect of getting good at this one guessing game.

The transformer block is the repeating unit. Each layer has two parts: a self-attention step, where every token looks at the others and pulls in the context it needs, and a feed-forward network that processes each position independently. Stacking dozens to over a hundred of these blocks lets early layers capture surface patterns and later layers capture meaning, syntax, and long-range structure.

Scale is the defining property. LLMs are distinguished from earlier language models by sheer size — parameters, training tokens, and compute. Empirical scaling laws show loss falling predictably as all three grow together, and certain abilities (in-context learning, multi-step reasoning) appear only past a size threshold. This predictability is why labs are willing to spend enormous sums on a single training run.

Pretraining teaches language; post-training teaches behavior. A raw pretrained model is a talented autocomplete engine but not yet a helpful assistant. A second stage — instruction tuning on curated examples, then reinforcement learning from human feedback (RLHF) — aligns it to follow instructions, stay on task, and refuse harmful requests. Most of the "personality" of a deployed chatbot comes from this phase, not pretraining.

Inference is autoregressive. To answer, the model generates one token, appends it to the input, and runs again — looping until it emits a stop token. Each step reuses cached attention state (the KV cache) so it does not recompute the whole history, which is why the first token is slow (prefill) and later tokens are fast (decode).

ComponentRoleAnalogy
Tokenizersplits text into subword tokensbreaking a sentence into Lego pieces
Embeddingsturn token IDs into vectorsgiving each piece coordinates in meaning-space
Attentiontokens share contexteveryone in the room comparing notes
Feed-forwardper-token processingeach token thinking on its own
Unembeddingvectors back to token scoresscoring every possible next word

Read an LLM through a *next-token-prediction* lens rather than a *knowledge-database* lens: it does not look facts up, it reconstructs the most probable continuation from patterns compressed into its weights during training. That single framing explains its strengths — fluency, generalization, in-context learning — and its failure modes — confident hallucination, sensitivity to phrasing, and knowledge frozen at its training cutoff — because all of them fall out of a system optimized to predict text rather than to store truth.

LLM — How a Language Model Generates Text predict the next token, one at a time, conditioned on everything before it Autoregressive Decoding (one step shown) context (input tokens): The capital of France is Transformer 96 layers, 96 heads ~175B parameters next token probs Paris 0.82 Lyon 0.04 the 0.03 Paris append token → repeat (autoregressive loop) What's Inside (GPT-style decoder-only) token embed +pos Self-Attention → FFN (×N layers) LM head Components per block: • Multi-head self-attention (causal mask) • Feed-forward network (4x expansion) • RMSNorm + residual connections • RoPE positional encoding KV cache stores past key/values (memory grows with seq len) Frontier LLMs (2024-2025) GPT-4o (OpenAI) ~1.8T params, MoE Claude 3.5 (Anthropic) 200K context Gemini 1.5 (Google) 1M token context Llama-3.1 405B (Meta) open weights DeepSeek-V3 (DeepSeek) 671B MoE, 37B active Qwen-2.5 72B (Alibaba) multilingual All decoder-only transformers. All trained on 10-15T tokens. The Economics Training: 100M+ USD, 10K-100K GPUs, months GPT-4: ~25K A100s for 90 days = ~100M USD compute Inference: cost/token matters at scale ~1B queries/day → serving costs > training costs Training is memory-bound (large models). Inference is latency-bound (time-to-first-token + tokens/sec). An LLM is a giant lookup table of language compressed into neural weights — next-token prediction is all it does. Predict the next word, at scale, trained on the internet. That's it. That's the revolution.

Take llm further

Ask the copilot about this term, or have our engineers assess it against your process.