Inference Contract
An inference contract defines what an inference workflow accepts, what it returns, which outputs are valid, and how failures are reported. It is the runtime counterpart of Task specification.
A contract can be written as:
where is the accepted request space, is preprocessing, is the trained model, is postprocessing, is the response space, and is the explicit error set.
Contract Fields
- Input schema: required fields, optional fields, units, types, shapes, and allowed ranges.
- Preprocessing: tokenizer, featurizer, resizing, graph construction, normalization, or structure preparation.
- Model version: checkpoint, config, preprocessing version, and runtime environment.
- Output schema: class, score, ranking, sequence, structured object, coordinates, action, or evidence fields.
- Validity rule: syntax, schema, geometry, threshold, confidence, or safety boundary.
- Error format: unsupported input, invalid output, timeout, missing dependency, low confidence, or internal failure.
- Resource envelope: latency, throughput, memory, batch size, context length, or token budget.
- Logging boundary: what can be logged publicly and what must be excluded.
Response Validity
The response should satisfy:
where is the valid response set for request . Invalid outputs should be rejected, repaired with a documented policy, or returned as explicit errors.
Checks
- Can another workflow construct a valid request without private context?
- Are preprocessing and postprocessing tied to the model version?
- Are input validation rules stated before model execution?
- Are unsupported inputs rejected explicitly?
- Are invalid outputs counted as failures rather than silently filtered?
- Are confidence, uncertainty, and abstention policies defined when needed?
- Are latency, timeout, and batching assumptions stated?
- Does logging avoid private inputs, credentials, and unpublished data?