Semantic Model Maintenance & Optimization

This guide helps you maintain and optimize your semantic model after it's been generated. By following these steps, you'll improve how Cortex Analyst understands and answers questions about your data.

New to semantic modeling? If you haven't generated a semantic model yet, start with How to Generate a Semantic Model. For a deeper understanding of how semantic models work, see Semantic Modeling Explained.


What is a Semantic Model?

A semantic model is a description of your data that helps Cortex Analyst understand what your tables, columns, and metrics mean in business terms. Think of it as a "translation layer" between your raw data and natural language questions.

The key insight: Your semantic model gets smarter over time. As you add verified queries and accept suggestions, Cortex Analyst learns to answer a wider range of questions more accurately.

The Optimization Loop

Ask questions → Verify good answers → Model learns → Better future answers

This guide covers how to:

  • Add verified queries to teach your model
  • Use Snowflake's suggestions based on actual usage
  • Optimize your model for better performance

Getting Started in Snowsight

  1. Log into Snowsight (Snowflake's web interface)
  2. Go to AI & ML in the left sidebar
  3. Select Cortex Analyst
  4. Find and select your semantic model or semantic view

You'll see a chat interface where you can ask questions about your data, along with panels showing your model's configuration and suggestions.


Verified Queries: Teaching Your Model

What Are Verified Queries?

Verified queries are pre-tested question-and-answer pairs that you add to your semantic model. When users ask similar questions in the future, Cortex Analyst uses these verified queries to generate more accurate responses.

Example: If you verify the question "What were total sales last quarter?", Cortex Analyst will better handle variations like "Show me Q3 sales" or "How much did we sell last quarter?"

Why They Matter

  • Improved accuracy: Cortex Analyst references verified queries when answering similar questions
  • Consistent definitions: Ensure business terms like "active customer" or "revenue" are calculated the same way every time
  • Faster learning: The more verified queries you add, the smarter your model becomes

How to Add Verified Queries

  1. Navigate to your semantic model in Snowsight (AI & ML > Cortex Analyst)
  2. Ask a question using the chat interface (e.g., "What was total revenue last month?")
  3. Review the results - check that the SQL query and data returned are correct
  4. Verify the query - if the results are accurate, save it as a verified query
  5. Add helpful metadata:
    • A descriptive name for the query
    • Optionally mark it as an "onboarding question" to show new users

Tips for Good Verified Queries

  • Use natural language: Write questions the way your users would actually ask them
  • Cover common scenarios: Start with the questions your team asks most frequently
  • Be specific: "What was revenue from enterprise customers in California last quarter?" teaches more than "Show revenue"
  • Include edge cases: Verify queries that handle tricky calculations or business rules

Using Verified Query Suggestions

What Are Suggestions?

Snowflake analyzes how people use your semantic model and suggests queries worth verifying. These suggestions appear based on:

  • Questions frequently asked by users
  • Patterns in your query history
  • Gaps in your current verified query coverage

How to Access Suggestions

  1. Open your semantic model in Snowsight
  2. Look for the suggestions panel on the right side of the screen
  3. You'll see up to 10 suggestions at a time

Working with Suggestions

For each suggestion, you can:

ActionWhat It Does
AcceptAdds the query directly to your model
EditModify the question, SQL, or description before accepting
DismissSkip this suggestion (may reappear after page refresh)

When to Accept vs Dismiss

Accept suggestions that:

  • Represent questions users frequently ask
  • Cover business logic you want to standardize
  • Fill gaps in your current verified queries

Dismiss suggestions that:

  • Are too simple to teach the model anything useful
  • Don't align with how your organization uses the data
  • Duplicate existing verified queries

Getting More Suggestions

After you accept all current suggestions, refresh the page to generate new ones. The system continuously learns from usage patterns to provide relevant recommendations.


Optimizing Your Model

How Optimization Works

When you add verified queries, Cortex Analyst doesn't just memorize them—it learns generalizable concepts.

Example: If you verify a query that defines "active users" as users who logged in within the last 30 days, the system learns this definition and can apply it to other questions about active users, even ones you haven't explicitly verified.

This means your verified queries have a multiplier effect: each one improves answers to many related questions.

Best Practices

Aim for Quality Over Quantity

  • Target around 20 diverse verified queries for optimal results
  • More isn't always better—focus on meaningful, complex queries

Prioritize Complex Queries

Simple queries teach less:

  • "Show all customers" (too basic)
  • "What is total revenue?" (minimal learning)

Complex queries teach more:

  • "What was the month-over-month growth rate for enterprise customers?"
  • "Which products had declining sales but increasing returns last quarter?"

Consider Processing Time

During optimization, the system executes your verified queries multiple times (up to 4x) to learn from them.

  • Small query sets: Minutes to process
  • Complex queries: Could take hours
  • Recommendation: Use an appropriately sized warehouse

When to Run Optimization

  • After adding a batch of new verified queries
  • When you notice Cortex Analyst struggling with certain question types
  • Periodically (e.g., monthly) as part of regular maintenance

Continuous Improvement Workflow

Before Deployment

  1. Add 5-10 initial verified queries covering your most common questions
  2. Test the model with realistic questions from your team
  3. Verify any queries that returned correct results during testing

After Deployment

  1. Monitor usage — note which questions users ask most often
  2. Check for gaps — identify questions that don't get good answers
  3. Add verified queries for common questions that aren't well-covered

Ongoing Maintenance

FrequencyAction
WeeklyReview and accept/dismiss suggestions
MonthlyAdd verified queries for new use cases
QuarterlyReview model performance and optimize

The Feedback Loop

Users ask questions
        ↓
You review suggestions based on those questions
        ↓
You accept valuable suggestions as verified queries
        ↓
Model learns and improves
        ↓
Users get better answers
        ↓
(repeat)

Quick Reference Checklist

Use this checklist to ensure your semantic model stays optimized:

  • Upload your semantic model to a Snowflake stage
  • Add 5-10 initial verified queries for common questions
  • Test with realistic questions before deploying
  • Review suggestions panel weekly
  • Accept suggestions that cover frequent user questions
  • Add verified queries when you notice gaps in coverage
  • Run optimization after adding new verified queries
  • Check model performance monthly

Additional Resources