Where LLM output variation comes from
Identify the sources of variation before designing tests. The main sources are:
- Sampling
- Model updates
- Batching and hardware
- Retrieval and tool results
Control the variables you can control
Reduce variation you can remove, so that what remains is attributable to the model itself:
- Pin versions
- Constrain inference settings
- Fix test fixtures
Design repeated-run statistical tests
Treat each test case as a distribution of outcomes rather than a single result. Statistical testing relies on:
- Repeated runs
- Pass-rate thresholds
- Confidence intervals
Separate hard assertions from graded quality
Choose a scoring method that fits the property under test:
- Hard assertions
- Tolerances
- Rubrics
Record evidence for each validation run
Capture configuration, outputs, scores and decisions per run. Each run should include:
- Model identifier and version, plus the judge model and version where used
- Prompt templates, system prompts, and all inference parameters including seed where set
- Retrieval index snapshot and tool or fixture versions
- Raw outputs and tool-call traces for every repeated run, not only the aggregate
- Pass rates, confidence intervals, and the thresholds defined before the run
- Reviewer decisions, exceptions, and the approved release configuration
Where pre-release testing stops and runtime controls begin
Repeated-run testing samples behavior. It cannot enumerate every input, retrieval state, or tool response an agent will meet in production. For agents the concern is sharper, because variation in tool selection or arguments can affect permissions and security, not only answer quality.
Test for this explicitly. Across repeated runs, assert that:
- Tool calls stay within an allowed set
- Arguments satisfy constraints
- The agent does not attempt actions outside its intended scope
A failure rate above zero for a permission-relevant behavior is a finding even when overall quality scores pass.
Residual variation then needs a runtime backstop. Controls typically include:
- Policy enforcement at the point of a tool call
- Least-privilege permissions tied to an agent identity
- Approval workflows for sensitive tools
- Audit logging of what the agent attempted and what was allowed
Trussed AI provides runtime governance and security for enterprise AI agents, covering runtime policy enforcement, agent permissions, tool approval workflows, and audit logging. These controls complement testing rather than replace it. Runtime logs also supply real cases to add to the validation set, closing the loop between production behavior and pre-release evidence.