A developer is building a data extraction pipeline where Claude must extract structured data from unstructured customer feedback. The extraction schema has 15 fields, some optional. Claude occasionally invents field values that were not in the source text (hallucination). Which combination of prompt techniques most effectively reduces hallucination in structured extraction?
Select an answer to reveal the explanation.
Short Explanation
Here's the deal — you need Claude to return the exact verbatim span from the source text that supports each extracted value, and to use a sentinel like 'NOT_FOUND' when there's no evidence. That grounds the extraction in the source and stops it from inventing values.
Full Explanation
The correct approach is to instruct Claude to return the exact verbatim span from the source text that supports each extracted value within the structured output, and to use a sentinel value such as 'NOT_FOUND' for fields with no supporting text evidence. This grounds the extraction in the source text. If no supporting span exists, the model must return the sentinel rather than fabricating a value. This technique, called extraction with evidence, is highly effective at reducing hallucination because it forces the model to locate the evidence before committing to a value, and the supporting span serves as an internal audit trail. The option that uses a high temperature setting such as 0.9 and aggregates multiple samples to select the most common value per field is wrong because high temperature produces more varied outputs, not more grounded ones; aggregating samples across high temperatures is a majority-vote heuristic that can select the most common hallucination rather than the most correct value. The option that provides 20 diverse few-shot examples covering all 15 fields is wrong because few-shot examples improve formatting and field recognition but do not address hallucination when the field value is genuinely absent from the source text. The option that runs the extraction twice at temperature 0 and flags any field that differs between the two runs as a low-confidence hallucination is wrong because at temperature 0 the model is deterministic; running it twice produces identical outputs and cannot detect hallucinations through disagreement.