Introduction
Snowflake has released the new AI_SENTIMENT function as part of Cortex AISQL, becoming GA on July 25, 2025! This represents a significant accuracy improvement over the previous ENTITY_SENTIMENT function, enabling state-of-the-art sentiment analysis directly from SQL within Snowflake.
AI_SENTIMENT goes beyond simple "positive/negative" classifications to support aspect-based sentiment analysis. For instance, with restaurant reviews, you can analyze sentiment for specific aspects like "food quality," "pricing," and "service" separately, providing much deeper insights into customer feedback.
In this article, I'll walk through the practical value and implementation approaches for the AI_SENTIMENT function, including real-world testing results that demonstrate its capabilities across different scenarios.
Note: This article represents my personal views and not those of Snowflake.
What is AI_SENTIMENT?
The AI_SENTIMENT function is Snowflake Cortex AISQL's latest sentiment analysis function. Compared to the previous ENTITY_SENTIMENT function, it delivers significantly improved accuracy along with advanced features like mixed sentiment detection and nuanced expression understanding.
Key Features
- Industry-leading accuracy: Achieves 0.92 accuracy in aspect-based sentiment analysis
- Rich sentiment classification: Five-level detailed analysis including positive, negative, neutral, mixed, and unknown
- Multilingual support: Native support for 6 languages including English, French, German, Hindi, Italian, and Portuguese
- Aspect-based analysis: Simultaneous analysis of up to 10 different aspects
- Advanced context understanding: Accurately interprets implicit expressions and figurative language
Benchmark Performance
AI_SENTIMENT demonstrates superior performance compared to major LLMs:
Model | Aspect-based sentiment accuracy (ABSA-mix) | Aspect-based sentiment accuracy (ABSA-multilingual) | Overall sentiment accuracy | Overall sentiment accuracy (multilingual) |
---|---|---|---|---|
AI_SENTIMENT | 0.92 | 0.81 | 0.83 | 0.83 |
claude-4-sonnet | 0.84 | 0.79 | 0.75 | 0.82 |
mistral-large2 | 0.83 | 0.80 | 0.77 | 0.78 |
openai-gpt-4.1 | 0.83 | 0.73 | 0.80 | 0.78 |
llama4-scout | 0.82 | 0.79 | 0.71 | 0.76 |
llama3.3-70b | 0.82 | 0.79 | 0.71 | 0.76 |
AWS DetectSentiment | - | - | 0.62 | 0.64 |
This high accuracy makes AI_SENTIMENT reliable for business-critical sentiment analysis tasks.
Basic Usage
AI_SENTIMENT supports two primary usage patterns:
1. Overall Sentiment Analysis
The simplest approach analyzes overall text sentiment:
SELECT AI_SENTIMENT('Text content');
2. Aspect-Based Sentiment Analysis
Analyze sentiment for specific aspects individually:
SELECT AI_SENTIMENT('Text content', ['Aspect1', 'Aspect2', ...]);
You can specify up to 10 aspects, with each aspect limited to 30 characters.
Testing with Unsupported Languages
While Japanese isn't officially supported, I tested AI_SENTIMENT's behavior with non-supported languages to understand its capabilities.
Test: English Aspect Labels
SELECT AI_SENTIMENT(
'This restaurant''s omelet rice is quite delicious. The eggs were freshly collected this morning. However, it''s quite expensive compared to nearby stores.',
['Price', 'Taste', 'Freshness']
);
Result:
{
"categories": [
{
"name": "overall",
"sentiment": "mixed"
},
{
"name": "Freshness",
"sentiment": "positive"
},
{
"name": "Price",
"sentiment": "negative"
},
{
"name": "Taste",
"sentiment": "positive"
}
]
}
The results show accurate understanding of the content with proper sentiment classification:
- overall: mixed (complex emotions)
- Freshness: positive (freshness praised)
- Price: negative (price criticism)
- Taste: positive (taste praised)
Key Insights
This testing revealed that for unsupported languages:
- Content understanding: Text content can be understood with reasonable accuracy
- Aspect constraints: Aspects should be specified in supported languages (English, etc.)
- Practical workaround: Use English aspect labels even for content in unsupported languages
Supported Languages
AI_SENTIMENT natively supports:
- English
- French
- German
- Hindi
- Italian
- Portuguese
While other languages aren't officially supported, the testing above shows that content understanding may work for additional languages when using supported-language aspect labels.
Business Use Cases
AI_SENTIMENT excels in various business scenarios:
1. Social Media Monitoring
Monitor brand and product mentions across social platforms, tracking sentiment changes in real-time:
-- Social media analysis
SELECT
post_date,
AI_SENTIMENT(content, ['Brand', 'Product', 'Service']) as sentiment_analysis
FROM social_media_posts
WHERE brand_mention = true
ORDER BY post_date DESC;
2. Product Review Analysis
Analyze e-commerce reviews across multiple dimensions to identify improvement areas:
-- Product review analysis
SELECT
product_id,
AI_SENTIMENT(review_text, ['Quality', 'Price', 'Delivery', 'Customer_Service']) as review_sentiment
FROM product_reviews
WHERE review_date >= '2025-01-01';
3. Customer Support Analysis
Measure customer satisfaction from support tickets and chat logs:
-- Customer support sentiment analysis
SELECT
ticket_id,
support_category,
AI_SENTIMENT(customer_message, ['Response_Time', 'Solution_Quality', 'Agent_Helpfulness']) as support_sentiment
FROM support_tickets
WHERE status = 'closed';
4. Employee Engagement Analysis
Assess organizational health through employee surveys and feedback:
-- Employee satisfaction analysis
SELECT
department,
AI_SENTIMENT(feedback_text, ['Work_Environment', 'Management', 'Career_Growth', 'Compensation']) as employee_sentiment
FROM employee_feedback
WHERE survey_date >= '2025-01-01';
Sentiment Classification Details
AI_SENTIMENT returns these sentiment classifications:
Classification | Description | Example |
---|---|---|
positive | Clearly positive sentiment | "Excellent quality product" |
negative | Clearly negative sentiment | "Completely disappointing experience" |
neutral | Neutral sentiment | "Standard product as expected" |
mixed | Both positive and negative elements | "Good quality but overpriced" |
unknown | Cannot determine sentiment | When specified aspect doesn't exist |
The mixed classification is particularly valuable as it accurately captures complex emotions that contain both positive and negative elements.
Limitations and Considerations
Technical Limitations
Limitation | Details |
---|---|
Context Window | 2,048 tokens (approximately 1,600 words) |
Maximum Aspects | Up to 10 aspects |
Aspect Length | 30 characters maximum per aspect |
Supported Languages | 6 languages (others not officially supported) |
Usage Guidelines
- Long text handling: Split content exceeding 2,048 tokens
- Aspect selection: Choose business-relevant aspects carefully, preferably in supported languages
- Result validation: Use AI results as reference; verify critical decisions manually
Cost Information
AI_SENTIMENT has a credit consumption rate of 1.6 credits per 1 million tokens, making it quite cost-effective for sentiment analysis workloads. For detailed credit consumption information, refer to the Snowflake Credit Consumption Table.
Cost Benefits
- No data movement: All processing occurs within Snowflake's secure environment
- No infrastructure required: No dedicated AI infrastructure setup needed
- Automated operations: Easy automation through SQL
- Pay-per-use: Only pay for actual usage, avoiding waste
Summary
AI_SENTIMENT represents a breakthrough function that combines sentiment analysis accuracy with business applicability. It delivers exceptional value through:
Key Advantages
- Industry-leading accuracy: 0.92 accuracy in aspect-based sentiment analysis
- Complex emotion understanding: Accurate analysis of mixed sentiments and implicit expressions
- SQL integration: Easy integration into existing data pipelines
- Cost efficiency: Significant cost savings compared to external services
Recommendations for Global Usage
Based on testing results, even for unsupported languages, practical usage is possible with these approaches:
- Use English aspect labels (Price, Quality, Service, etc.)
- Content understanding works across languages (though not officially supported)
I encourage you to explore AI_SENTIMENT for customer voice analysis, brand monitoring, employee satisfaction surveys, and other business scenarios to enable secure and fast data-driven decision making!
Have you tried implementing sentiment analysis in your data workflows? Share your experiences in the comments below!
Promotion
Snowflake What's New Updates on X
I share Snowflake What's New updates on X. Follow for the latest insights:
English Version
Snowflake What's New Bot (English Version)
Japanese Version
Snowflake's What's New Bot (Japanese Version)
Change Log
(20250803) Initial post