-
Notifications
You must be signed in to change notification settings - Fork 129
structured output vs a probability
Structured output makes a generated answer fit a format: JSON mode returns valid JSON, and
schema-constrained output returns JSON that matches the schema you supplied. A probability
answers a different need: it is a number between 0 and 1 per yes/no question, with no format to
break, and it tells you how sure the model is, so code can set a threshold. For extracting
fields or generating content, structured output is the right tool. For a decision, a probability
carries more information than a true in a JSON object.
A conflict of interest: we build jevos, which returns probabilities. The two are not rivals so much as answers to different questions: "what does the text contain?" is extraction, and "should I act?" is a decision. Much of the friction in LLM apps comes from using the first to do the second.
This page is what structured output fixes, what it leaves open, what a probability adds, a side by side, when structured output is the right choice, and how to use both in one pipeline.
It fixes parsing. A model asked for JSON in the prompt alone may add a sentence before the
brace, skip a key, or invent a value. OpenAI's documentation separates two levels: JSON mode
produces valid JSON, and Structured Outputs goes further and makes the response adhere to the
JSON Schema you supply, so required keys are not omitted and enum values stay in the list. Its
documentation also describes explicit refusals, reported in a separate refusal field that code
can detect.
That is real progress. A decision encoded as {"is_billing": true} with a schema will parse,
and a label constrained to an enum will be one of your labels.
A schema constrains what the value may look like, not how it was chosen.
-
No confidence.
truefrom a model that was nearly split andtruefrom one that was sure look the same. There is nothing to put a threshold on. - One value per field. An enum field returns one label. If the text fits two, the second is gone, and you cannot see how close it came.
-
Asking for a confidence field does not fix it. A
"confidence": 0.8field is another generated value, a number the model wrote, not a probability computed from its own answer. Why that differs is on LLM confidence scores: probabilities vs self-reported confidence. - Output tokens are still generated, and generation takes time per token and is billed per token on hosted APIs.
A yes/no model such as jevos reads the text and the question and returns P(yes). No token is
generated: every response reports output_tokens: 0.
- A threshold in code. Act at 0.5, or at 0.9 where a wrong yes is expensive, or send the middle to a person. The method is on how to choose a threshold for P(yes).
- Ranking. Sort a queue by P(yes) and review from the top.
- Several labels at once. One question per label, each with its own probability.
- Calibration you can check. On the natural yes/no questions of our held-out split, calibration error was 0.009: across many answers near 0.8, about 80% were right. On new kinds of questions this does not carry over automatically, and our measurements show a lean toward yes on arithmetic and dates; see LLM calibration explained.
- Nothing to parse. The answer is a number in a fixed place in the response.
| Structured output | A probability per question | |
|---|---|---|
| Output | generated JSON that fits a schema | one number from 0 to 1 per question |
| Parses | yes, schema adherence per the docs | yes, there is no text |
| Confidence | not part of the answer | the answer is the confidence |
| Threshold | not possible on a boolean | yes, set in code |
| Several labels | one per field unless you design for it | one probability each |
| Extracting values (names, dates, amounts) | yes | no |
| Output tokens | yes | none |
| Refusals | detectable in a refusal field (OpenAI) |
not applicable, no text |
- Extraction. Pulling the order number, the date and the amount out of an email is not a yes/no question. jevos cannot return values; a schema-constrained model can.
- Generation with shape. A reply plus a category plus a list of follow-ups, in one object.
- Many fields at once from a large model you already call. If you are paying for the call anyway, a schema keeps the result usable.
- Languages other than English. jevos reads English only.
The two combine naturally, and the split mirrors the one between code and model elsewhere in this wiki: extract with a schema, compute in code, decide with a probability.
-
Extract the facts with structured output:
delivered_on,item,reported_issue. - Compute in code what depends on numbers or dates, such as days since delivery. Small models are weak at this; the measurement is on small LLMs and arithmetic in yes/no questions.
- Decide with yes/no questions over the resulting state, the rule written into each question.
The README's refund example is step 3: a state with the item, "delivered: 5 days ago" and the customer's message, and three questions. It returns 0.93 for refund, 0.83 for upset and 0.04 for wrong item, three probabilities a single boolean field could not have given.
Where the decision is the only thing the call does, step 1 is not needed at all: the text goes in
as state and the question is asked directly. That rewrite is covered on
replacing chat LLM calls with yes/no questions.
What is structured output? A model response constrained to a format, from valid JSON up to JSON that matches a schema you supply.
Is JSON mode the same as a schema? No. In OpenAI's terms, JSON mode makes the output valid JSON; Structured Outputs also makes it adhere to your schema.
Can I get a confidence score from structured output? You can ask for a confidence field, but it is a generated number, not a probability computed from the answer.
When is a probability better than a boolean? When you need a threshold, a review band, a ranking, or more than one label per text.
Can jevos return JSON fields? No. It returns one probability per yes/no question. Use a schema-constrained model for extraction.
See also: why one forward pass beats generating an answer, what P(yes) means, and what it does not and jevos vs the OpenAI API for yes/no classification.
- OpenAI, Structured Outputs guide,
for JSON mode versus schema adherence and the
refusalfield, fetched 2026-09-29. - Our measurements: the 0.009 calibration error on 6,397 natural yes/no held-out questions
(
jevos-q8_0); the refund example andoutput_tokens: 0from the jev README.
From the notes of jev, a yes/no decision model that runs on a laptop CPU. There is no JSON for it to get wrong because it writes none.
- Ask a local LLM a yes/no question and get P(yes)
- Zero-shot text classification with yes/no questions
- LLM policy decisions: put the rule in the question
- LLM as a judge on a CPU
- Why a small LLM says yes when the answer is no
- Small LLMs and arithmetic in yes/no questions
- Our held-out benchmark said 0.855, new questions said 0.757
- jevos vs Jev vs Laya for yes/no decisions
- An open-source alternative to Jev for yes/no decisions
- jevos vs the OpenAI API for yes/no classification
- jevos vs Ollama for yes/no decisions
- jevos vs bart-large-mnli for zero-shot classification
- A yes/no LLM vs a fine-tuned BERT classifier
- jevos vs SetFit: zero-shot vs few-shot classification
- jevos vs Llama Guard for content safety checks
- jev serve vs llama.cpp server for classification
- jevos vs LM Studio: a decision server, not a chat app
- Local vs hosted LLM decisions: latency, cost, privacy
- A yes/no LLM vs a business rules engine
- LLM decisions vs keyword rules and regex
- The fastest AI model for yes/no decisions
- What makes a local LLM fast on a CPU
- Why one forward pass beats generating an answer
- Prefill vs decode: where LLM latency comes from
- Why LLM latency grows with the length of the text
- Why a hosted LLM API cannot answer in 50 ms
- Many questions about one text: why the extra ones are cheap
- CPU or GPU for a small LLM
- Latency budgets: where a 200 ms model fits
- Measuring LLM latency: median, p90 and warm-up
- Q4_K_M vs Q8_0: speed and size for a small model
- Throughput vs latency for a decision server
- What P(yes) means, and what it does not
- LLM calibration explained with yes/no answers
- Expected calibration error (ECE), explained
- Temperature scaling for LLM probabilities
- Platt scaling for a yes/no model
- Reading a reliability diagram
- How to choose a threshold for P(yes)
- Thresholds when a wrong yes costs more than a wrong no
- Human in the loop AI with a review band
- Precision and recall at a P(yes) threshold
- Base rates: why a 0.9 yes can still be wrong often
- Combining yes/no answers with AND, OR and NOT
- Logits, log-odds and P(yes)
- LLM confidence scores: probabilities vs self-reports
- How to write yes/no questions an LLM answers well
- Negation in yes/no questions for an LLM
- One condition per question: splitting compound questions
- Ask whether the text says it at all
- Scores as yes/no thresholds: is it at least high?
- Sending JSON as the text: designing the state
- Why wording changes an LLM's answer, and how to test it
- Mainly about: questions for messages with several topics
- Yes/no questions about tone and emotion
- Asking about intent: what does the writer want?
- Yes/no questions about long documents
- Using an English-only LLM with other languages
- Content moderation with a local LLM
- A Discord moderation bot with a local LLM
- Spam detection with yes/no questions
- Review moderation with a local LLM
- Email triage with a local LLM
- Support ticket routing with yes/no questions
- Urgency detection in customer messages
- Sentiment analysis with yes/no questions
- Intent detection with a local LLM
- Lead qualification with yes/no questions
- Fraud case triage with a local LLM
- Phishing email screening with a local LLM
- Log and alert triage with a local LLM
- Checking text for personal data with yes/no questions
- Prompt injection screening with a small model
- Document classification with a local LLM
- Product categorization with yes/no questions
- Contract clause detection with a local LLM
- Refund request triage with a local LLM
- Detecting cancellation intent in customer messages
- RAG evaluation with yes/no questions
- RAG faithfulness check with a local LLM
- Hallucination detection with a local LLM
- LLM regression tests in CI with yes/no checks
- Rubric design for an LLM judge
- Pairwise comparison with a yes/no judge
- LLM judge bias and how to control it
- Evaluation metrics for yes/no classifiers
- Building a yes/no test set for your own data
- Accuracy by kind of question: why one number hides failures
- Generating test questions with answers computed by code
- Benchmark contamination and truly held-out tests
- An LLM router with yes/no questions
- A model cascade: small model first, large model on doubt
- Semantic routing vs yes/no questions
- Gating AI agent tool calls with yes/no checks
- AI agent guardrails with yes/no questions
- Stop conditions for AI agents
- Logging LLM decisions for audit
- Reducing LLM cost with local yes/no decisions
- Replacing chat LLM calls with yes/no questions
- Structured output vs a probability
- A Python client for local LLM decisions
- Calling a local LLM decision server from JavaScript
- Local LLM yes/no decisions in n8n
- A Slack bot that uses local LLM decisions
- Home Assistant automations with local LLM decisions
- A LangChain tool for local yes/no decisions
- Batch decisions from files with jev decide
- Running LLM yes/no checks in GitHub Actions
- Securing a local LLM server with an API key
- curl examples for a local LLM decision API
- Self-hosted AI for decisions
- A private LLM for text classification
- On-premise LLM for business decisions
- GDPR and automated decision-making with an LLM
- Offline AI for decisions: no network needed
- Edge AI decisions on a CPU
- Run an LLM locally without a GPU
- Small language models explained
- When a small model is enough, and when it is not
- An LLM on a laptop: what it can do in real time
- What is GGUF, for someone deploying a classifier
- GGUF quantization types explained: Q4_K_M, Q8_0 and others
- GGUF vs safetensors
- llama.cpp vs Ollama for a classification service
- llama-cpp-python vs calling llama.cpp through ctypes
- llama.cpp on Windows without compiling
- Running llama.cpp CPU only
- Using llama.cpp prebuilt binaries instead of building