Inference

Inference image
Inference is the process of using a trained machine learning model to produce an output from new input data. In simple terms, training is where a model learns patterns, while inference is where the trained model applies what it has learned to make a prediction, classification, ranking, or generate content.

For example, when an AI model receives a prompt and generates a response, the generation process is inference. The same applies when an image model classifies an image, a recommendation system ranks products, or a fraud model predicts whether a transaction is suspicious.

From a testing perspective, inference is where the model's learned behaviour becomes observable and testable. Testing can examine output quality and accuracy, consistency, error handling, latency, throughput, and resource consumption across different inputs and operating conditions.

Inference testing becomes more challenging for generative and probabilistic models because identical inputs may produce different outputs depending on factors such as random seeds, sampling settings, model versions, and context. Tests may therefore need to evaluate properties and acceptable behaviour rather than rely entirely on exact expected outputs.

Inference also exposes distribution shift: production inputs may differ significantly from the data used during training or evaluation. For example, a fraud detection model may encounter transaction patterns that were rare or absent in its training data, causing its performance to degrade without any change to the model itself. Ongoing monitoring and representative production-like test data can help detect this behaviour.

A related risk is training-serving skew, where differences between the data processing or environment used during training and the one used during inference cause the model to behave differently in production. Differences in feature transformations, preprocessing, dependencies, or input formats can introduce this problem.

Performance is another important part of inference testing. Factors such as model size, input length, batch size, hardware, quantisation, and concurrency can affect latency, throughput, and resource usage. Online inference typically prioritises response-time objectives, while batch inference may place greater emphasis on throughput and processing efficiency.

Β A model that performs well during evaluation may still behave differently when exposed to real-world inputs and production conditions. Inference testing therefore needs to consider not just model accuracy, but also how the model behaves with changing data, workloads, dependencies, and operating environments.Β 

'Inference Engineering'Β  - Optimising how trained AI models (especially LLMs) are served in production to maximise speed, handle concurrent users, and reduce GPU costs.

​Why testers care: Optimisation techniques (like model compression and memory management) directly impact application performance, stability, and output accuracy.

​Core testing focus

​Realistic load profiles: Test performance using varying context lengths, not fixed static payloads.

​Quantisation evals: Run regression tests against baseline models to check for output degradation.

​VRAM stress: Push long-context concurrent sessions to ensure clean fallback/error handling when GPU memory fills.
Explore MoT
From test cases to AI-ready quality data: why structure matters image
Learn how to structure and organize test management data as an AI-ready foundation that gives AI systems richer context for testing insights and workflows.
MoT Software Testing Essentials Certificate image
Boost your career in software testing with the MoT Software Testing Essentials Certificate. Learn essential skills, from basic testing techniques to advanced risk analysis, crafted by industry experts.
This Week in Quality image
Debrief the week in Quality via a community radio show hosted by Simon Tomes and members of the community
Subscribe to our newsletter