8.13 Safety, hallucination and guardrails
You can ship an LLM feature that fails safely.
Before:07. Natural Language ProcessingUnlocks:09. Agentic AI12. Frontier Topics
Failing safely is a design practice, not a patch: hallucination handled by grounding and abstention, prompt injection handled by treating every retrieved and user-supplied text as untrusted, personal data handled by logging hygiene and retention limits. It sits in the LLM module's conscience seat. The ordering is the lesson — injection resistance and refusal behaviour must be designed in from the start, because retrofitting safety onto a working feature reliably arrives too late.
Work through these
Why models hallucinate; abstention and refusal design
Models produce confident text regardless of whether they know, because producing text is what they do. Designing for the model to say it does not know is an explicit choice you have to build.
Prompt injection and indirect injection
Instructions hidden in user input or in fetched documents can redirect a system, and the indirect version is harder to defend against. Any system that reads external content needs to treat it as untrusted.
Input/output filtering and policy layers
Checking what goes in and what comes out against policy, as a layer separate from the prompt. A prompt is guidance; a filter is enforcement.
PII handling, logging discipline and data retention
Personal data in requests and responses, what gets written to logs, and how long any of it is kept. These are decisions to make before launch rather than after an incident.
Sign in to keep your progress.
Free resources
We haven't checked most of these for screen reader use yet.
Links last checked 29 Aug 2026.
Stuck here?
Ask a mentor. A real person answers, and they can see exactly which topic you're on. Usually within a couple of working days.
Checking your session…
Topics shown in module order.