In Cortex Analyst, model hallucinations—such as generating fictitious metrics, misinterpreting business calculations, or applying incorrect aggregation functions—occur when the underlying LLM lacks verified examples of how business questions translate into SQL for that schema.
The primary mechanism to prevent hallucinations and anchor text-to-SQL generation is adding a **`verified_queries`** section to the semantic model YAML. This section acts as a Verified Query Repository (VQR), storing curated pairs of natural language questions and confirmed SQL queries.
At runtime, Cortex Analyst evaluates incoming prompts against the VQR using semantic similarity. When a similar question is detected, the agent uses the confirmed SQL query as few-shot in-context guidance. This ensures the model applies valid metric formulas, correct table joins, and accurate filters rather than inventing non-existent schema elements.
`WHERE` clauses in prompts do not provide few-shot grounding; `verified_at` is an audit timestamp that does not alter reasoning; and Cortex Analyst foundation models cannot be fine-tuned via user commands.
References & Study Guide Topics:
* Snowflake Gen AI Functions: Cortex Analyst Semantic Model Tuning
* Grounding Architectures: Mitigating Hallucinations via Verified Query Repositories
===============
Submit