Cross-model output contracts and abstention: keeping behavior consistent
To preserve an application’s expected outputs and safe behavior when changing models, define and test an **output contract** rather than relying on prompt wording alone. The contract covers not only field formats but also what each value means, how to handle unsupported inputs, missing information, and refusal states. For a classifier, do not only list allowed labels: provide a path to return `abstain` or request human review when an input is out of scope, ambiguous, or unsupported by evidence. Valid JSON does not mean the label is correct, and sending the same prompt to several models does not guarantee identical behavior.
Cross-model output contracts and abstention: keeping behavior consistent
To preserve an application’s expected outputs and safe behavior when changing models, define and test an output contract rather than relying on prompt wording alone. The contract covers not only field formats but also what each value means, how to handle unsupported inputs, missing information, and refusal states. For a classifier, do not only list allowed labels: provide a path to return abstain or request human review when an input is out of scope, ambiguous, or unsupported by evidence. Valid JSON does not mean the label is correct, and sending the same prompt to several models does not guarantee identical behavior.
What does an output contract fix?
A contract to preserve across models or APIs usually has four layers:
**Structure:** field names, data types, required fields, allowed enums, and null handling.
**Meaning:** definitions of each label, boundary cases, and what evidence must support.
**Exceptions:** how to represent out-of-scope input, insufficient information, conflicting sources, safety refusal, and incomplete processing, and what should happen next.
**Operations:** allowed latency and cost, retry count, human-review conditions, logging, and privacy handling.
Even if you implement the structure using an API’s JSON Schema or another constrained-generation feature, document and test the semantic, exception, and operational contract separately. Providers may differ in structured-output features, supported schema subsets, refusal or truncation response forms, and model support, so an adapter may be needed to map a shared business schema to each API. OpenAI’s Structured Outputs documentation also advises handling refusal, incomplete responses, API errors, and business-rule validation separately from completed non-refusal responses that match a supported schema. Check provider documentation during implementation because supported details can change. Structured Outputs documentation
Why does classification need abstention?
Given a closed list of labels, a model may force an input that fits none of them into the closest category. When label definitions are narrow, the input is ambiguous, or required facts are missing, forced classification can produce an output that looks valid instead of routing the case correctly. abstain is not the same as other. It is a decision state for pausing when no category can be assigned, evidence is insufficient, or sources conflict, then requesting information, applying a rule, or handing off to a person.
For example, if the label set is refund, delivery, account, and other, other can mean a request within the known classification scope that does not fit the main types. Use abstain when there is not enough evidence to trust a label or definitions overlap. Merging the two makes it impossible in analysis to distinguish truly out-of-category requests from uncertainty.
A possible output is:
{
"label": "refund | delivery | account | other | abstain",
"reason_code": "in_scope | out_of_scope | insufficient_info | ambiguous | conflict",
"evidence": ["short evidence found in the original text"],
"next_action": "route_to_queue | ask_user | none"
}This is a draft product contract, not a schema validated against a particular API. Business rules and code must validate which combinations of reason_code and label are allowed, whether evidence may be empty, and what authority next_action has.
Can a confidence score alone trigger abstention?
A value elicited by asking a model to “give your confidence from 0 to 1” is not guaranteed to match its actual accuracy. Even if a provider supplies token probabilities or a similar score, that value cannot automatically be treated as the probability that a classification is correct. Tune the abstention threshold on representative labeled data and account for the cost of errors and changes in the deployment population.
Selective classification studies the trade-off between coverage—the share of inputs for which the system produces a classification—and selective risk, the errors among the cases it answers. A higher threshold may abstain on more risky cases and reduce errors on answered cases, while increasing handoffs to people and unanswered inputs. Do not report only one threshold: examine coverage, error rate, human-review volume, unnecessary abstentions (withholding answers that could have been given), and false acceptance (producing a label when the system should have abstained) across thresholds.
A 2024 ACL study by Feng et al. compared calibration-, prompting-, consistency-, and multi-model-collaboration approaches to abstention in knowledge question answering. In its specific setup across three models and four tasks, it reported benefits for collaboration approaches and found simple self-reflection could be unstable. These findings are about the evaluated QA tasks, not a result that automatically generalizes to a particular business classifier. Original paper
Gangrade et al.’s selective-classification research formalizes the trade-off between classification errors and coverage when a system may withhold some predictions. Its experiments concern traditional classification data and methods; they do not guarantee an LLM prompt threshold. The concept helps define operational metrics, but must be evaluated again on the actual model and business data. AISTATS 2021 paper
How do you test an output contract across models?
| Test dimension | Example | Example pass condition |
|---|---|---|
| Ordinary input | Representative case for each label | Return a valid label with the intended business meaning and supporting evidence |
| Label boundary | Input with clues for two categories | Apply a defined priority rule or use the ambiguous/review path |
| Out of scope | Request outside allowed categories | Return out_of_scope or the specified abstention instead of a misleading nearby label |
| Missing or conflicting information | Decision facts are absent or sources disagree | Use insufficient_info or conflict without guessing |
| Format and response state | Schema violation, empty response, refusal, truncation, timeout | Handle safely and distinguish parsing/API failures from business abstention |
| Language and phrasing | Equivalent Korean and English formulations, including boundary cases | Meet each language’s criteria without losing conditions through ad hoc translation |
Keep expected answers and human-reviewed examples for each row. Send each model the same inputs, policy material, and evaluation rules, while recording the model name and exact snapshot, API mode, prompt version, and decoding settings. If a model fails because it does not support a schema feature, report that separately from business-quality comparison; it is an API compatibility failure.
Contract tests are not meant to make the model’s wording identical. They check the minimum behavior the application accepts. A response may pass with different phrasing if the label meaning, evidence, and exception handling are correct. Conversely, a schema-valid response with an unsupported label fails. Loosening an enum just to force a new model to emit a bad value can weaken the safety contract; first inspect label definitions and the adapter.
How to evaluate an abstention policy
**Classify abstention reasons.** Distinguish out of scope, insufficient information, ambiguity, and source conflict.
**Define the business outcome.** Decide whether abstention asks a follow-up question, routes to retrieval or another model, or sends the case to a person.
**Build representative data.** Include ordinary cases, each abstention reason, easy cases that should not be withheld, and important boundaries; have them reviewed independently.
**Measure a baseline.** Compare errors and coverage under forced labels with errors, coverage, and review volume when abstention is allowed.
**Fix thresholds and rules.** Tune on development examples, then check a held-out abstention set and multilingual examples.
**Monitor changes in operation.** Track label distribution, abstention rate, misclassifications, human corrections, and regression results after model or API changes.
For high-impact work, an abstention policy does not replace accountable human review or deterministic rules. Also ensure the handoff queue can handle the actual volume and give clear guidance to users whose requests are deferred.
References
Feng et al., “[Don’t Hallucinate, Abstain: Identifying LLM Knowledge Gaps via Multi-LLM Collaboration](https://aclanthology.org/2024.acl-long.786/)”, ACL 2024.
Gangrade, Kag, and Saligrama, “[Selective Classification via One-Sided Prediction](https://proceedings.mlr.press/v130/gangrade21a.html)”, AISTATS 2021.
[OpenAI API: Structured model outputs](https://developers.openai.com/api/docs/guides/structured-outputs).