-
Notifications
You must be signed in to change notification settings - Fork 132
thresholds when a wrong yes costs more
Act on yes only when P(yes) is at least C_fp / (C_fp + C_fn), where C_fp is the cost of acting on a wrong yes and C_fn the cost of a wrong no. If a wrong yes costs four times a wrong no, the threshold is 4 / 5 = 0.8, not 0.5. The rule is exact for a calibrated probability; for a model that leans toward yes on some kinds of question, as small models measurably do, the bar on those questions should be higher still, or the question should be rewritten so the model does not have to guess.
The rule turns a vague instinct ("be careful with refunds") into a number you can write down, defend and revisit. It also makes clear that the threshold belongs to the decision, not to the model: the same P(yes) can justify sending an email and not justify closing an account.
This page is the derivation, a table from cost ratio to threshold, the calibration caveat with our measured yes-lean, examples in both directions, and what to do when costs vary per case.
For one case with probability p that the true answer is yes:
- If you act on yes, you are wrong with probability 1 - p, so the expected cost is (1 - p) times C_fp.
- If you act on no, you are wrong with probability p, so the expected cost is p times C_fn.
Act on yes when the first is no larger than the second: (1 - p) C_fp <= p C_fn, which gives p >= C_fp / (C_fp + C_fn).
This is the two-class case of Elkan's (2001) analysis of cost-sensitive decisions: the optimal prediction is the positive class if and only if its expected cost is no greater than that of predicting the negative class. His general formula also allows for costs of correct decisions; with those at zero it reduces to the one above. Only the ratio of the two costs matters, which is convenient, because the ratio is often easier to agree on than the amounts.
| A wrong yes costs ... a wrong no | Threshold on P(yes) |
|---|---|
| a quarter of | 0.2 |
| the same as | 0.5 |
| twice | 0.67 |
| three times | 0.75 |
| four times | 0.8 |
| nine times | 0.9 |
| nineteen times | 0.95 |
These follow from the formula, not from any measurement. Note how fast the threshold climbs: the step from "the same" to "four times" moves it by 0.3, while every further doubling moves it less. Past about 0.95 the question is less about the threshold and more about whether a machine should take that decision alone; see human in the loop AI with a review band.
The formula treats P(yes) as the real chance that the answer is yes. If the model's 0.8s are yes only 65 percent of the time on your data, a threshold of 0.8 buys less safety than it claims.
For jevos, the relevant measurement is the direction of its errors on 999 yes/no questions written after the model was finished: 152 said yes when the answer was no, 91 said no when the answer was yes. The lean sits mostly on questions that need a computation. On arithmetic questions whose answer was no, the mean P(yes) was 0.59; on dates and times, 0.53. On tone and negation it was 0.16 and 0.17.
Three consequences for an asymmetric threshold:
- When a wrong yes is the expensive mistake, the model's bias works against you. Raise the yes bar above what the formula gives, or calibrate on your own labelled cases first, as on Platt scaling for a yes/no model.
- Raising the bar does not fix computing questions. On arithmetic, the questions whose answer is no get an average P(yes) above one half, and no threshold separates them cleanly. Compute the date or the total in code and ask the model only what the text says. The detail is on why a small LLM says yes when the answer is no.
- Trust a no more than a yes. On that set, a no from the model was the more reliable answer.
A wrong yes costs more. Auto-approving a refund, suspending an account, sending an email to
a customer, deleting a record. Take the README refund example: for an empty box delivered five
days ago, with a 30-day policy in the question, refund came back at 0.93. With a four-to-one
cost ratio the threshold is 0.8, so this case is approved automatically; one at 0.78 would not
be, even though the model leans yes. That one is a candidate for a quick human look, which is where
refund request triage picks it up.
A wrong no costs more. Missing an urgent ticket, failing to flag a message for a moderator, letting a possible fraud case skip review. Here the threshold goes below 0.5: if a missed flag costs four times a needless one, flag from 0.2. Flagging is cheap because a person looks next; the model's job is to not let things through.
The same question can sit on both sides. "Does this message ask for a refund?" can route to the refund queue at a low threshold (a needless routing costs an agent a minute) and trigger an automatic payout only at a high one.
Costs often depend on the case. Elkan's paper gives a credit card example in which approving a fraudulent transaction costs the amount of the transaction, while refusing a legitimate one has a fixed cost because it annoys a customer. The threshold then changes per case, and the natural place to compute it is your code:
def refund_threshold(amount, cost_wrong_no=5.0):
cost_wrong_yes = amount # paying out a refund that was not owed
return cost_wrong_yes / (cost_wrong_yes + cost_wrong_no)
approve = answer["answers"]["refund"]["noul"] >= refund_threshold(order_total)The cost figures in that sketch are placeholders. The structure is the point: the model says how likely yes is, and your code, which knows the amount, decides what that likelihood is worth.
How do I set a threshold when false positives are expensive? Use p >= C_fp / (C_fp + C_fn). A wrong yes that costs four times a wrong no gives 0.8.
Is 0.5 ever the right threshold? When both mistakes cost the same and the model is calibrated on your data.
Why raise the threshold further for a small model? Because on new kinds of question it makes more wrong yeses than wrong noes, so its P(yes) overstates yes there.
Can the threshold depend on the case? Yes. Compute it in code from case facts such as the amount at stake.
What if the cost ratio is huge? Past about 0.95, route the case to a person instead of automating it.
See also: how to choose a threshold for P(yes), precision and recall at a P(yes) threshold and gating AI agent tool calls.
- Our measurements: 152 wrong yeses vs 91 wrong noes and mean P(yes) by kind of question on the
999-question set,
jevos-q4_k_m. The refund value 0.93 is the README example of the jev repository. - The cost-ratio table is arithmetic from the formula, not a measurement.
- Elkan (2001), The Foundations of Cost-Sensitive Learning, IJCAI: optimal decision rule, threshold formula, credit card example, fetched 2026-09-29.
From the notes of jev. A model that errs toward yes is worth knowing about before you let its yes spend money.
- 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