The short answer#
Adding documents or examples to an ordinary inference request changes a fixed model's input, while training changes its learned parameters. An application can retain and resend information across calls. The provider's policies govern storage and any later use of submitted data for training.
The assistant used your document. What changed?#
Suppose you are building a small knowledge assistant. You give it a fictional policy passage: “Equipment requests need a supervisor's approval.” It answers a question using that rule. You replace the passage with a revised rule requiring approval from the equipment team, and the answer changes.
That can be useful behaviour. To explain the change, inspect the supplied passage and the conversation state. A fresh conversation needs access to the revised passage too.
Three terms make this easier to reason about:
| Term | What it means here | What changes |
|---|---|---|
| Training | Fitting a model using training data | Learned numerical values, called parameters |
| Inference | Running a trained model on an input | The computation and output for that input |
| Context | Information available to the language model for its current response | Instructions, examples, documents or retained conversation supplied for the call |
Google's machine-learning glossary explains parameters as the numerical values learned during training. In a neural network, these include weights: numbers that influence how signals pass through the network. They are different from a document you attach to a request.
Anthropic's context engineering explanation describes selecting instructions, tools, external information and history for inference. Changing that selection can change the result while the trained model stays fixed.
Why “in-context learning” sounds like training#
A prompt can contain examples that demonstrate the task:
Return the category only.
"Replace a broken keyboard" -> equipment
"Reset a forgotten password" -> account
"Request a new mouse" ->
These are invented teaching examples. A language model may use the pattern to produce equipment. You still need to check its answer; supplying examples does not guarantee success.
This adaptation from examples in the input is often called in-context learning. Here, the model uses the examples during inference with its trained parameters fixed. Brown and colleagues' Language Models are Few-Shot Learners demonstrated task examples supplied through text without additional parameter updates during those evaluations.
Ordinary prompting uses capabilities already present in the trained model. Fine-tuning is a separate training process that fits parameters using task data. Google's explanation of prompting and fine-tuning explicitly separates the two. A long prompt, a correction in chat and an uploaded document do not become fine-tuning merely because the next answer improves.
Run an example where you can inspect the parameter#
A hosted language model hides its weights from your application. To see the distinction directly, use a tiny numerical model with one visible parameter.
Our model predicts y = weight * x. The fitting function learns weight from example pairs by choosing the value that minimises squared prediction error, with the intercept fixed at zero. You do not need to derive the formula to follow the experiment: watch which function receives training examples and which receives an input to predict. Google's linear-regression introduction gives the broader background.
Save this as training-inference.ts. These are synthetic, unitless teaching numbers. With Node.js 22.18 or later, run node training-inference.ts; Node's TypeScript documentation covers its support for the syntax used here. No packages, account or API key are needed.
import assert from "node:assert/strict";
type Sample = Readonly<{ x: number; y: number }>;
type Model = Readonly<{ weight: number }>;
function fit(samples: readonly Sample[]): Model {
// The guards reject invalid data or numerical overflow.
if (samples.length === 0 || samples.some(s =>
!Number.isFinite(s.x) || !Number.isFinite(s.y))) {
throw new RangeError("Expected finite training samples");
}
const sumXY = samples.reduce((sum, s) => sum + s.x * s.y, 0);
const sumXX = samples.reduce((sum, s) => sum + s.x * s.x, 0);
if (sumXX === 0 || !Number.isFinite(sumXX) || !Number.isFinite(sumXY)) {
throw new RangeError("Cannot fit these samples");
}
// Training: fit the weight from the example pairs.
const weight = sumXY / sumXX;
if (!Number.isFinite(weight)) throw new RangeError("Weight overflow");
return Object.freeze({ weight });
}
function predict(model: Model, x: number): number {
if (!Number.isFinite(x)) throw new RangeError("Expected finite input");
return model.weight * x;
}
// Training creates the first fitted model.
const modelV1 = fit([{ x: 1, y: 2 }, { x: 2, y: 4 }]);
assert.equal(modelV1.weight, 2);
// Different inference inputs give different answers, using the same weight.
assert.equal(predict(modelV1, 1), 2);
assert.equal(predict(modelV1, 3), 6);
for (let i = 0; i < 100; i++) predict(modelV1, 3);
assert.equal(modelV1.weight, 2);
// A separate fitting step creates a model with a different learned weight.
const modelV2 = fit([{ x: 1, y: 3 }, { x: 2, y: 6 }]);
assert.equal(modelV2.weight, 3);
assert.equal(predict(modelV2, 3), 9);
assert.equal(predict(modelV1, 3), 6);
console.log(`v1: weight=${modelV1.weight}, input=3, output=${predict(modelV1, 3)}`);
console.log(`v2: weight=${modelV2.weight}, input=3, output=${predict(modelV2, 3)}`);
Expected output:
v1: weight=2, input=3, output=6
v2: weight=3, input=3, output=9
Changing the inference input from 1 to 3 changed the first model's prediction from 2 to 6. Calling it another hundred times left its weight at 2. A separate call to fit with different training data produced weight 3; the code keeps the original model so you can compare them.
Try changing only the second training set to { x: 1, y: 4 } and { x: 2, y: 8 }. Before running it, predict the new weight and the output for input 3. Update the modelV2 assertions to 4 and 12. The modelV1 assertions should still pass unchanged.
This is a regression model, not an LLM. It has no tokens, document understanding, conversation or in-context learning. It demonstrates the narrower mechanism: prediction can vary with input while fitted parameters stay fixed, and fitting creates new parameters. It does not inspect or prove the internal behaviour of any hosted service. For a known arithmetic rule in an application, write the calculation directly; this fitting exercise is for understanding the distinction.
Put a correction in the place that needs it#
Return to the equipment policy. If its approval rule changes, decide what your application must update:
| Change you need | Place to inspect first | What to check afterwards |
|---|---|---|
| Answer from the revised policy | The source document and the passage supplied with the question | The answer follows the new passage and identifies the right source |
| Carry a correction into another turn | Stored conversation or application memory, and what the next call receives | The correction is actually available in that call |
| Find the revised policy automatically | The retrieval source and index | Retrieval returns the current permitted passage |
| Improve a repeated task behaviour across many inputs | Prompt examples and evaluation cases; consider fine-tuning when evidence justifies it | Performance on held-out cases, including regressions |
Retrieval-augmented generation, or RAG, searches for relevant information and supplies it with the model request. Updating its document store or index changes the information retrieval can supply; the answering model keeps the same trained parameters. Google Cloud's application guide describes retrieval and model tuning as separate mechanisms.
For a first knowledge assistant, keep a changing policy in a maintained source, retrieve the relevant passage and check the answer against it. Consider model adaptation when you have a measured task problem and suitable training examples. Training is not a dependable substitute for retrieving the current policy.
Stored history can also make an assistant appear to remember. The application may supply earlier messages, summaries or selected notes again. For the implementation details, see what belongs in model context and application state.
What this means for your first AI feature#
Before saying “the model learnt our policy”, run a small comparison:
- Fix the question and model configuration. Record the reference answer and the document version it should follow.
- Supply the relevant passage. Inspect the assembled request and check whether the answer follows the evidence.
- Replace or remove that passage. Repeat the question and record what changes. Use several representative cases and repeat runs to account for output variation.
- Inspect persistence separately. Start a fresh conversation and inspect the history, memory or retrieval results supplied to that call. Use those inputs to identify which store provided the information.
This experiment tests your feature's dependence on supplied evidence. It does not establish whether a provider stores requests or uses them in a later training process. Check the exact product, account settings and agreement before sending sensitive material. Anthropic's data-use explanation, for example, distinguishes ordinary commercial use from choices that permit training use. Treat such policies as a separate check from the training/inference distinction.
Day 1, Demystify AI and Prompt with Intent, in AI for Developers connects this vocabulary to comparing prompts and inspecting output quality. Day 3 then uses a bounded document-Q&A exercise, where you can see exactly which passage an answer received.
Questions developers ask#
If the answer changes, has the model learnt permanently?#
Different context can change a response from a fixed model. Inspect the application's inputs and stored state to explain the response. Check for a separate training process before claiming its learned parameters changed.
Does “no parameter update” mean my input is private?#
It says what ordinary inference does. Privacy also depends on storage, access, retention and any later data use. Verify those terms for the product and account you use.
Should I fine-tune whenever a document changes?#
Start by updating the source and checking retrieval and answers. Fine-tuning is a training decision that needs a defined task, examples and evaluation; a document revision does not establish that need.
Where can our team practise the distinction?#
AI for Developers takes these foundations into a small knowledge assistant with prompts, a document example and explicit checks. It is offered as a Live Instructor Led Workshop or an Onsite Workshop for your Teams. Enquire about AI for Developers.
