Opens in a new tab
Home / Blog / Artificial Intelligence

Foundation Models and Large Language Models: A Complete Guide

Every LLM is a foundation model; not every foundation model is an LLM. A plain-English engineering guide to pretraining, transformers, tokens, context windows, post-training, reasoning models, and the adaptation ladder from prompting through to fine-tuning.

SoftmaxAI EngineeringPublished July 7, 2026Updated August 5, 202613 min read
Topic
Foundation models and LLMs
Key distinction
An LLM is one kind of foundation model
What made them general
Pretraining on broad data at scale
Recent shift
Post-training and inference-time reasoning

What is a foundation model, and how is it different from an LLM?

A foundation model is a large neural network pretrained on a very broad, mostly unlabelled corpus so that it can be adapted to many different downstream tasks; a large language model is the subset of foundation models whose primary input and output is text. Every LLM is a foundation model. Not every foundation model is an LLM, though — the category also includes vision-language models, speech and audio models, code models, and models trained on protein sequences, tabular data or sensor streams.

That's not pedantry; it changes architecture decisions. If you're dealing with scanned invoices, product photos or screen recordings, a text-only model is the wrong shape, and you want a vision-language model instead.

The word foundation carries the important idea. These models aren't finished products; they're a substrate — trained very expensively once, then adapted cheaply and rapidly by everyone downstream. The economics of the industry follow directly from that.

A useful shorthand: foundation model describes how it was built (broad pretraining, general purpose). LLM describes what it takes in and puts out (text). Multimodal model describes how many kinds of input it accepts. A single model is usually all three at once, which is why the terms get so blurred.

Where the generality came from: pretraining at scale

Before foundation models, you'd build a system for each individual task: gather labelled examples of the one thing you wanted, and train a model to do that and nothing else. Every new task meant a new dataset and a new model.

Pretraining broke that pattern by removing the labels. The objective is deliberately trivial — given some text, predict what comes next — so no annotation is needed, and the training data can be a large fraction of the public internet plus books, code and technical documentation. The side effect is what surprised people. To predict the next token well across all that varied material, the model had to learn grammar, factual associations, document structure, translation, code syntax and the shape of an argument. None of those were training targets.

  • Scale changed the kind of thing you get. Smaller models trained the same way just produce fluent nonsense. Past a certain size and volume of data, capabilities appear that simply weren't there before — following multi-step instructions, or learning a format from two examples.
  • Data quality now matters as much as volume. The early scaling era was all about raw quantity. Current practice puts heavy weight on curation, deduplication, filtering and carefully constructed synthetic data.
  • Nobody repeats this step lightly. A frontier pretraining run is a multi-month commitment of scarce accelerators and a dedicated research team. Compute has also shifted: the industry once spent almost all of it on pretraining, whereas today a large and growing share goes to post-training and inference. Either way, adaptation rather than training is where almost all product work happens.

How transformers and attention work, without the mathematics

Almost every foundation model in production is a transformer or a close relative. You don't need the linear algebra, but you do need the intuition, because both the cost profile and the failure modes of the model come straight from this design.

Earlier sequence models read text strictly left to right, compressing everything they'd seen so far into a fixed-size running state, so long-range dependencies were lost. The transformer replaced that state with attention: when processing any token, the model looks at every other token in the context and works out, in a learned way, which ones are relevant at that point. Stack that dozens of layers deep and you get syntax at the bottom, meaning in the middle and task structure near the top.

Two engineering consequences follow. First, attention compares tokens against tokens, so naive attention cost grows quadratically with sequence length — which is why very long prompts become expensive and slow. Second, the model is fundamentally a next-token predictor sampling from a probability distribution. It isn't looking anything up. That single fact explains both its fluency and its willingness to be fluently wrong.

What are tokens, and why do they decide your bill?

