14-day stock price forecasting for NIFTY 100 equities using the Titans Memory-as-Context transformer (NeurIPS 2025). 1.98M params, joint training on 98 stocks, walk-forward backtesting against naive and SMA baselines.
Titans MAC uses persistent neural memory that carries forward across the sequence — the model retains regime shifts and trend structure that fixed-window transformers lose.
git clone https://github.com/shuhulx/TitansForecast.git
cd TitansForecast
pip install -r requirements.txt# train on all NIFTY 100 + predict RELIANCE.NS + launch dashboard
python main.py
# backtest only
python backtest.py
# API server
uvicorn api:app --host 0.0.0.0 --port 8000
# docker
docker-compose up --builddim=128, depth=6, heads=4, window=32, neural memory at layers (2, 4). 8 features: Close, Volume, SMA_20, SMA_50, RSI, Momentum, Sentiment (FinBERT), Volatility. Predictions are autoregressive — each day's output feeds the next day's input.
- ✅ Titans MAC with persistent + long-term neural memory
- ✅ Multi-stock generalist training (~450K sequences)
- ✅ FinBERT sentiment (inference only; training uses neutral sentiment) + technical indicators
- ✅ FastAPI + Dash + Docker
- ✅ Online feedback learning on realized prices
⚠️ Single model for all stocks — no per-stock specialization⚠️ Backtest omits transaction costs
- Behrouz, Zhong & Mirrokni (2025). Titans: Learning to Memorize at Test Time. NeurIPS 2025
- lucidrains (2025). titans-pytorch
MIT