An AI engineer is developing a system that summarizes legal documents using Azure OpenAI Service. It is critical that the summaries are factually accurate and do not 'hallucinate' information. Which prompt engineering technique is essential to ground the model's responses in the provided source material and minimize fabrication?
- AFew-shot prompting with examples of desired summary length.
- BProviding the full legal document as context and instructing the model to 'Summarize ONLY based on the provided text.'
- CSetting a high temperature value to encourage diverse output.
- DInstructing the model to 'Be concise and summarize the following document.'
Show answer & explanationAnswer & explanation
Correct answer: B. Providing the full legal document as context and instructing the model to 'Summarize ONLY based on the provided text.'
To prevent hallucination, it's crucial to ground the model by providing the source material directly in the prompt and explicitly instructing it to derive its response *only* from that context. This limits the model's tendency to generate information not present in the input.
Why the other options are wrong
- A. Few-shot prompting helps with format but doesn't inherently prevent hallucination or ensure grounding in source material.
- C. A high temperature would increase randomness and creativity, making hallucination more likely, not less.
- D. A general instruction to summarize is insufficient to prevent hallucination; the model might still draw on its pre-trained knowledge beyond the document.
Grounding for Hallucination Prevention
A prompt engineering strategy that involves providing specific source material directly within the prompt and explicitly instructing the LLM to generate responses *only* based on that provided context, thereby reducing the risk of 'hallucinations' or fabricated information.
- Crucial for factual accuracy in sensitive domains.
- Combines providing context with strong constraints.
- Limits the model's reliance on its general pre-trained knowledge.
Memory trick: Grounding is like giving the AI a 'Fact-Check Rulebook' for its sources.