Paper: arXiv 2510.14156

Authors: Jan Kwiatkowski, Jarosław A. Chudziak

Abstract

Quantitative trading strategies rely on accurately ranking stocks to identify profitable investments. Effective portfolio management requires models that can reliably order future stock returns. Transformer models are promising for understanding financial time series, but how different training loss functions affect their ability to rank stocks well is not yet fully understood. Financial markets are challenging due to their changing nature and complex relationships between stocks. Standard loss functions, which aim for simple prediction accuracy, often aren’t enough. They don’t directly teach models to learn the correct order of stock returns. While many advanced ranking losses exist from fields such as information retrieval, there hasn’t been a thorough comparison to see how well they work for ranking financial returns, especially when used with modern Transformer models for stock selection. This paper addresses this gap by systematically evaluating a diverse set of advanced loss functions including pointwise, pairwise, listwise for daily stock return forecasting to facilitate rank-based portfolio selection on S&P 500 data. We focus on assessing how each loss function influences the model’s ability to discern profitable relative orderings among assets. Our research contributes a comprehensive benchmark revealing how different loss functions impact a model’s ability to learn cross-sectional and temporal patterns crucial for portfolio selection, thereby offering practical guidance for optimizing ranking-based trading strategies.

Complexity vs Empirical Score

  • Math Complexity: 6.0/10
  • Empirical Rigor: 6.0/10 (capped from 7.5: transaction costs not modelled; see penalty flags)
  • Quadrant: Holy Grail — high math complexity, high empirical rigor

Why this score: The paper employs advanced deep learning (Transformers) and systematically evaluates multiple complex ranking loss functions, requiring significant mathematical formulation, yet it is grounded in a concrete empirical benchmark using S&P 500 data with a clear backtesting protocol for portfolio selection.

Research Flowchart

  flowchart TD
  A["Research Goal<br>How do ranking loss functions impact<br>Transformer model performance for<br>stock return forecasting & portfolio selection?"] --> B["Dataset & Inputs"]
  B --> C["Model Architecture & Methodology"]
  C --> D["Training & Evaluation"]
  D --> E["Key Findings & Outcomes"]

  subgraph B ["Data"]
      B1["S&P 500 Historical Data<br>Price, Volume, Indicators"]
      B2["Target Variable<br>Future Stock Returns"]
  end

  subgraph C ["Methodology"]
      C1["Transformer Model<br>Time-series encoder"]
      C2["Loss Functions Tested"]
      C3["Pointwise: MSE/MAE"]
      C4["Pairwise: RankNet"]
      C5["Listwise: ListMLE/SoftRank"]
  end

  subgraph D ["Process"]
      D1["Cross-Sectional Training<br>Learn patterns across assets"]
      D2["Temporal Validation<br>Out-of-sample testing"]
      D3["Portfolio Construction<br>Rank-based top-K selection"]
      D4["Performance Metrics<br>Sharpe Ratio, NDCG, Accuracy"]
  end

  subgraph E ["Outcomes"]
      E1["Listwise losses outperform<br>others for ranking tasks"]
      E2["ListMLE yields highest<br>portfolio Sharpe ratio"]
      E3["Listwise captures cross-sectional<br>patterns better than pointwise"]
      E4["Practical guidance for<br>loss function selection in finance"]
  end

  B1 --> C1
  B2 --> C3
  B2 --> C4
  B2 --> C5
  
  C1 --> C2
  C2 --> C3 & C4 & C5
  
  C3 & C4 & C5 --> D1
  D1 --> D2
  D2 --> D3
  D3 --> D4
  
  D4 --> E1
  D4 --> E2
  D4 --> E3
  D4 --> E4

Cited References (68)

  1. Evaluating Ranking Loss Functions in Performance Predictor for NAS (2024) — link
  2. Forecasting Economics and Financial Time Series: ARIMA vs. LSTM (2018) — link
  3. Ranking Measures and Loss Functions in Learning to Rank (2009) — link
  4. Analysis of financial time series (2005) — link
  5. Advances in Financial Machine Learning (2018)
  6. Learning to Rank for Information Retrieval (2009) — link
  7. A Short Introduction to Learning to Rank (2011) — link
  8. Subset ranking using regression (2006) — link
