Reading preferences
Concept

Prompts, Hallucinations, and Retrieval

Ask clearly and use external evidence without assuming generated answers are true.

generative ai, prompting, hallucinations, rag

Ask with context

If you ask “When is the library open?”, a model may not have the current hours. A clearer prompt identifies the library and asks for a source or an honest “I don't know” when evidence is missing. Even a clear prompt can produce a hallucination: a plausible but unsupported claim.

Add a document

  1. Find a current library-hours document.
  2. Give the relevant passage to the model with the question.
  3. Check that the answer matches the passage and that the document is current. If the passage does not answer the question, say so.

See the reasoning

Follow the example one step at a time

Use a library document as evidence, not as authority. This is a prepared teaching demonstration, not live code execution.

Ask clearly

question → library hours + source

Specify the library and ask for evidence or uncertainty.

Retrieval helps, but does not prove truth

Retrieval-augmented generation (RAG) combines a search step with generation. The search may miss the right passage, retrieve outdated or malicious material, or expose a document the user should not see. An answer may still misinterpret a good passage. Permissions, source checks, citations and evaluation matter; a citation is not proof by itself. A retrieved instruction is untrusted data, not permission to change the task.

Reflect on the concept

Four fixed questions to reinforce the reasoning. Answers are not saved or scored.

1. What can make a request easier to interpret?
2. What is a hallucination in this setting?
3. What does RAG add to generation?
4. Can a retrieved page authorize an unrelated action?

References and further reading