LLM fundamentals & architecture
What a language model actually does when it answers you, and which parts of the architecture you can feel in latency, quality and cost.
Most explanations of language models describe how they are trained. That is the wrong half for anyone who is going to use one. Training happened once, somewhere else, and you cannot change it. What you can change is the prompt, the parameters, the model and the route — and to reason about those you need a picture of what happens between your request arriving and the first token coming back.
These pages build that picture from the inference side. Where an architectural detail has no consequence you can observe, it is left out.
What Is a Large Language Model? A Working Definition
A definition built from what a model does at inference time, rather than from how it was trained.
6 min read
Autoregressive Generation: Why LLMs Write One Token at a Time
Why output is generated sequentially, and how that single constraint shapes latency, streaming and what you pay.
7 min read
Mixture of Experts: Why a 400B Model Can Cost Like a 40B One
How sparse activation separates a model's total size from the work each token costs, and what that means for price and memory.
7 min read
Attention Explained Without the Math
What attention actually computes, described as a lookup you already understand, with the linear algebra kept as a footnote.
6 min read
How a Transformer Actually Works, One Layer at a Time
One token followed from the tokenizer to the logits, with the real tensor shapes of a published 7B model at every step.
6 min read
Self-Attention vs Cross-Attention: What Each Is For
The same operation with a different source for keys and values, and why that one difference decides which architectures use which.
5 min read
Why Almost Every Modern LLM Is Decoder-Only
Three architectures competed for the same job. The one that won had denser training signal, one uniform interface and a cache that survives between turns.
6 min read
Model Parameters: What 7B, 70B and 400B Actually Buy You
What a parameter count does and does not predict, with the memory arithmetic it does predict worked out exactly.
6 min read
Positional Encoding: How a Model Knows Word Order
Why attention is blind to order by construction, and how sinusoidal, learned, RoPE and ALiBi each fix it with different consequences.
7 min read
Layer Normalisation, Residuals and Why Deep Nets Train at All
The two pieces that make a 100-layer stack trainable, and the pre-norm versus post-norm decision that used to decide whether training survived.
6 min read
The Softmax Bottleneck and What It Limits
A rank argument about the final layer: why the set of distributions a model can express is bounded by its hidden width, and what that does and does not stop.
6 min read
Temperature, Top-p and Top-k: A Practical Sampling Guide
What each sampling parameter does to the distribution, why stacking them hides which one is binding, and a script that builds the comparison table on your own prompt.
7 min read
Greedy Decoding vs Beam Search vs Sampling
Three different objectives dressed as three algorithms, why the one that maximises probability produces the worst prose, and which tasks each suits.
6 min read
What Logprobs Are and What You Can Actually Do With Them
The numbers behind the token the model chose, four things they are genuinely good for, and the ways they mislead.
6 min read
Base Models vs Instruct Models vs Chat Models
Three distinct artefacts that share a name, how each behaves when you prompt it, and the chat template that decides whether you get sense or noise.
6 min read
Scaling Laws: What Chinchilla Said and What Changed Since
The compute-optimal result, the arithmetic that quietly replaced it once models were served rather than published, and what the laws never covered.
7 min read
Emergent Abilities: Real Phenomenon or Measurement Artefact?
The claim that capabilities appear suddenly with scale, the metric-choice critique that undercut it, and what survives either way.
6 min read
Why Models Have a Knowledge Cutoff (And What Leaks Past It)
A cutoff is a property of a data pipeline, not a wall in the model — four mechanisms make it fuzzy, and a probe you can run on facts only you can date.
6 min read
Model Weights, Checkpoints and What “Open” Really Means
What is actually inside a released checkpoint, which formats carry which risks, and the licence clauses that decide whether you can ship it.
6 min read
Encoder Models Are Not Dead: Where BERT-Style Still Wins
Two structural differences — one forward pass instead of a decode loop, and token offsets instead of a string — that make a 110M encoder the right tool for several common jobs.
6 min read
Other topics
- Tokens, tokenization & context windows
- Prompt engineering
- Reasoning models & test-time compute
- Multimodal AI: vision, audio, video
- RAG & retrieval
- Embeddings & vector search
- AI agents & tool use
- Structured output & function calling
- Fine-tuning & post-training
- Local inference errors, string by string
- Running local models day to day
- Testing code that calls an LLM
- Snapshot and property testing for model output
- Regression suites for prompts
- Eval gates in CI
- Flaky tests against a model
- Determinism and the cost of testing
- Contract and streaming tests
- Testing tool calls and retrieval
- Inference, serving & latency
- Rolling out a prompt change
- Testing AI systems in practice
- Forecasting a time series
- Machine learning on tabular data
- Geospatial data and models
- Understanding audio that is not speech
- Understanding video
- Core computer vision tasks
- Machine learning on graphs
- Point clouds and 3D
- Evaluation, benchmarks & LLM-as-judge
- Sensor and IoT data
- Logs and event streams
- Models over biological sequences
- Machine learning on molecules
- Embedding and searching code
- Extracting invoices and purchase orders
- Receipts, statements and tax forms
- Insurance policies and contracts
- Deeds, court filings and patents
- Extracting from medical records
- Observability & LLMOps
- CVs, certificates and identity documents
- Shipping, customs and technical documents
- Meetings, email, chat and filled-in forms
- Building an extraction pipeline
- Business, property and inspection documents
- Contract clauses and insurance claims
- Regulated and compliance documents
- Consumer, travel and closing documents
- Mapping one chat API onto another
- SDK and framework migrations
- Hallucination & failure modes
- Re-embedding and model deprecation
- Cutting over between providers
- Parity gaps, shims and legacy endpoints
- Moving between model versions
- Migrating vector stores and caches
- Mapping capabilities and parameters
- Migrating pipelines and agents
- Contracts, runbooks and rollback
- Auditing a codebase before a cutover
- Compliance and fine-tune migration
- LLM cost engineering
- Routing, cost tracking and multi-tenancy
- What a migration does to your prompts
- AI security & prompt injection
- Privacy, compliance & data residency
- AI governance, policy & society
- Building reliable AI applications
- AI hardware, GPUs & compute
- Open-weight models & local inference
- AI for developers & coding agents
- AI in industry: vertical playbooks
- AGI, superintelligence, alignment & the long future
- Machine learning foundations
- NLP fundamentals & classical tasks
- Data engineering for AI
- Synthetic data & dataset curation
- AI product design & UX
- Search, ranking & recommendation
- Enterprise adoption & change management
- AI careers, skills & teams
- Reading AI research
- AI in science & discovery
- Robotics & embodied AI
- AI economics, markets & business models
- AI myths, hype & media literacy
- Context engineering
- Shipping AI features: patterns & anti-patterns
- Build it: end-to-end AI tutorials
- Python for AI: hands-on recipes
- TypeScript, React and the web
- Frameworks and SDKs
- Errors and troubleshooting
- AI facts, numbers and statistics
- The history of AI
- The maths behind AI
- Architectures beyond the transformer
- Reinforcement learning
- Diffusion and generative media
- Speech, audio and voice engineering
- Benchmarks, one at a time
- AI search visibility
- Infrastructure and operations
- Databases and storage for AI
- Knowledge graphs and structured knowledge
- Classical ML in production
- Regulation, jurisdiction by jurisdiction
- Prompt recipes and pattern library
- AI for people who do not write code
- Writing, media and creative work
- Edge and on-device AI
- Interpretability and model internals
- Field notes
- OpenAI model behaviour
- Claude model behaviour
- Gemini model behaviour
- Llama model behaviour
- Mistral model behaviour
- Qwen model behaviour
- DeepSeek model behaviour
- Cohere model behaviour
- Grok model behaviour
- Small model behaviour
- Hybrid model architectures
- Token cost by language and script
- Transliteration, romanization and script handling
- Locale-correct output
- Multilingual generation quality
- Multilingual pipelines
- The EU AI Act, article by article
- AI under the GDPR and EU data law
- US AI regulation, state and sector
- International AI governance and standards
- AI litigation and enforcement
- Running AI workloads on AWS
- Running AI workloads on Google Cloud
- Running AI workloads on Azure
- AI at the edge: Workers, Vercel and Netlify
- Serving models on Kubernetes
- Operating AI infrastructure
- Quantization formats and what they cost
- llama.cpp, flag by flag
- Ollama and the desktop local-model runtimes
- Local models on Apple Silicon
- Hardware for local inference
- Running speech and embedding models locally
- Model files, adapters and conversion
- VRAM arithmetic for local models