Think first How do you keep masking guard rails from slowing down queries or model calls?
Why it matters: Questions describe a masking or guardrail setup and ask which change meets a performance goal.
Masks and filters run inside every query, so their cost adds up row by row. Keep the logic simple, let the optimizer push filters down, and skip work where you can. Guardrails on model calls follow the same idea.
Reported, thanks
Step 2 of 10
Term
Meaning
Policy UDF
The function a row filter or column mask policy runs during query execution.
SecureView barrier
The protection row filters and column masks add; it can block some optimizations.
Filter pushdown
Letting a simple predicate pass the barrier so filtering stays fast.
EXCEPT clause
The policy clause that exempts users, so the policy does not apply to them at all.
Reported, thanks
Step 3 of 10
UDF complexity directly drives query cost. A row filter runs its UDF for every row, and a column mask runs it for every matching value. Before production, benchmark the UDF on 1 million rows or more.
Reported, thanks
Step 4 of 10
Use SQL UDFs rather than Python UDFs in ABAC policies when you can. A Python UDF must be wrapped in a SQL UDF, and the optimizer cannot inline or optimize it. Python and Scala UDFs count as NOT DETERMINISTIC unless declared DETERMINISTIC, so a mask wrapping one blocks filter pushdown by default.
Exam trap Wrapping a Python UDF in a SQL UDF does not make it fast. The optimizer still cannot inline or optimize the Python code.
Reported, thanks
Step 5 of 10
Simple predicates push down; function calls and implicit casts do not. The barrier guards against side-channel leaks. That same barrier may stop partition pruning and liquid clustering, forcing full table scans.
Predicates and the SecureView barrier
Feature
Pushed down
Blocked
Predicate type
Simple equality or basic range comparison
Calls a function or adds an implicit type cast
Example
WHERE col > 100
date_format(col, ...) inside the WHERE clause
Speed
Fast
Slower
Exam trap A policy whose UDF always returns true is not free. The barrier can still block partition pruning and liquid clustering.
Reported, thanks
Step 6 of 10
The EXCEPT clause removes the policy entirely for exempt users. No UDF runs for them at all. When logic is too complex for principal clauses, identity functions such as is_account_group_member() inside the UDF resolve once at query analysis, not per row.
Reported, thanks
Step 7 of 10
Use try_divide, try_cast and try_to_number in masking logic. They return NULL instead of throwing, so the optimizer can rearrange and fold expressions. Reuse one masking function across columns: the same UDF with the same arguments counts as one effective mask.
Reported, thanks
Step 8 of 10
Materialize sensitive fields into typed columns before masking them. A regexp_replace mask over serialized XML or JSON works on the whole document. A mask on a scalar column handles one small value per row instead.
Reported, thanks
Step 9 of 10
Attach a Bedrock guardrail policy only to services that need it. Put the guardrail in the AWS Region nearest your workspace, since a cross-Region call adds latency. For cheap PII checks, Guardrails AI validators such as DetectPII score output by rules, with no LLM calls.
Exam trap A Unity Gateway Python policy cannot redact. A guardrail that masks sensitive data makes it deny the whole interaction instead.
Reported, thanks
Step 10 of 10
Policy UDFs run per row or per matching value; test them on at least 1 million rows.
Prefer SQL UDFs; Python UDFs resist optimization and block filter pushdown by default.
Use EXCEPT to skip the policy, and its UDF, for exempt users entirely.
Error-safe functions like try_cast let the optimizer rearrange masking expressions.
Think first Which guardrail would you put in front of a Gen AI app to stop malicious inputs, and how would you set it up?
Why it matters: Questions describe an attack or risky input and ask which guardrail technique or policy setting stops it.
Guardrails check traffic before and after the model. Unity Gateway service policies can block requests in the request path, for example with Amazon Bedrock Guardrails. Guardrails AI validators score inputs and outputs by rules, without LLM calls.
Reported, thanks
Step 2 of 9
Term
Meaning
Service policy
A Unity Gateway rule that runs on requests and responses and can block them.
ApplyGuardrail API
The Amazon Bedrock call that a Python service policy sends each message to.
DetectJailbreak
A Guardrails AI scorer that flags jailbreak or prompt injection attempts in input.
Fail closed
Deny the interaction when a check fails or returns something unexpected.
Reported, thanks
Step 3 of 9
DetectJailbreak flags jailbreak and prompt injection attempts in input. It is one of several Guardrails AI validators that MLflow can use as scorers. They evaluate by rules, with no LLM calls.
Three Guardrails AI scorers compared
Feature
DetectJailbreak
DetectPII
SecretsPresent
Checks
Input
Output
Output
Looks for
Jailbreak or prompt injection attempts
Personally identifiable information
API keys, tokens or other secrets
Exam trap DetectPII and SecretsPresent check output, not input. For a malicious user prompt, DetectJailbreak is the scorer that fits.
Reported, thanks
Step 4 of 9
Pass validator settings, such as a threshold, as constructor keyword arguments. You can also build a scorer at runtime with get_scorer, giving the validator name as a string.
Reported, thanks
Step 5 of 9
A Python service policy can send each message to Bedrock's ApplyGuardrail API. When Bedrock intervenes, the policy blocks the interaction. The example function fails closed: an unexpected result or a failed call denies the interaction. Service policies are in Beta, and workspace admins enable them from the Previews page.
Exam trap A Python policy cannot redact. Set the guardrail's actions to Block, because a masking guardrail ends up denying the whole interaction.
Reported, thanks
Step 6 of 9
Lower-ranked policies run first on requests and last on responses. Log mode records each decision but lets traffic through, so you can review the policy first. In Enforce mode, a blocked request still returns HTTP 200.
Exam trap A request blocked in Enforce mode does not return an error code. It comes back as a successful HTTP 200 response.
Reported, thanks
Step 7 of 9
On an MCP Service, the policy checks tool calls before the tool runs. It sends the tool name and arguments to Bedrock as INPUT. Tool results are not checked.
Reported, thanks
Step 8 of 9
Attach a Bedrock guardrail policy only to services that need it. Create the guardrail in the AWS Region nearest your workspace, because cross-Region calls add network latency.
Reported, thanks
Step 9 of 9
Use DetectJailbreak to flag jailbreak and prompt injection attempts in user input.
Guardrails AI scorers evaluate by rules, without LLM calls.
Python policies cannot redact, so set Bedrock guardrail actions to Block.
Try a new service policy in Log mode before enforcing it.
Think first If you build on OpenAI models through Databricks, which usage requirements become your job to meet?
Why it matters: Questions describe an application built on OpenAI models and ask which required mitigation applies to it.
OpenAI models on Databricks come with mitigation requirements for high-risk use cases, and you are responsible for implementing them. Chat apps, code generation tools and apps that accept images each have their own requirement.
Reported, thanks
Step 2 of 6
Term
Meaning
Grounded or topical
An app that limits users to its subject, so general inputs cannot produce unrestricted outputs.
Human review
A person checks generated code before it is used in production.
External users
Users outside your organization; they must be authenticated or monitored.
Reported, thanks
Step 3 of 6
The customer implements the mitigation requirements. When you use OpenAI models on Databricks, meeting these requirements is your responsibility.
Exam trap Running OpenAI models on Databricks does not shift the requirements to Databricks. The customer remains responsible for them.
Reported, thanks
Step 4 of 6
Each kind of app has its own mitigation. Match the application to its rule. Chat apps must stay on topic, code tools need review and limits, and image inputs must stay low risk.
Mitigations for three kinds of OpenAI applications
Feature
Chat app
Code generation
Image inputs
Main rule
Grounded or topical
Human review before production
Low risk and topical images only
Also required
No unrestricted general queries
Internal users only, or client-side misuse monitoring
Applies whenever the app accepts images
Reported, thanks
Step 5 of 6
Authenticate or monitor every external user. Two-factor or multi-factor authentication is one accepted mechanism. Logging individual end user IDs or IP addresses, for visibility and remediation, is another.
Exam trap Leaving external users neither authenticated nor monitored does not meet the rule. Use multi-factor authentication, or log individual user IDs or IP addresses.
Reported, thanks
Step 6 of 6
You are responsible for OpenAI's high-risk mitigations when using its models on Databricks.
Chat apps must be grounded or topical, not open to unrestricted queries.
Generated code needs human review, plus internal-only access or misuse monitoring.
Think first When sensitive text flows through a GenAI app, where should you remove it: before logging, after storage, or before the model sees it?
Why it matters: Questions describe PII or risky text in a GenAI data flow and ask which redaction or control fits the constraint.
Where you redact decides what is protected. Client-side redaction keeps PII from ever leaving your environment, server-side redaction cleans traces already stored, and service policies stop PII from reaching the model.
Reported, thanks
Step 2 of 10
Term
Meaning
Span processor
A function MLflow runs on every span before export, used for client-side redaction.
ai_mask
An LLM-backed function that masks PII in many formats without one pattern per format.
Service policies
Controls that keep PII away from an AI service registered in Unity Catalog.
redaction_mode
The pipeline setting that chooses to mask, hash or remove PII.
Reported, thanks
Step 3 of 10
Choose client-side or server-side by what must never happen. Go client-side when sensitive values must never be transmitted or persisted. Go server-side when traces already sit in Unity Catalog and you would rather leave the agent unchanged.
Client-side and server-side trace redaction compared
Feature
Client-side
Server-side
When it runs
Before MLflow exports the span
On OTel spans already in Unity Catalog
How
Span processors set with mlflow.tracing.configure
ai_mask in a Lakeflow pipeline
Agent code changes
Yes, in the agent
None needed
Reported, thanks
Step 4 of 10
Processors edit each span in place before export. Register one or more with mlflow.tracing.configure, and MLflow runs them on every span. Passing an empty list clears them all and stops redaction.
Example: Clears every registered span processor, which stops client-side redaction.
mlflow.tracing.configure(span_processors=[])
span_processors=[]: an empty list removes all processors
Reported, thanks
Step 5 of 10
Use Microsoft Presidio for better detection than regex. Its AnalyzerEngine finds entities like email addresses, credit cards and names. Its AnonymizerEngine then rewrites them.
Reported, thanks
Step 6 of 10
ai_mask handles varied PII formats on its own. One phone number written three ways is still recognized. For custom patterns, such as employee IDs, run regexp_replace before ai_mask in the pipeline SQL. Set redaction_mode to mask, hash or remove.
Exam trap Custom IDs go through regexp_replace first, not after. The pipeline SQL applies it before ai_mask.
Reported, thanks
Step 7 of 10
Only the pipeline and needed admins read raw traces. Routine analytics should query the redacted tables. Raw OTel tables get an auto time-to-live that deletes old trace data, 90 days by default. Stored traces also inherit Unity Catalog controls such as column masking and audit logging.
Reported, thanks
Step 8 of 10
Trace redaction changes only what the trace records. The agent still receives and returns the original text. To keep PII away from an AI service registered in Unity Catalog, or to enforce one policy across the organization, use service policies.
Exam trap Masking traces does not keep PII away from the agent, which still receives the original text. To block PII from reaching a Unity Catalog-registered AI service, use service policies.
Reported, thanks
Step 9 of 10
Keep chat apps grounded and review generated code. A chat app should be grounded or topical, so users cannot send general inputs that produce unrestricted outputs. Any generated code needs human review before it reaches production.
Reported, thanks
Step 10 of 10
Redact client-side when PII must never leave your environment.
Redact server-side with ai_mask when traces are already stored and the agent must not change.
Trace redaction does not block PII from the model; service policies do.
Raw OTel tables keep trace data 90 days by default.
Each topic's Check tested it on its own; this mixes them.
Mixed quiz
Take the Domain 5 quiz
4 questions mixed from every topic in this domain, each answer explained. Mixing topics is harder than one at a time, and it is what the exam does. No account needed; with a free account your answers also build your estimated exam score.
Free to start: the study notes and plan, quizzes, flashcards and the first mock exam, no card needed. A free account keeps your place and saves your quiz scores.