Databricks - Gen AI Engineer Associate Study Guide

    5: Governance

    This chapter covers the governance layer that sits around every generative AI application on Databricks: masking sensitive content to hit latency and compliance targets, layering guardrails against prompt injection and jailbreaks, vetting source-data licenses before they enter a corpus, and choosing the right mitigation when problematic text is detected inside a retrieval index. It maps each control to the exact Databricks primitive that enforces it, including AI Gateway guardrails, Unity Catalog tags, Llama Guard, Meta Prompt Guard, and pyfunc masking hooks.

    Learning Objectives

    By the end of this chapter, you will be able to:

    • Use masking techniques as guard rails to meet a performance objective.
    • Select guardrail techniques to protect against malicious user inputs to a Gen AI application.
    • Use legal/licensing requirements for data sources to avoid legal risk.
    • Recommend an alternative for problematic text mitigation in a data source feeding a GenAI application.

    Executive Summary

    • Masking is a governance control with a performance side effect, not the other way around: regex masking is fast and cheap, NER masking is more accurate but adds latency and GPU spend, and format-preserving tokenization adds a round-trip map that the post-processor must reverse.
    • A defensible guardrail stack at the Associate level has five layers wired in this order: input scanner, system prompt isolation, retrieval sanitation, output scanner, AI Gateway policy. Each layer catches a class of attacks the next layer misses.
    • Source data licensing is a Unity Catalog governance problem: every Bronze table that lands a third-party corpus carries a license tag, an allowed_use tag, and an attribution_required tag, and a CI check fails the pipeline if any tag is blank.
    • Problematic text inside a corpus has four mitigation paths: filter the row out, mask the offending span, replace with a synthesized equivalent, or quarantine for SME review. The choice is driven by how core the chunk is to recall and how reversible the contamination is.

    Assumptions

    • Reader has completed Chapters 1 through 4 and is comfortable with chains, retrievers, pyfunc models, Vector Search indexes, MCP servers, and the Mosaic AI Agent Framework.
    • All code targets Unity Catalog as the governance plane; Hive Metastore paths are not considered.
    • Region-specific PII rules vary by jurisdiction; this chapter teaches the Databricks primitives that enforce a policy, not the policy text of any single regulation.

    Sections in this chapter

    1. Free
    2. Free with account
    3. Free with account
    4. Free with account
    5. Free with account