Models don't read words. They read tokens — sub-word fragments produced by a tokeniser. Common English words are usually a single token; rarer words are split into several pieces; and punctuation and code symbols take up tokens of their own. This matters commercially, because tokens are the unit of billing, the unit of latency and the unit of context window all at once. Every decision about how much text you send is a cost decision.

  • Input and output tokens are not equivalent. Output is generated one token at a time, and it's generally the more expensive and far slower half. A prompt that produces a rambling answer costs more than one that produces a well-structured answer, at the same input length.
  • Non-English text usually costs more. Tokenisers are fitted to their training mix. Languages and scripts that are under-represented in that mix fragment into more tokens per sentence, so the same meaning consumes more budget and more of the window.
  • Tokenisation explains a class of odd failures. Counting the characters in a word, reversing a string or reasoning about spelling are all hard for a model that never sees individual letters. These look like reasoning failures, but they're really representation failures.

Context windows: what long context actually changed

The context window is the maximum number of tokens a model can consider at once — the system prompt, the conversation so far, any retrieved documents, tool definitions, tool outputs and the answer being generated all draw on the same budget. Windows grew from a few thousand tokens to hundreds of thousands and, at the very top end, into the millions. That genuinely changed system design: whole contracts, entire codebases and full support threads now fit into a single call, and the tiny, brittle fragments of early retrieval systems have largely gone.

What long context didn't do is make grounding unnecessary. Cost and latency still scale with what you send. Attention is measurably better on short, focused context than on the same information buried in an enormous one. Corporate knowledge bases are orders of magnitude larger than any context window. And a context dump has no natural place to enforce per-user permissions or produce citations. That's why retrieval-augmented generation is still the default way to ground a model in private, changing knowledge, rather than an obsolete workaround.

Treat the context window as a budget you allocate, not a bucket you fill. Every token spent on stale history or loosely relevant retrieved text competes for attention with the instruction you actually care about.

Post-training: how a raw model becomes something you can use

A freshly pretrained model is not an assistant. Ask it a question and it may well continue with three more questions, because that's a plausible continuation of a document containing a question. Everything that makes a model helpful, safe and steerable is added afterwards, in post-training.

  • Supervised instruction tuning. Training on curated examples of instructions paired with good responses. This teaches the basic contract: given a request, respond to it, in the requested format and at a sensible length.
  • Preference optimisation (RLHF and its successors). Humans — and increasingly models acting as graded judges — rank candidate responses, and the model is trained to produce responses that rank highly. This is where tone, refusal behaviour and honesty about uncertainty are shaped. Newer methods do the same work more directly than the original reinforcement learning approach.
  • Reasoning-focused training. Training, often against verifiable outcomes in maths and code where correctness can be checked automatically, to produce and use extended intermediate reasoning before answering. This is the most significant post-training development of recent years.
  • Tool-use and agentic training. Models are explicitly trained to make structured calls to external functions, read the results and carry on. Reliable tool use is a trained capability rather than a prompting trick, and it's what AI agent systems are built on.

Post-training is where most of the visible differences between competing models now lie. Two models with very similar pretraining can behave quite differently in your product — a strong case for evaluating candidates on your own tasks rather than on public leaderboards.

Why reasoning models became a separate product tier

For most of the field's history, an answer cost roughly the same regardless of how difficult it was. Reasoning models broke that assumption. Given a hard problem, they spend substantially more compute at inference time — generating extended internal reasoning, exploring different approaches, checking intermediate steps — before answering. That established a new dimension of improvement: capability bought at inference time as well as at training time. It's why providers now offer a fast, cheap tier and a slower, more expensive reasoning tier.

Fast general modelReasoning model
Best atExtraction, classification, summarising, routing, conversationMulti-step maths, complex code, planning, ambiguous analysis
LatencySub-second to a few secondsSeconds to minutes, depending on effort
Relative cost per taskLowHigher — reasoning tokens are billed
Where it hurtsSilently skips steps on hard problemsOverthinks trivial questions; unusable in a live voice turn
Typical deploymentDefault path for most requestsEscalation tier for the minority of hard cases
Choosing between a fast model and a reasoning model

The production pattern is tiered routing: handle the common case with the fast model, detect low-confidence or high-stakes requests, and escalate only those. Sending everything to the reasoning model is how teams turn viable unit economics into unaffordable ones.

Open-weight or proprietary: how to choose

