new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Prompt Engineering · all subjects

avoiding hallucinations

10 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Have Claude extract evidence before answering

To reduce hallucinations on long documents, tell Claude to first extract relevant quotes from the document, then base its answer on those quotes. This forces Claude to gather evidence before responding, making it more likely to notice when the document does not contain the information needed to answer the question.

Claude hallucinates when trying to be helpful

Claude sometimes makes claims that are untrue or unjustified, particularly when it is trying to be as helpful as possible. This is a known issue with hallucinations in LLM responses.

Give Claude an out to decline answering

To reduce hallucinations on factual questions, explicitly tell Claude that it is OK for it to decline to answer, or to only answer if it actually knows the answer with certainty. For example, add instructions like 'Only answer if you know the answer with certainty.' This gives Claude permission to refuse rather than guess.

Example: Extract evidence then answer prompt structure

Use a prompt structure where Claude is instructed to extract relevant quotes into a scratchpad, consider whether those quotes answer the question or lack sufficient detail, then write a final answer. This approach prevents Claude from filling in missing information with hallucinations. Example structure: <question>What was Matterport's subscriber base on the precise date of May 31, 2020?</question> Please read the below document. Then, in <scratchpad> tags, pull the most relevant quote from the document and consider whether it answers the user's question or whether it lacks sufficient detail. Then write a brief numerical answer in <answer> tags. <document>[document text]</document>

Many techniques beyond evidence extraction reduce hallucinations

There are many methods to avoid hallucinations beyond giving Claude an out and having it extract evidence. Many of the techniques taught throughout this course help reduce hallucinations. If Claude hallucinates, experimentation with multiple techniques is recommended to increase accuracy.

Distractor information can cause hallucinations

Claude can be led to hallucinate answers when given long documents containing distractor information that is almost but not quite relevant to a question. Without explicit prompting help to extract and verify evidence, Claude may fall for the distractor information and provide an incorrect hallucinated answer based on it.

Temperature parameter controls response variability and hallucination

Temperature is a measurement of answer creativity between 0 and 1. At temperature 0, Claude produces nearly deterministic answers with consistency across repeated trials, though complete determinism is not guaranteed. At temperature 1 or gradations in between, Claude yields more variable answers. Lowering temperature can help solve hallucinations by making responses more consistent and standardized.

Give Claude an out to avoid hallucinations on uncertain facts

When asking Claude about facts it may not know or may hallucinate about, phrase the prompt to allow Claude to express uncertainty rather than inventing answers. This technique gives Claude a way to decline answering confidently when the answer is unclear or uncertain.

Request citations to prevent hallucinations in document-based questions

When asking Claude questions based on provided documents, explicitly request that Claude cite its sources. This technique requires Claude to back up claims with specific references to the document, preventing it from hallucinating information not present in the source material.

Give Claude an 'out' when sufficient information is unavailable

In the detailed task description and rules section, explicitly give Claude an alternative response option if it does not have sufficient information to answer the user's question. For example: 'However, if there is not sufficient information in the compiled research to produce such an answer, you may demur and write "Sorry, I do not have sufficient information at hand to answer this question."' This prevents hallucination and guides Claude to be honest about limitations.

Give your agent this brain