Sentiment Analysis Settings

Model configuration and fallback chain details

Sentiment Analysis Pipeline
Multi-model ensemble with intelligent fallback chain for robust sentiment analysis

The Reddit Sentiment Tracker uses a sophisticated 5-stage fallback system to ensure accurate sentiment analysis even when individual models fail or hit rate limits. Each stage provides a safety net, guaranteeing that every post receives sentiment classification.

Smart Flow Control

The system automatically selects the next available model if the current one fails, ensuring 99.9% uptime and consistent sentiment scores.

1
Relevance Filter (Pre-processing)
Required
Intelligent content filtering to focus on market-relevant discussions

Model Details

Model: openai/gpt-oss-120b:exacto

Provider: OpenRouter API

Type: LLM-based content filter

Cost: Paid model (no rate limits)

What It Does

  • Filters out irrelevant content (sports betting, off-topic posts)
  • Determines market type (equity vs. crypto)
  • Skips sentiment analysis for irrelevant posts (saves API costs)

Example: A post about NFL fantasy sports in r/wallstreetbets would be marked as

irrelevant
and assigned neutral sentiment without wasting resources on analysis.

2
Local Ensemble (Primary)
Primary Method
Fast, local sentiment analysis using pre-trained financial models

Model Details

Models: Ensemble of local transformers

Provider: Local (in-memory)

Type: Fine-tuned financial NLP models

Cost: Free (no API calls)

Speed: ~50ms per analysis

What It Does

  • 5-class sentiment: Strong Bear (-2) to Strong Bull (+2)
  • No external API calls (instant response)
  • Handles 95%+ of posts successfully

Why Primary? The ensemble is fast, free, and optimized for financial text. It only falls back to cloud models when local analysis fails or has low confidence.

3
OpenRouter GPT-OSS (Fallback #1)
Fallback #1
Large language model for complex sentiment when ensemble fails

Model Details

Model: openai/gpt-oss-120b:exacto

Provider: OpenRouter API

Type: 120B parameter LLM

Cost: Paid (unlimited credits)

Rate Limit: None (paid account)

What It Does

  • Handles nuanced financial language
  • Extracts stock tickers with context awareness
  • Provides reasoning for sentiment classification

When Used: Activates when ensemble model fails or returns low confidence scores. Typically handles complex posts with mixed sentiment or unusual language.

4
Qwen via OpenRouter (Fallback #2)
Fallback #2
Alternative LLM when primary OpenRouter model is unavailable

Model Details

Model: Qwen via OpenRouter

Provider: OpenRouter API

Type: Large language model

Cost: Paid model

Rate Limit: Shared with OpenRouter

What It Does

  • Provides alternative analysis when GPT-OSS fails
  • Ticker extraction with confidence scores
  • 5-class sentiment compatible with ensemble
5
XAI Grok (Final Fallback)
Final Fallback
Last resort model ensuring every post receives sentiment analysis

Model Details

Model: XAI Grok

Provider: X.AI API

Type: Advanced reasoning LLM

Cost: Paid model

Rate Limit: Separate from OpenRouter

What It Does

  • Guarantees sentiment classification when all else fails
  • Advanced reasoning for edge cases
  • Separate API ensures redundancy

Reliability Guarantee: With Grok as the final fallback, the system achieves 99.9% sentiment classification success rate across all Reddit posts.

Auxiliary Utilities (Not Part of Sentiment Pipeline)
Supporting tools that help ensure reliability but don't analyze sentiment
⚙️

Google Gemini 2.0 Flash (JSON Repair Only)

Model: google/gemini-2.0-flash-exp:free

Provider: OpenRouter API

Type: Free tier LLM

Rate Limit: 20 requests/minute

Purpose: JSON repair and formatting

Use Case: Fixes truncated API responses

Frequency: Rare (~1% of calls)

Cost Impact: Minimal

Important: Gemini is NOT used for sentiment analysis. It only repairs broken JSON responses from the paid models (GPT-OSS, Qwen, Grok) when they return truncated data. This is a reliability feature, not part of the sentiment pipeline.

When Gemini is Used:
  • A paid model returns incomplete JSON (rare network issue)
  • Response is truncated mid-sentence due to token limits
  • JSON parsing fails and needs intelligent completion

Why Use a Free Model for JSON Repair?

JSON repair is a simple task that doesn't require advanced reasoning. Using the free Gemini model for this saves costs while the paid models focus on complex sentiment analysis. It's called so infrequently that the 20 req/min limit is never reached.

Rate Limit Protection
Intelligent throttling prevents API errors and ensures continuous operation

Free Model Limits

20 requests/minute for Google Gemini (free tier)

Used for JSON repair and auxiliary tasks

Adaptive Throttling

Dynamically adjusts request rate (0.5-10 QPS)

Automatic backoff on 429 errors

Health Monitoring

Periodic credit balance checks every 5 minutes

Alerts when credits < 25%

Smart Fallback on Rate Limits

When a model hits rate limits (429 errors), the system automatically switches to the next fallback model. Rate limits reset hourly, and the system self-heals by resuming the primary model when available.

System Performance
Real-world statistics from production deployment
95%
Ensemble Success
~50ms
Ensemble Speed
99.9%
Total Success
$0.15
Daily API Cost

Cost Optimization: By prioritizing the local ensemble, the system minimizes API costs while maintaining high accuracy. Fallback models only activate for ~5% of posts.