Skip to content
AI & Machine LearningAll explainers

Large language models (LLMs) demystified

A plain-language reference on LLM meaning: what a large language model is, how it predicts tokens, base vs instruction-tuned models, context windows, deployment patterns, and the limits you design around in production.

Published: Updated: Reading time: 6 min
On this page

A large language model (LLM) is a neural network trained on very large text corpora to predict the next token in a sequence. That one objective, guessing what comes next, produces models that summarize, translate, write code, answer questions, and follow instructions. GPT, Claude, Gemini, and Llama are all large language model families.

How an LLM produces text

The model converts your prompt into tokens, runs them through a transformer, and outputs a probability distribution over the next token. It samples one token, appends it, and repeats until it hits a stop signal. Everything the model "knows" lives in its weights plus whatever you put in the prompt. It has no live view of your data unless you hand it tools or context.

There's no lookup and no database underneath. The ability to explain, plan, and work through problems comes out of training a big network on a lot of text. Newer reasoning models, trained to work through problems step by step, do much better on multistep tasks than plain next-token prediction suggests. They still don't reason the way people do, and their reasoning can fail without warning, so check the output on anything that matters.

Base vs instruction-tuned models

Base modelInstruction-tuned model
Trained onRaw text, to predict what comes nextA base model plus instruction and response pairs, then human feedback or other preference tuning
BehaviorCompletes patterns, doesn't reliably follow instructionsBehaves like an assistant and follows instructions
Where you meet itOpen-weight repos, researchAlmost every product-facing API

The base model is the raw capability; instruction tuning makes it usable. If you've ever grabbed a model off an open-weight repo and wondered why it won't answer your question, you probably downloaded the base version.

Tokens and context windows

Two numbers shape most of what you can build: how the model chunks text, and how much of it the model can hold at once.

A token is the unit a model reads and writes. In English, one token runs about three-quarters of a word, so a 4,000-word document is roughly 5,300 tokens. Non-English text and code tokenize differently, usually less efficiently. The context window is the hard ceiling on tokens the model can attend to in a single request, prompt and response combined.

In 2026, frontier models from OpenAI, Anthropic, and Google commonly offer context windows of hundreds of thousands of tokens, with top models reaching around a million. Limits change often, so check each vendor's model card. Open-weight models are uneven: some families, such as Meta's Llama 4 Scout, advertise multi-million token windows, but self-hosted deployments often run at 64K to 256K because GPU memory runs out first. Bigger windows let you drop whole documents into the prompt. They also cost more, run slower, and many models still lose track of detail buried in the middle of a long context.

What LLMs are good and bad at

Good at: drafting and rewriting text, summarizing long inputs, translating, generating and explaining code, extracting structure from messy input, and answering questions when you supply the source material.

Bad at: exact arithmetic (a bare model is unreliable here unless it calls a calculator or code tool), anything needing current facts it wasn't trained on, and tasks that demand a guarantee of correctness. It'll produce fluent, confident text even when it's wrong, and it has no reliable sense of its own uncertainty. For high-stakes work, treat the output as a strong first draft that a human or a second system checks.

In practice, an LLM is fast and knows a lot, but you can't trust every answer. Plan for that from the first prototype.

How teams actually deploy LLMs

Most production systems start with prompting and add more machinery only when prompting stops being enough. The LLM development guide walks through that build path in detail.

  • Prompting first. Careful instructions, examples, and a good system prompt cover many use cases without touching model weights. It's the fastest thing to change, so it's where you start.
  • Retrieval-augmented generation. Pull relevant passages from your own data and inject them into the prompt so the model answers from current, grounded material. Choose retrieval-augmented-generation when the challenge is access to a large or changing knowledge base.
  • Tool and function calling. Give the model a schema of tools, such as search, code execution, or database queries, and it returns structured calls instead of plain text. Tools also cover exact computation. This is the foundation of ai-agents that orchestrate real systems.
  • Fine-tuning. Adjust the weights on task-specific data when you need a stable behavior prompting can't enforce, like a fixed format or a narrow classification task at volume. The fine-tuning guide covers when it pays off. Reach for it last, because it's the most expensive to build and change.

Retrieval adds knowledge; fine-tuning changes behavior. Plenty of real systems use all four at once: a frontier model with retrieval and tools, plus a small fine-tune for one niche task.

Limits you design around with LLMs

  • Hallucination. The model can state plausible, confident falsehoods, especially about specifics outside its training data. Ground answers in retrieved sources and verify anything high-stakes. NIST calls this risk confabulation in its AI 600-1 Generative AI Profile.
  • Knowledge cutoff. Weights freeze at training time, so the model doesn't know events after its cutoff unless you feed it fresh context through a prompt or a tool.
  • Cost and latency at scale. Big contexts, long outputs, and multi-tool workflows get expensive and slow. Teams route simple work to cheaper models and cache aggressively to keep the bill sane.
  • Prompt injection. Untrusted text in a document or web page can smuggle in instructions that hijack the model. Any system that reads outside content and can act on it needs input filtering and output checks. Prompt injection is LLM01 in the 2025 edition of the OWASP Top 10 for LLM Applications.

You can work around each of these, but it takes engineering. That's why production LLM work is real AI development, not a prompt in a text box. LLMs sit under most modern AI features, including generative AI development products and retrieval systems. Our LLM integration guide covers the guardrails that keep those systems reliable once real users hit them.

Frequently asked questions

  • No, but they overlap. Generative AI is the umbrella for any model that makes new content, including images, audio, and video. An LLM is the text-and-code branch of that family. Every LLM is generative AI; not all generative AI is an LLM.

  • Not in the way people do. An LLM learns statistical patterns over tokens, so it predicts what text usually follows other text. That's enough to answer questions, write code, and hold a conversation, and newer reasoning models handle multistep problems better than older ones. Still, the model has no reliable sense of when it's wrong, which is why it can sound confident and be mistaken.

  • Size means two things here, parameters and context. Frontier models run into the hundreds of billions of parameters, though vendors rarely publish exact counts, and mixture-of-experts models report total and active parameters differently. Context windows in 2026 range from hundreds of thousands of tokens up to around a million for top models. Self-hosted open-weight deployments often run at 64K to 256K tokens in practice, even when the model family advertises more.

  • A token is the unit of text a model reads and writes. It can be a whole word, a piece of one, punctuation, or a space. For English prose, one token is roughly three-quarters of a word, so 1,000 tokens is about 750 words. Tokenization is model-specific, so counts shift between models, but that heuristic is close enough for planning.

  • Fine-tune when you need a stable behavior a prompt can't reliably enforce, like a fixed output format, a narrow classification task, or a brand voice at high volume. Start with prompting plus retrieval, which is far cheaper to change. Don't fine-tune to add facts. If the model is missing knowledge, use retrieval instead.

Still unanswered
Ask us directly

A senior engineer replies under 4 hours.

Related expertise