If you’ve used ChatGPT, Copilot, or any “AI assistant,” you’ve interacted with an LLM: a Large Language Model.
At a high level, an LLM is a model trained on huge amounts of text so it can predict what comes next. That single capability—next-token prediction—turns out to be enough to produce many behaviors we care about: answering questions, summarizing, writing code, translating, planning, and tutoring.
But it’s important to understand what an LLM is not: it’s not a database of facts, it doesn’t “know” things the way humans do, and it doesn’t have reliable, persistent memory unless we build systems around it.
The core idea: predicting tokens
LLMs don’t directly “predict words.” They predict tokens—small chunks of text (a word, part of a word, punctuation, or even whitespace). When you type a prompt, it’s converted into tokens. The model then predicts the most likely next token, appends it, and repeats.
That loop is called inference.
Because the model can choose different tokens depending on settings like temperature, it can produce:
- deterministic, “boring but stable” outputs (low temperature)
- creative outputs (higher temperature)
Training vs. using (why it feels smart)
There are two distinct phases:
1) Training (expensive, offline)
During training, the model reads a massive dataset and adjusts internal weights to minimize prediction error. It learns patterns like:
- grammar and style
- common structures of reasoning in text
- code syntax and “how code tends to be written”
- relationships between concepts (implicitly, statistically)
This is why LLMs can generalize. They don’t store every sentence; they learn a compressed representation of patterns.
2) Inference (interactive, online)
When you use an LLM, it’s not “searching the web” (unless the product adds browsing). It’s generating the most probable continuation based on:
- your prompt (context)
- its learned weights
- any system rules the product applies
Why LLMs hallucinate
Hallucination is a feature of the underlying objective: make plausible text.
If the prompt asks for something the model doesn’t confidently know, it may still produce a fluent answer because that’s literally what it is trained to do. This is why good LLM systems:
- use retrieval (RAG) for factual grounding
- enforce tool usage for data access (DB queries, APIs)
- add validations (schemas, unit tests, post-checks)
Context window: the “working memory” limit
An LLM has a context window: the maximum amount of tokens it can “see” at once (your prompt + conversation + tool outputs + its own response).
Key consequences:
- It can “forget” earlier messages if the conversation grows too long.
- Long documents can’t be fully ingested without chunking/summarization.
- “Memory” in most apps is not model memory—it’s a product feature (stored notes, embeddings, user profiles).
LLMs in products: the three building blocks
In real apps, “an LLM” is usually part of a larger system:
1) The model (text in → text out)
The base generator: prompts go in, tokens come out.
2) Tools (actions and data access)
LLMs become much more useful when they can call tools:
- fetch from your database
- read/write content in a CMS
- run code or tests
- call a weather API, send email, create tickets
This turns the model from “a writer” into “an assistant that can do things.” It also reduces hallucinations because the model can be instructed to rely on real outputs.
3) Retrieval (RAG) (bring the right context)
RAG stands for Retrieval-Augmented Generation. It means:
- find relevant snippets from your knowledge base (docs, posts, tickets, schemas)
- inject them into the prompt
- ask the model to answer using that context
RAG is how you make LLMs useful for company-specific knowledge without retraining the whole model.
“Fine-tuning” vs. “prompting” vs. “RAG”
These are commonly mixed up:
- Prompting: change instructions and context at runtime. Fastest iteration.
- RAG: fetch relevant knowledge and include it in the prompt. Great for facts.
- Fine-tuning: update model weights using your examples. Useful for style, formats, specialized behavior, or reducing prompt size—but it doesn’t magically grant private knowledge unless the examples contain it.
In 2026, most teams start with prompting + RAG, then consider fine-tuning if they hit limits.
What LLMs are great at (and what they’re bad at)
Great at
- drafting, rewriting, summarizing
- extracting structured data from messy text (with validation)
- explaining code and generating boilerplate
- ideation and “first-pass” solutions
Bad at (without guardrails)
- reliable factual claims without sources
- strict arithmetic or complex long-horizon planning
- security-sensitive tasks (auth logic, crypto) without expert review
- guaranteeing correctness (it can sound confident and still be wrong)
The best mental model: LLMs are probabilistic pattern engines. They are amazing copilots—but not autonomous truth machines.
Practical takeaway for engineers
If you’re building with LLMs, optimize for:
- Grounding: use tools/RAG for truth
- Verification: schemas, tests, deterministic checks
- UX: “show sources,” “explain actions,” clear error states
- Observability: log prompts, tool calls, latency, and failure modes
That’s how you turn “a chat bot” into a reliable product feature.
