Databricks Generative AI Engineer Associate · Section 3 · 30% of the exam
Implement LLM guardrails to prevent negative outcomes
One of the objectives of the Databricks Certified Generative AI Engineer Associate exam, in the section “Application Development”. Here is what it covers, the points to remember and a question to try.
What it covers
Before you trust an LLM application you read its traces critically, name the failure, put guardrails in front of and behind the model, and keep measuring after launch. This lesson covers common quality and safety issues, the guardrail options on Databricks, and how evaluation before release differs from monitoring in production.
Points to remember
- Assess the full trace (request, retrieved context, tool calls, output), not just the answer, and name the issue before fixing it.
- Quality issues: ungrounded, irrelevant, incorrect or incomplete, poor retrieval, format violations. Safety issues: harmful content, PII leakage, prompt injection or jailbreak, bias.
- Judge mapping:
RetrievalGroundednessfor hallucination,RelevanceToQueryfor relevance,Safetyfor harmful content,Guidelinesfor your own rules. - Feedback judges the output; an expectation records ground truth and can go into an evaluation dataset.
- Legacy AI Gateway guardrails: Safety (Llama Guard 2-8b) and PII Block or Mask; not on agent or custom model endpoints; topic and keyword guardrails were removed after May 30, 2025.
Try a question
A banking assistant's model must return exactly one of five action codes, such as FREEZE_CARD or SEND_STATEMENT, which a backend then executes. The team wants a guardrail on the model's output that adds almost no latency and behaves predictably. Which guardrail fits best?
- AAn LLM judge that rates each response for policy compliance before the backend receives it
- BA check in application code that rejects any output not on the allow-list and falls back safely
- CThe AI Gateway safety filter on the endpoint's output, which blocks unsafe categories of content
- DA system prompt sentence telling the model that it may use only the five approved action codes
Show the answer
B. When the valid outputs are a closed set, a deterministic guardrail is the right layer: an allow-list or schema check in code is fast, cheap and predictable, and an invalid output can fall back to a safe default or a human. Model-based guardrails add latency and are meant for nuanced content this check doesn't need.
Written for practice in the style of the exam: never a question from the real exam.
In the course
The lesson Response quality, safety and guardrails across the lifecycle teaches this objective (about 50 minutes), and 15 practice questions test it. The course has lessons, exam-style questions, timed practice exams and an AI tutor for every objective, and a pass prediction that tells you when you're ready to book.
More in this section
- Select Langchain/similar tools for use in a Generative AI application
- Qualitatively assess responses to identify common issues such as quality and safety
- Select chunking strategy based on model & retrieval evaluation
- Augment a prompt with additional context from a user's input based on key fields, terms, and intents
- Create a prompt that adjusts an LLM's response from a baseline to a desired output
- Select the best LLM based on the attributes of the application to be developed
- Select an embedding model context length based on source documents, expected queries, and optimization strategy
- Select a model from a model hub or marketplace for a task based on model metadata/model cards
- Select the best model for a given task based on common metrics generated in experiments
- Utilize MLflow and Agent Framework for developing agentic systems
- Compare the evaluation and monitoring phases of the Gen AI application life cycle
- Enable multi-agent systems to leverage Genie Spaces or conversational API to retrieve data