Escape Hatch
La cláusula del «no lo sé»
Escrito por Darjus Kazakevic · revisado el
A model with no way out will invent one.
Ask for the customer's order number when the email has none. Your prompt says to reply with the order number, so every reply that obeys it contains one. The model writes a plausible one. This is the easiest hallucination (a confident, invented answer) to reproduce, and the cause is the prompt, not the model.
The fix is one sentence: name the way out. Use a reserved word like NOT_FOUND, a null, or an empty list. It only works if the way out is a real answer. Write it in the contract, show it once in an example, and let the caller handle it as a result, not an error.
En esencia — Name the reply you want when there is no answer, and make it valid. Otherwise "I found nothing" is the one reply your prompt forbids.
Cuándo recurrir a él
Recurre a él cuando
- Extraction or Q&A over a document: make it the default
- RAG, where the retrieved passage often lacks the answer
- Classification with an open set, where “other” beats a forced label
Reconsidéralo cuando
- The task always has an answer: "translate this" needs no way out
- Creative work, where an imperfect attempt beats a refusal
- To hide poor retrieval that never finds the right passage
The parts
- The named way out
- One reserved value that means "no answer", not wording the model picks each time. NOT_IN_DOCUMENT is easy to test in code. "I couldn't find that in the text" needs a regex forever.
- The condition
- When the way out applies, written as a rule. "If the document does not state it" is a rule the model can check. "If you are not sure" is not: a model's sense of its own certainty is unreliable.
- The demonstration
- One example whose answer is the way out. Without it, the rule is a sentence the model has read. With it, the way out is a reply the model has seen.
Reglas de diseño
- Make the way out a valid answer
- Put it in the output contract as a legal value, and give the caller a real branch for it. A way out that is logged as a failure and dropped helps nobody and shows the user an empty screen.
- Tie the condition to the source
- "If the document does not state it" can be checked against the text. "If you are not confident" asks for a self-assessment the model does badly, so the way out fires on the wrong requests.
- Show it once, beside a case with an answer
- Add one example whose answer is the way out, next to a similar one that has an answer. The pair shows where the line is, so the way out does not fire too often.
- Measure how often it fires
- A way out that never fires does nothing. One that fires on a third of requests usually means retrieval is failing. The rate is worth a line on a dashboard.
Errores habituales
- A way out described in the prompt but never shown in an example
- "If you are unsure" as the condition, which fires almost at random
- Free-text refusals instead of one reserved value, so code cannot check them