Proprietary models are consumed via an API, and the weights stay with the provider. Open-weight models can be run on infrastructure you control, under licences ranging from permissive to restrictive. The capability gap has narrowed, so it's now a question of control and cost.

  • Choose proprietary for the frontier and for speed. The hardest reasoning, the newest multimodal capabilities and the best-tuned tool use usually appear here first, with no infrastructure to run. In return, you accept vendor dependency and models that can be deprecated underneath you.
  • Choose open-weight for control, residency, and unit cost. When data can never leave your environment, when a regulator requires a particular deployment posture, or when volume is high enough that owning the serving stack is cheaper than paying per token.
  • Self-hosting is an operations commitment. Accelerators, autoscaling, batching, quantisation and upgrade cycles all become yours. The token price disappears and is replaced by an engineering line item.
  • Design for portability either way. Most serious systems end up as a mix: a proprietary model for the hardest reasoning and a smaller open-weight model for high-volume extraction. Keep prompts, tools, retrieval and evaluation behind an interface, so that the model stays swappable.

The adaptation ladder: from prompting to training your own

This is the section to internalise, because the most expensive mistakes in applied AI come from skipping rungs. Start at the top, and only go down a rung when you have evidence that the cheaper option can't do the job.

ApproachWhat it changesRelative costTime to first resultUse it when
Prompting and context designNothing in the model — only instructions, examples, and output schemaNegligibleHoursAlways first. Most perceived model weaknesses are prompt weaknesses
Retrieval (RAG)What the model knows at answer time, by supplying documents as evidenceLow to moderateDays to weeksAnswers must reflect private, large, or changing knowledge, with citations
Tool use and agentsWhat the model can do — query systems, call APIs, act in multiple stepsModerateWeeksThe task needs live data or real actions, not just text
Fine-tuningThe weights, teaching consistent behaviour, format, or a narrow skillModerate to high, recurringWeeks, then ongoingPrompting has demonstrably plateaued against an eval set
Continued pretrainingDeep domain fluency, by training further on a large in-domain corpusHighMonthsA distinct domain vocabulary, a very large corpus, and an ML team
Training from scratchEverything — you own the model and its data provenanceExtremeMonths to yearsAlmost never. A capital project driven by regulation or sovereignty
Ways to adapt a foundation model to your problem

The most expensive recurring error is reaching for fine-tuning to fix a knowledge problem. Fine-tuning teaches a model how to behave; it's a poor and costly way of teaching it what is currently true. Every fact that changes means another training cycle, whereas a retrieval index updates in seconds and cites its source. If the complaint is "it doesn't know our products", the answer is retrieval. If the complaint is "it won't stay in our house format", that's a fine-tuning candidate.

The rungs compose rather than compete. A mature system uses careful prompting, retrieval for grounding, tools for actions, and occasionally a small fine-tuned model for one narrow step. The scope of generative AI development work is mostly this integration engineering, not model building.

What foundation models still get wrong

Honesty about the limitations is what separates a system that survives contact with users from a demo. None of the following are bugs awaiting a patch. They're inherent properties of the technology that competent systems design around.

  • Hallucination is structural. The model samples plausible continuations. When it lacks the fact, the most plausible continuation is a confident invention shaped like a correct answer. Grounding, citations and faithfulness evaluation reduce and expose this. Nothing eliminates it.
  • Knowledge has a cutoff. Pretraining data ends on a date. Anything after it — a price change last week, a regulation passed last month — is invisible unless you supply it in context or through a tool.
  • Prompt injection is unsolved. Any model that reads untrusted content — a web page, an email, an uploaded PDF — can come across instructions embedded in it. Instructions and data share one channel, so the defence is architectural: least-privilege tools, human approval for consequential actions, and never letting retrieved text authorise a state change.
  • Outputs are non-deterministic. The same prompt can produce different answers. A lower temperature narrows the spread but doesn't guarantee reproducibility. Tests need to assert on properties and schemas, not exact strings.
  • Evaluation is the discipline most teams skip. Fluent output makes quality seem self-evident until a subtly wrong answer reaches a customer. You need a golden set of real tasks with verified answers, run on every change.
  • Governance is a delivery requirement. Documented data flows, disclosure, human oversight of consequential decisions, and retained logs are baseline expectations in the EU AI Act era.

