ML Models & AI

Comprehensive reference for the 22+ model ensemble, PPO meta-controller, and LLM provider chain.

Key Numbers

22+

Total models

4

Model tiers

6

LLM providers

7

PPO weight factors

Prediction Architecture

HedgeVision's predictive capability rests on a four-tier model hierarchy. Each tier is parallelized and independently executable. Results from all tiers are aggregated by the Ensemble Combiner and then weighted in real-time by the PPO Reinforcement Learning Meta-Controller.

PredictionOrchestrator
├── Tier 1 — Statistical Models (8 models)   → 25% ensemble weight
├── Tier 2 — Machine Learning Models (4 models) → 45% ensemble weight
├── Tier 3 — Sentiment Models (5 models)     → 15% ensemble weight
└── Macro / Regime Models (5 models)         → 15% ensemble weight
         ↓
   WeightedVote Ensemble Combiner
         ↓
   PPO Meta-Controller (runtime weight adjustment)

All 22+ models run as concurrent asyncio tasks via asyncio.gather() inside PredictionOrchestrator. No model blocks another.

Tier 1 — Statistical Models (25%)

Classical econometric/statistical models. Highest-priority for mean-reversion and structural relationship signals.

  • ARIMA: Short-term price series forecasting with auto-order selection
  • GARCH(1,1): Volatility modelling and forecasting
  • Cointegration: Long-run equilibrium relationships between asset pairs
  • Correlation: Rolling correlation matrix across asset set
  • Kalman Filter: Adaptive filtering of noisy price signals
  • Prophet: Trend and seasonality decomposition
  • VAR: Multi-variate time-series system modelling
  • VECM: Cointegrated multi-variate system with error-correction

Tier 2 — Machine Learning Models (45%)

Highest ensemble weight tier. Learn non-linear patterns from feature-engineered training data.

  • AutoGluon: Automated tabular prediction with multi-model stacking
  • Gradient Boosting: XGBoost + LightGBM with SHAP feature importance
  • Random Forest: scikit-learn ensemble tree-based classification
  • LSTM: PyTorch sequence modeling (CPU-only, no GPU)

Tier 3 — Sentiment Models (15%)

LLM and NLP-driven sentiment signals. Capture market narrative and crowd psychology.

  • FinBERT: Financial text sentiment classification (ProsusAI)
  • NewsSentiment: Aggregated news sentiment signal
  • MarketSentiment: Macro market sentiment indicator
  • SocialSentiment: Social media / retail sentiment signal
  • UnifiedSentiment: Perplexity sonar-pro real-time web intelligence

Tier 4 — Macro / Regime Models (15%)

  • HMM: Market regime classification (bull/bear/sideways)
  • RegimeModel: Composite regime classifier
  • FactorModel: Fama-French style factor alpha decomposition
  • GaussianProcess: Probabilistic non-parametric regression with uncertainty
  • PatternModel: Technical chart pattern recognition

PPO Meta-Controller

A Proximal Policy Optimization agent (stable-baselines3) that dynamically adjusts the relative weighting of 7 sub-model factors at runtime based on market conditions.

Observation space: volatility, trend_strength, dissent_score, confidence scores from sub-models.

Action space: 7-dimensional weight vector (news, cointegration, correlation, pattern, regime, market sentiment, social sentiment) passed through softmax.

Training: Model checkpoint at models/meta_controller_v1.zip. Scheduled retraining every Sunday via APScheduler.

LLM Provider Chain

Every LLM call in the system goes through a centralized 6-provider fallback chain. Each provider has an independent circuit breaker.

  1. Groq (llama-3.3-70b-versatile) — free tier, fastest latency
  2. Perplexity (sonar-pro) — real-time web search, research nodes
  3. OpenAI (gpt-4o-mini / gpt-3.5-turbo) — debate, critique, deal memos
  4. Azure OpenAI (gpt-4o-mini) — enterprise fallback
  5. OpenRouter — multi-provider aggregator
  6. Gemini — final fallback

Circuit breaker rule: 3 failures in 300 seconds marks a provider as OPEN. Auto-recovery after 300 seconds + 1 successful call.