Snowflake - SnowPro Specialty Gen AI Study Guide

    3: Snowflake Gen AI Governance

    This chapter is the operations and governance manual for Snowflake Gen AI workloads. It works through model allowlists, RBAC for Cortex functions, cross-region inference policy, AI_REDACT and hallucination controls, REST authentication, the standard Cortex roles, the usage-view family for cost attribution, and the TruLens-based observability surface, mapped to the platform behaviors a practitioner must operate at production scale.

    Learning Objectives

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

    • Restrict which models a Snowflake account, database, or application role can invoke, and reason about the token-cost implications of Cortex Analyst and Cortex AI function calls.
    • Apply RBAC and the account-level model allowlist parameter to control Cortex access, and attribute Snowpark Container Services compute pool spend back to the workloads that consume it.
    • Configure cross-region inference policy, Cortex Guard, AI_REDACT, and grounding tactics to manage data residency, prompt safety, and hallucination risk, with cost tracking against the Cortex usage-history views and METERING_HISTORY family.
    • Pick the right REST API authentication method (key-pair JWT, OAuth, programmatic access token) for Cortex Analyst, Cortex Search, Cortex Agents, and Snowflake Intelligence callers, and use object tagging to slice AI spend by team and environment.
    • Grant the exact privilege set Cortex Analyst, Cortex Search, Cortex Agents, and Snowflake Intelligence require, and run the AI observability stack (evaluation metrics, traces, event tables, comparisons) backed by the TruLens SDK.
    • Apply the four standard Cortex roles (CORTEX_USER, CORTEX_ANALYST_USER, CORTEX_AGENT_USER, CORTEX_EMBED_USER) as the role model boundary, and use TruLens to log groundedness, relevance, and context-relevance scores against an event table.
    • Cap Cortex Agents token usage and run Cortex Search at the lowest viable cost across the warehouse, EMBED_TEXT, serving, and indexing meters.

    Executive Summary

    • Snowflake Gen AI governance has two control planes: a hard allowlist (CORTEX_MODELS_ALLOWLIST) that gates which model identifiers any role can name, and an RBAC plane that gates which functions, services, and semantic objects a role can call. The two planes intersect: a role with USAGE on SNOWFLAKE.CORTEX still fails if the model identifier is outside the account allowlist, and vice versa.
    • Cost attribution runs on a small set of views (CORTEX_ANALYST_USAGE_HISTORY, CORTEX_AISQL_USAGE_HISTORY, CORTEX_SEARCH_DAILY_USAGE_HISTORY, CORTEX_REST_API_USAGE_HISTORY, CORTEX_PROVISIONED_THROUGHPUT_USAGE_HISTORY, METERING_DAILY_HISTORY, METERING_HISTORY). Object tagging plus query tags push attribution down to the workload, team, or environment level.
    • Cross-region inference is governed by a single parameter (CORTEX_ENABLED_CROSS_REGION). Setting it to anything other than DISABLED is a data-residency decision that must be documented and signed off; it changes the answer to "where did my prompt and completion travel".
    • AI safety stacks three knobs: AI_REDACT for pre-call PII removal, Cortex Guard for in-call safety scoring on AI_COMPLETE, and grounding through Cortex Search or Cortex Analyst Semantic Views to push hallucination risk down. None of these is a substitute for the others; production stacks compose them.
    • The observability surface is a Snowflake event table written by the TruLens SDK plus the Snowsight AI Observability UI. Evaluation runs land in a structured row format that supports comparison, tracing, and metric trending.

    Assumptions

    • Reader has working knowledge of Snowflake RBAC (roles, GRANT, REVOKE, role hierarchies, future grants, SHOW GRANTS introspection) at the level required by SnowPro Core.
    • All examples assume the role hierarchy ACCOUNTADMIN > SECURITYADMIN > SYSADMIN > application roles, with Cortex calls scoped through dedicated application roles, not through ACCOUNTADMIN.
    • All region and edition references describe behavior on Enterprise Edition or higher unless a sub-topic explicitly calls out a Standard limitation. Provisioned Throughput requires Business Critical or higher in some regions; check edition before quoting throughput numbers in a customer-facing design.
    • All function names follow the Snowflake convention: SNOWFLAKE.CORTEX.<NAME> for SQL surface, fully-qualified, and the AI_* aliases when documented.

    Sections in this chapter

    1. Free
    2. Free with account
    3. Free with account
    4. Free with account
    5. Free with account
    6. Free with account
    7. Free with account
    8. Free with account
    9. Free with account