MockCertMockCert
Menu

Test yourself in exam conditions

A full Databricks Certified Generative AI Engineer Associate mock exam: 45 questions in 90 minutes. Your first one is free.

Start a free mock exam
Domain 5 · 4 topics · about 21 minTopics in this domainTopics

Domain 5 · Overview

Overview

Up next: Use masking techniques as guard rails to meet a performance objective · 10 steps + check · 6 min

Domain 5 · Topic 1 of 4

Use masking techniques as guard rails to meet a performance objective

Step 1 of 10

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

Sources: Performance considerations for row filter and column mask policies | Databricks on AWS (opens in a new tab) · Tutorial: Enforce Amazon Bedrock Guardrails with a custom Python policy | Databricks on AWS (opens in a new tab) · Guardrails AI scorers | Databricks on AWS (opens in a new tab)

Check

Check: Use masking techniques as guard rails to meet a performance objective

Cards to recall, then questions on this topic. About 2 minutes. Nothing is saved without an account.

Loading the cards and questions…

Up next: Select guardrail techniques to protect against malicious user inputs to a Gen AI application · 9 steps + check · 5 min

Domain 5 · Topic 2 of 4

Select guardrail techniques to protect against malicious user inputs to a Gen AI application

Step 1 of 9

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.

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.

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.

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.

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.

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.

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.

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.

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.

Sources: Tutorial: Enforce Amazon Bedrock Guardrails with a custom Python policy | Databricks on AWS (opens in a new tab) · Guardrails AI scorers | Databricks on AWS (opens in a new tab)

Check

Check: Select guardrail techniques to protect against malicious user inputs to a Gen AI application

Cards to recall, then questions on this topic. About 2 minutes. Nothing is saved without an account.

Loading the cards and questions…

Up next: Use legal/licensing requirements for data sources to avoid legal risk · 6 steps + check · 4 min

Domain 5 · Topic 4 of 4

Recommend an alternative for problematic text mitigation in a data source feeding a GenAI application

Step 1 of 10

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.

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.

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

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

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.

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.

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.

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.

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.

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.

Sources: Govern and redact traces in Unity Catalog | Databricks on AWS (opens in a new tab) · OpenAI high risk use case mitigation requirements | Databricks on AWS (opens in a new tab)

Check

Check: Recommend an alternative for problematic text mitigation in a data source feeding a GenAI application

Cards to recall, then questions on this topic. About 2 minutes. Nothing is saved without an account.

Loading the cards and questions…

Domain 5 · after the last topic

Domain 5 review

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.

Flashcards

Domain 5 flashcards

8 cards with this domain's key facts. Flip each one and check what you knew. No account needed.

Test yourself in exam conditions

A full Databricks Certified Generative AI Engineer Associate mock exam: 45 questions in 90 minutes. Your first one is free.

Start a free mock exam
Next domain · 12% of the examEvaluation and Monitoring10 topics

Report a problem

On “”. Tell us what looks wrong; we read every report.

What is the problem?

Optional.