How SoftmaxAI builds on foundation models

We don't train frontier models, and we'll tell you plainly when you don't need to either. Our job is the engineering that turns a general model into a system you can rely on: spec-driven, agent-accelerated, human-owned.

  • The specification comes first. Before any code, we write down the tasks, the data, the accuracy bar, the latency and cost ceilings, the failure behaviour and the acceptance criteria — and you approve it. Model selection follows from that document; it isn't a starting assumption.
  • We climb the ladder in order. Prompting and context design, then retrieval, then tools and agents, then fine-tuning — only where an evaluation set proves the cheaper rung has plateaued.
  • Evaluation is built with the system. The golden task set is written alongside the specification with your domain experts, wired into CI and kept running in production. Model swaps then become measured decisions rather than leaps of faith.
  • Deployed to your cloud, portable by design. Systems run in your own account, with monitoring, cost controls and a clear upgrade path. As a Google Cloud Partner we build natively on Vertex AI and Gemini where that makes sense, and on open-weight models where control or unit cost demands it.

If you're still deciding whether a foundation model is the right tool at all, the AI Opportunity Sprint gives you an honest feasibility assessment, a candidate architecture and a cost model before any commitment. The resulting patterns are visible in our case studies.

Foundation modelsLLMsTransformersTokensContext windowsPost-trainingRLHFReasoning modelsOpen-weight modelsFine-tuningVertex AI

FAQ

Questions we get asked.

What is the difference between a foundation model and a large language model?
A foundation model is any large model pretrained on a broad range of data that can then be adapted to a wide variety of tasks. An LLM is the subset of foundation models that primarily takes in and produces text. Vision-language, speech and code models are also foundation models, just not LLMs. Every LLM is a foundation model; the reverse isn't true.
What is a token, and why does it matter?
A token is a sub-word fragment that a model reads and generates. Prompts, context windows, latency and billing are all measured in tokens rather than words. Because tokenisation is fitted to the training data, text in less well-represented languages splits into more tokens, costing more per sentence and using up more of the context window.
Does a bigger context window remove the need for RAG?
No. Long context did make retrieval more forgiving, but sending long contexts is slow and expensive, model attention degrades over very long inputs, enterprise corpora are orders of magnitude beyond any window, and retrieval remains the natural place to enforce per-user permissions and generate citations. Long context has changed how retrieval is designed rather than replaced it.
What is a reasoning model?
A reasoning model is a foundation model that has been post-trained to spend additional compute at inference time, generating extended intermediate reasoning before producing an answer. It is significantly better at multi-step maths, complex code and planning, at the expense of higher latency and cost. Most production systems route only the hardest or highest-stakes requests to this tier.
Should I fine-tune a model or use retrieval?
Use retrieval when the problem is knowledge: private, large or rapidly changing facts that need to be cited. Use fine-tuning when the problem is behaviour: a consistent format, tone or narrow specialised task that prompting has demonstrably failed to fix against an evaluation set. Fine-tuning to inject facts is the most common and most expensive mistake in applied AI.
Should we use an open-weight model or a proprietary API?
Use a proprietary API for the latest frontier capability with no infrastructure to run. Use an open-weight model when data residency, regulatory posture, local latency or high, predictable volume make owning the serving stack worthwhile. Many production systems mix both, and keep the model behind an interface so it can be swapped out.
Should my company train its own foundation model?
Almost certainly not. Pretraining a frontier model is a multi-month capital project requiring scarce accelerators, a dedicated research team and a very large curated corpus. Almost every business outcome is achievable through prompting, retrieval, tool use and selective fine-tuning, at a small fraction of the cost and in a fraction of the time.
Start here

Working out which model, and which rung of the ladder?

A 30-minute call with the engineers who actually build these systems, not a salesperson. Bring the task and the constraints, and you'll get an honest view of whether prompting, retrieval, agents or fine-tuning is the right answer — and what it takes to ship it.