and 60 more
  1. Learning to rank using gradient descent (2005) — link
  2. Large margin rank boundaries for ordinal regression (2000)
  3. BPR: Bayesian Personalized Ranking from Implicit Feedback (2012) — link
  4. Learning to rank: from pairwise approach to listwise approach (2007) — link
  5. Listwise approach to learning to rank - Theory and algorithm (2008) — link
  6. WSABIE: scaling up to large vocabulary image annotation (2011)
  7. The LambdaLoss Framework for Ranking Metric Optimization (2018) — link
  8. Deep learning for event-driven stock prediction (2015)
  9. Relation-aware transformer for portfolio policy learning (2021)
  10. Adaptive Long-Short Pattern Transformer for Stock Investment Selection (2022) — link
  11. CI-STHPAN: Pre-trained Attention Network for Stock Selection with Channel-Independent Spatio-Temporal Hypergraph (2024) — link
  12. Quantformer: from attention to profit with a quantitative transformer trading strategy (2024) — link
  13. Transformers and attention-based networks in quantitative trading: a comprehensive survey ({2024})
  14. Stock Market Prediction via Deep Learning Techniques: A Survey (2023) — link
  15. Deep Time Series Forecasting Models: A Comprehensive Survey (2024) — link
  16. Are Transformers Effective for Time Series Forecasting? (2022) — link
  17. Attention Is All You Need (2023) — link
  18. Crossformer: Transformer Utilizing Cross-Dimension Dependency for Multivariate Time Series Forecasting (2023) — link
  19. MASTER: Market-Guided Stock Transformer for Stock Price Forecasting (2023) — link
  20. iTransformer: Inverted Transformers Are Effective for Time Series Forecasting (2024) — link
  21. Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting (2021) — link
  22. StockMixer: a simple yet strong MLP-based architecture for stock price forecasting (2024) — link
  23. Temporal Fusion Transformers for Interpretable Multi-horizon Time Series Forecasting (2020) — link
  24. Multi-Modal Temporal Dynamic Graph Construction for Stock Rank Prediction (2025) — link
  25. Enhancing Multi-Output Time Series Forecasting with Encoder-Decoder Networks (2023) — link
  26. Portfolio Transformer for Attention-Based Asset Allocation (2022) — link
  27. Hedge Fund Portfolio Construction Using PolyModel Theory and iTransformer (2025) — link
  28. Transformer Multivariate Forecasting: Less is More? (2024) — link
  29. Applying Informer for Option Pricing: A Transformer-Based Approach (2025) — link
  30. Integrating Traditional Technical Analysis with AI: A Multi-Agent LLM-Based Approach to Stock Market Forecasting (2025) — link
  31. Toward Predictive Stock Trading with Hidformer Integrated into Reinforcement Learning Strategy (2024) — link
  32. Hidformer: Transformer-Style Neural Network in Stock Price Forecasting (2024) — link
  33. TEAFormers: TEnsor-Augmented Transformers for Multi-Dimensional Time Series Forecasting (2024) — link
  34. Enhancing Stock Movement Prediction with Adversarial Training (2019) — link
  35. Accurate Multivariate Stock Movement Prediction via Data-Axis Transformer with Multi-Level Contexts (2021) — link
  36. Transformer-based attention network for stock movement prediction (2022) — link
  37. Modal decomposition-based hybrid model for stock index prediction (2022) — link
  38. Hierarchical multi-scale Gaussian transformer for stock movement prediction (2021)
  39. Classification of intraday S&P500 returns with a Random Forest (2019) — link
  40. Investigation of market efficiency and Financial Stability between S&P 500 and London Stock Exchange: Monthly and yearly Forecasting of Time Series Stock Returns using ARMA model (2016) — link
  41. MiniBert24: A Lightweight Transformer-Based Model for Stock Market Movement Prediction (2024) — link
  42. Temporal Relational Ranking for Stock Prediction (2019) — link
  43. Quantitative Day Trading from Natural Language using Reinforcement Learning (2021) — link
  44. A hybrid deep learning model for cryptocurrency returns forecasting: Comparison of the performance of financial markets and impact of external variables (2025) — link
  45. Deep learning with long short-term memory networks for financial market predictions (2018) — link
  46. Robust Bayesian portfolio optimization (2025) — link
  47. Optimization-based spectral end-to-end deep reinforcement learning for equity portfolio management (2025) — link
  48. Time Series Forecasting with Transformer Models and Application to Asset Management (2023) — link
  49. A Comparative Analysis of Forecasting Financial Time Series Using ARIMA, LSTM, and BiLSTM (2019) — link
  50. DeltaHedge: A Multi-Agent Framework for Portfolio Options Optimization (2025) — link
  51. ElliottAgents: A Natural Language-Driven Multi-Agent System for Stock Market Analysis and Prediction (2025) — link
  52. Lamformer: LSTM-enhanced agent attention and mixture-of-experts transformer for efficient stock price prediction (2025) — link
  53. Galformer: a transformer with generative decoding and a hybrid loss function for multi-step stock market index prediction (2024) — link
  54. Machine Learning Approaches in Stock Price Prediction: A Systematic Review (2022) — link
  55. A CNN-BiLSTM-AM method for stock price prediction (2021) — link
  56. Diffusion model based on stochastic differential equation with transformer for stock price prediction (2025) — link
  57. Stock Ranking Prediction Using List-Wise Approach and Node Embedding Technique (2021) — link
  58. Stock Ranking with Multi-Task Learning (2022) — link
  59. A Comprehensive Survey of Loss Functions in Machine Learning (2022) — link
  60. Machine Learning Optimization Algorithms and Portfolio Allocation (2019) — link

0 of 68 cited works are in the corpus; resolved via arXiv source bundles, Semantic Scholar and OpenAlex. Corpus-wide: 2518 linked papers.