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 (effective empirical rigor capped from 7.5)

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

Evidence Card

What the authors claim, on what data, and who has checked it. Read from the paper's own text by a language model: every quote is verbatim, nothing was re-run. How to read this card

Proposes

The paper systematically evaluates advanced loss functions for training Transformer models to rank stocks for portfolio selection.

Source sentence
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.

Assumes 5

  • A daily rebalanced, long‑only, top‑5 equal‑weight portfolio is used for evaluation. execution
    Source sentence
    We simulate a daily rebalanced, long only, top-k portfolio (k = 5) with equal weighting.
  • Input features are daily return and turnover, normalized per stock, with a lookback window of 20 days. data
    Source sentence
    The input features (daily return and turnover) for each stock over a lookback window T are first projected to a model dimension D.
  • Data are split chronologically: 70% training, 15% validation, 15% testing. data
    Source sentence
    The data is split chronologically: 70% for training, 15% for validation, and 15% for testing.
  • Models are trained up to 50 epochs with AdamW optimizer, weight decay, early stopping, and a learning‑rate scheduler. model
    Source sentence
    Models are trained for up to 50 epochs using the AdamW optimizer with weight decay, employing early stopping based on validation loss and a learning rate scheduler.
Show 1 more
  • Sharpe ratio calculations use a risk‑free rate of 4.3%. market
    Source sentence
    Annualized Sharpe Ratio (SR, with a risk-free rate of 4.3%)

Data

Backtest sample: 2015-01 – 2024-12 · S&P 500 stocks · equities · daily

  • Daily stock market data for 110 S&P 500 stocks market-prices public
    2015-01-03 to 2024-12-03 · Top 10 by market cap from each of the 11 GICS sectors
    Source sentence
    We use daily stock market data for N = 110 S&P 500 stocks, selected as the top 10 by market capitalization from each of the 11 GICS sectors. The data spans from 2015-01-03 to 2024-12-03.

Costs

Not modeled A trading or execution result is reported without costs.

Finds 3

Reported performance (PortfolioMASTER): Sharpe 0.75 · annual return 16.2% · total return 89.1% · max drawdown 18.3%

  • Margin loss yields the highest annualized return (16.23%) and Sharpe ratio (0.7529) among the tested loss functions. performance
    Source sentence
    The Margin loss achieved the highest Annualized Return (16.23%) and Sharpe Ratio (0.7529).
  • ListNet loss also performs strongly with an annualized return of 16.00%, Sharpe ratio 0.7407, and the lowest annualized volatility (15.79%). performance
    Source sentence
    ListNet also performed strongly, with an AR of 16.00% and SR of 0.7407, along with the lowest Annualized Volatility (15.79%).
  • Strong portfolio performance does not always align with the highest predictive quality metrics. other
    Source sentence
    We observed that strong portfolio performance does not always directly correlate with the highest scores on standard predictive quality metrics.

Checked by others

No other paper in the archive has been found to support or contradict these findings (compared with 24 related papers). Coverage is partial, so this is neither replication nor refutation.

Cited by 1 paper in the archive (1 by independent authors)

Code

No repository by the authors found in the paper.

Extracted 2026-11-14 · same card as JSON · A language model chose these items: check the source sentence before relying on one.

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 — → 2404.00424
  13. Transformers and attention-based networks in quantitative trading: a comprehensive survey ({2024})
  14. Stock Market Prediction via Deep Learning Techniques: A Survey — → 2212.12717
  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 — → 2408.03320
  28. Transformer Multivariate Forecasting: Less is More? (2024) — link
  29. Applying Informer for Option Pricing: A Transformer-Based Approach — → 2506.05565
  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 — → 2412.19932
  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 — → 2509.12753
  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

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