Table of Contents
Fetching ...

On Evaluating Loss Functions for Stock Ranking: An Empirical Analysis With Transformer Model

Jan Kwiatkowski, Jarosław A. Chudziak

TL;DR

This work systematically evaluates how different loss functions (pointwise, pairwise, and listwise) influence a Transformer-based stock ranking approach for daily top-$k$ portfolio selection on SP500 data. Using the PortfolioMASTER architecture, the study demonstrates that loss design materially affects profitability and risk, with Margin, ListNet, and BPR delivering superior portfolio results compared to MSE, despite similar predictive ranking signals. The findings highlight that a loss function tuned to ranking objectives can translate predictive scores into more profitable and stable top-k portfolios, providing practical guidance for quantitative traders and researchers. The work establishes a benchmark and points to future directions, such as broader listwise losses and validation on larger universes and varied market conditions.

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.

On Evaluating Loss Functions for Stock Ranking: An Empirical Analysis With Transformer Model

TL;DR

This work systematically evaluates how different loss functions (pointwise, pairwise, and listwise) influence a Transformer-based stock ranking approach for daily top- portfolio selection on SP500 data. Using the PortfolioMASTER architecture, the study demonstrates that loss design materially affects profitability and risk, with Margin, ListNet, and BPR delivering superior portfolio results compared to MSE, despite similar predictive ranking signals. The findings highlight that a loss function tuned to ranking objectives can translate predictive scores into more profitable and stable top-k portfolios, providing practical guidance for quantitative traders and researchers. The work establishes a benchmark and points to future directions, such as broader listwise losses and validation on larger universes and varied market conditions.

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.
Paper Structure (10 sections, 4 equations, 2 tables)