Vortex-AI
Graph-based NIFTY-50 risk modelling for crisis-regime detection and dynamic relationship maps.
| RUNTIME | Aug 2025 - Present |
|---|---|
| FORMAT | PyTorch / GAT / LSTM / CUDA |
| RUN ON | CUDA training, CPU evaluation |
| STATUS | In progress |
The problem: Financial risk teams need to detect when the NIFTY-50 shifts from a calm regime into a crisis regime, while also seeing which companies move together during the transition.
The constraint: The model has to run on a 16GB GPU during backtesting windows of under two seconds per step, while still capturing cross-sectional dependencies across all fifty stocks.
What I built: Vortex-AI turns NIFTY-50 price history into log-return windows, crisis labels, and empirical adjacency matrices. A spatio-temporal baseline and a Graph Attention Network treat each company as a node, then predict both the market regime and the changing relationship map.
The design decision is to make the relationship graph a first-class output instead of using it only as an internal feature. That makes the model useful for analysis: the regime score says whether the market is stressed, while the adjacency prediction shows the contagion structure behind the score. The pipeline keeps preprocessing, graph construction, training, and held-out evaluation separate so each artifact can be inspected independently.
The pipeline preprocesses NIFTY-50 prices into log-return windows, labels each trading day as calm or crisis, and for every 60-day chunk constructs an empirical adjacency matrix — a "who-moves-with-whom" map written as a table of Pearson correlations. Those matrices and regime labels are what the models learn from.
The baseline encodes each asset's return history with an LSTM, reading one day at a time. The GAT instead puts all 50 companies on a network: each node's features feed through two attention layers, then a bilinear decoder scores every pair-wise edge while global mean pooling produces the regime logit.
Numbers:
| Metric | Value | Baseline |
|---|---|---|
| Best validation loss | 0.6121 | 0.8463 (baseline) |
| Adjacency MSE | 0.0829 | 0.0694 (baseline) |
| Regime ROC-AUC | 0.8326 | 0.5621 (baseline) |
| Regime F1 | 0.8465 | 0.8465 (baseline) |
In plain terms: the graph-attention model was much better at spotting crises (ROC-AUC up from barely above a coin flip to 0.83) while still drawing a relationship map almost as accurately as the baseline.
Still working on gettin' it done!
Links:
- Repository: https://github.com/yash0238/Vortex-AI