Home › Glossary › Generative AI › Large Language Model (LLM)

Beginner · Generative AI

Large Language Model (LLM)

Visual diagram · (in preparation) · Math · (in preparation) · Worked example · 3 difficulty levels.

TL;DR. LLMs are massive AI models trained on internet-scale text data that can understand, generate, and reason about human language. GPT-4, Claude, and LLaMA are examples.

Intuitive Explanation

An LLM is like someone who has read the entire internet — every book, article, forum post, and codebase — and can now write fluently about any topic. It doesn't 'understand' like a human, but it has incredibly powerful pattern matching that makes its responses appear intelligent and informed.

Technical Definition

A Large Language Model is a Transformer-based neural network with billions to trillions of parameters, trained on massive text corpora using next-token prediction (autoregressive modeling). Through scale, LLMs exhibit emergent capabilities including in-context learning, chain-of-thought reasoning, and instruction following, especially after supervised fine-tuning and RLHF alignment.

How it works

LLMs represent the most significant advance in AI since deep learning itself. **Training Pipeline:** 1. **Pre-training:** Next-token prediction on trillions of tokens (web text, books, code). Cost: millions of dollars in compute. 2. **Supervised Fine-Tuning (SFT):** Train on curated instruction-response pairs to follow directions. 3. **RLHF/DPO Alignment:** Use human preferences to make outputs helpful, harmless, and honest. **Scaling Laws:** Chinchilla scaling laws show that performance scales predictably with compute, model size, and data quantity. Roughly: loss ∝ N^(-0.076) × D^(-0.095), where N = parameters and D = tokens. **Emergent Capabilities:** At sufficient scale, LLMs exhibit abilities not explicitly trained for: - In-context learning: solving new tasks from just a few examples in the prompt - Chain-of-thought reasoning: solving multi-step problems when prompted to "think step by step" - Code generation: writing functional programs in multiple languages - Tool use: learning to call APIs, calculators, and search engines **Limitations:** - **Hallucination:** Generating confident but false information - **Knowledge cutoff:** Training data has a temporal boundary - **Context window:** Limited amount of text that can be processed at once - **Reasoning gaps:** Still struggle with complex multi-step logic and math - **Cost:** Inference at scale is expensive (GPU compute)

Real-World Use Cases

  • OpenAI: ChatGPT serves over 100M users for writing, coding, analysis, and creative tasks
  • Microsoft: Copilot integrates GPT-4 into Office, Windows, and GitHub for productivity
  • Google: Gemini powers search, Workspace, and Android AI features
  • Anthropic: Claude provides AI assistance with a focus on safety and helpfulness

Related Concepts

  • Transformer — An architecture that uses self-attention to process sequences in parallel, powering modern language models like GPT and BERT.
  • Attention Mechanism — A technique that lets models dynamically focus on the most relevant parts of the input when producing each output element.
  • Embedding — A dense vector representation that captures semantic meaning, mapping discrete items like words into continuous mathematical space.
  • Fine-Tuning — Adapting a pre-trained model to a specific task by continuing training on a smaller, task-specific dataset.

Further Reading

  • OpenAI — GPT-4 Technical Report