Model, version and generation parameters
A model is a set of trained weights with a name and a version, so its identifier is pinned in configuration. An alias without a version can change behaviour without a commit. Temperature sets how random token choice is, max_tokens limits answer length. Even zero temperature does not guarantee identical text, so a test checks properties (schema, fields), not byte-for-byte equality.
AI for QA · Basics
The same test with temperature 0 passed yesterday and fails today. Nobody touched the code. What changed?
A test checks that the bot answers a cancellation request with "Order cancelled.". Green yesterday, red today, the answer is "Your order has been cancelled". There was no commit between the runs, and temperature is zero. This story has three possible causes: the model version changed, non-determinism even at zero, or a check that is too strict. The lesson explains what a model is as an artefact, what the generation parameters do and why a test must not assume byte-for-byte equal output.
How it works and why. A model is a specific set of trained weights with a name and a version. A larger model usually copes better with hard tasks but is slower and more expensive, a small one is fast and cheap for simple ones (classification, field extraction). So choosing a model is a trade-off between quality, speed and cost, and it is made by measurements on an eval set, not by the name. For QA the main point is different: the model version is part of the configuration. If the code uses an alias without a version, the vendor can move it to a new model and the product changes with no commit. So production and tests pin a specific identifier.
Where the generation parameters act
The main parameters (names depend on the vendor, check the documentation):
temperature: how random the choice is. Near zero the most probable token is almost always taken, higher gives more varied answers;top_p(nucleus sampling): choose only from the smallest group of tokens whose total probability reaches p. The usual advice is to change one of the two parameters, not both;max_tokens(nowmax_completion_tokensin OpenAI): the limit on answer length. When it is reached the answer is cut mid-sentence, and the stop reason (finish_reason: lengthin OpenAI,stop_reason: max_tokensin Anthropic) says it was the limit, not a completion;stop: strings on which generation stops;seed: not every vendor has it, and it only raises reproducibility but does not guarantee it.
Why zero does not give determinism. Even with temperature: 0 two requests can produce different text. The causes: parallel floating-point computation (the order of operations affects the last digits, and a gap between two nearly equal tokens flips the choice), request batching on the server and silent updates behind an alias. Some models do not accept an arbitrary temperature at all and reject a non-default value, and some vendors have removed sampling parameters (temperature, top_p) from newer API versions entirely: a request that sets them gets a 400. The conclusion for a test: do not rely on byte-for-byte equal output.
Example: from a brittle check to a stable one. The initial test:
const res = await llm.generate({ model: 'big-latest', temperature: 0, messages });
expect(res.text).toBe('Order cancelled.');
It is brittle for three reasons: the alias big-latest can change, exact text in a free-form answer is guaranteed by nothing, and when it fails you cannot see what happened (a different phrase or a truncated answer). The fix removes all three:
An alias or a pinned version
A name without a version
The vendor can move an alias to a new version. Product behaviour changes with no commit, and the difference between runs cannot be explained.
A specific identifier
The identifier lives in config. A model upgrade becomes a separate change with an eval run and a decision, not a surprise.
const res = await llm.generate({
model: config.modelId, // a pinned identifier from config
temperature: 0,
max_tokens: 300,
messages,
});
// the answer was not cut off by the length limit
expect(res.finishReason).not.toBe('length');
// check properties, not the exact text
const data = orderSchema.parse(JSON.parse(res.text));
expect(data.status).toBe('cancelled');
Here the identifier comes from config, so a model update is visible in the diff. The answer is requested as JSON by a schema and the fields are checked, not the phrase. The stop reason is checked separately: length means the answer is truncated and the JSON most likely will not parse. For free text with no structure, semantic checks and judge scoring remain: see the lessons “Why an LLM is not tested like regular code” and “Eval set, metrics and LLM-as-judge”.
Limits and alternatives. Pinning an identifier is not forever: vendors retire old versions on a schedule, so the plan includes a model upgrade as a separate event with an eval run. Model size is chosen by measuring: if a small model gives the required success rate on your set, the more expensive one is not needed. For continuous quality it helps to store the model identifier, prompt version and parameters in the run results, otherwise two runs cannot be compared.
Common mistakes.
- An alias without a version in production or CI. Consequence: behaviour drifts with no commit, and a regression cannot be explained.
- Expecting identical text from
temperature: 0. Consequence: unstable tests that get "treated" with reruns. - Not checking
finish_reason. Consequence: truncated JSON is read as a model error, not as a too smallmax_tokens. - Setting
max_tokensby eye. Consequence: either cut-offs or paying for headroom that is not needed. - Relying on
seedas a guarantee. Consequence: the run passes locally and fails in another environment.
Check yourself
A test with temperature 0 and an exact text comparison fails once in twenty runs. The model, prompt and data did not change. Why and what to do?
Answer
Zero does not make output deterministic: different request batching on the server and floating-point operations can flip the choice between two close tokens. Rewrite the check on properties (JSON fields, the required status, absence of forbidden words), and where that is not possible, add a tolerance and measure the success rate over several runs.
A bot answer is always cut off at the same place. Which response field do you look at and how is it fixed?
Answer
finish_reason (or stop_reason). The value length (max_tokens in stop_reason) means max_tokens was reached: raise the limit or ask for a shorter answer. If it says stop, the answer is complete and the cause is in the prompt.
Production suddenly changed the tone of answers although no commit touched the prompts. What do you check first?
Answer
Whether the model behind the alias changed. Look at the model identifier in request logs and in config. If it has no version, pin a specific one and run the eval set on the old and new versions to see the real difference.