Leakage-Aware Evaluation of LSTM and Transformer Models for NIFTY 50 Forecasting
Abstract
Financial time-series forecasting is still difficult because its predictive performance can be exaggerated owing to temporal data leakage, improper validation methods, and incorrect comparisons with simple benchmark models. This study conducts a leakage-aware evaluation of two widely used deep-learning architectures, Long Short-Term Memory (LSTM) and Transformer models for forecasting the NIFTY 50 index using daily market data from January 2015 to June 2026. A series of features, both technical and market-based, were built based on past history, and the data were split into training, validation, and test sets to maintain temporal dependence and eliminate look-ahead bias. Sequential input windows were used for the classification of direction and regression of the closing price for the next day, while feature scaling was performed only on the training data. The findings show that the simple benchmark strategies were not consistently outperformed by either of the deep-learning models in terms of prediction. The transformer exhibited a noticeable majority class bias, whereas the LSTM exhibited very little discriminative ability. In the price-level regression experiments, the learned LSTM regressor was far less accurate than the naive persistence forecast, whose apparently excellent fit (R 2 = 0.96) reflects the non-stationarity of price levels rather than genuine forecasting ability. Robustness analyses across random seeds, a five-fold walk-forward evaluation, formal stationarity diagnostics with stationarity-transformed inputs, alternative forecast horizons, feature-group ablation, transaction-cost-aware backtesting, time-series-aware significance testing with multiplicity control, and external validation on Bank Nifty provided no consistent evidence of exploitable predictive information. The only nominally significant result, a 10-day LSTM signal, was identified post hoc and did not survive autocorrelation correction, multiplicity adjustment, walk-forward re-evaluation, or external validation. Overall, greater model complexity did not translate into greater forecasting reliability or economic value. This study emphasizes the need to use chronological partitioning, leakage-free preprocessing, suitable baseline comparison, strict statistical testing, realistic back-testing, and independent validation to ensure the construction of reliable and repeatable deep-learning-based financial forecasting models.
// Source
Authors: Dheeraj Agrawal, Rohit Raja, Sanjay Kumar, Parul Dubey, Ashish Kumar Pandey
Institutions: Symbiosis International (Deemed University), Guru Ghasidas Vishwavidyalaya, Pandit Ravishankar Shukla University, Dr. C. V. Raman University