IDEAS home Printed from https://ideas.repec.org/p/arx/papers/2505.01575.html
   My bibliography  Save this paper

Asset Pricing in Pre-trained Transformer

Author

Listed:
  • Shanyan Lai

Abstract

This paper proposes an innovative Transformer model, Single-directional representative from Transformer (SERT), for US large capital stock pricing. It also innovatively applies the pre-trained Transformer models under the stock pricing and factor investment context. They are compared with standard Transformer models and encoder-only Transformer models in three periods covering the entire COVID-19 pandemic to examine the model adaptivity and suitability during the extreme market fluctuations. Namely, pre-COVID-19 period (mild up-trend), COVID-19 period (sharp up-trend with deep down shock) and 1-year post-COVID-19 (high fluctuation sideways movement). The best proposed SERT model achieves the highest out-of-sample R2, 11.2% and 10.91% respectively, when extreme market fluctuation takes place followed by pre-trained Transformer models (10.38% and 9.15%). Their Trend-following-based strategy wise performance also proves their excellent capability for hedging downside risks during market shocks. The proposed SERT model achieves a Sortino ratio 47% higher than the buy-and-hold benchmark in the equal-weighted portfolio and 28% higher in the value-weighted portfolio when the pandemic period is attended. It proves that Transformer models have a great capability to capture patterns of temporal sparsity data in the asset pricing factor model, especially with considerable volatilities. We also find the softmax signal filter as the common configuration of Transformer models in alternative contexts, which only eliminates differences between models, but does not improve strategy-wise performance, while increasing attention heads improve the model performance insignificantly and applying the 'layer norm first' method do not boost the model performance in our case.

Suggested Citation

  • Shanyan Lai, 2025. "Asset Pricing in Pre-trained Transformer," Papers 2505.01575, arXiv.org, revised May 2025.
  • Handle: RePEc:arx:papers:2505.01575
    as

    Download full text from publisher

    File URL: http://arxiv.org/pdf/2505.01575
    File Function: Latest version
    Download Restriction: no
    ---><---

    References listed on IDEAS

    as
    1. Luyang Chen & Markus Pelger & Jason Zhu, 2024. "Deep Learning in Asset Pricing," Management Science, INFORMS, vol. 70(2), pages 714-750, February.
    2. Kamesh Korangi & Christophe Mues & Cristi'an Bravo, 2021. "A transformer-based model for default prediction in mid-cap corporate markets," Papers 2111.09902, arXiv.org, revised Apr 2023.
    3. Aaron Wheeler & Jeffrey D. Varner, 2024. "MarketGPT: Developing a Pre-trained transformer (GPT) for Modeling Financial Time Series," Papers 2411.16585, arXiv.org.
    4. Michael C. Jensen, 1968. "The Performance Of Mutual Funds In The Period 1945–1964," Journal of Finance, American Finance Association, vol. 23(2), pages 389-416, May.
    5. Yawei Li & Shuqi Lv & Xinghua Liu & Qiuyue Zhang & Siew Ann Cheong, 2022. "Incorporating Transformers and Attention Networks for Stock Movement Prediction," Complexity, Hindawi, vol. 2022, pages 1-10, February.
    6. Shihao Gu & Bryan Kelly & Dacheng Xiu, 2020. "Empirical Asset Pricing via Machine Learning," Review of Finance, European Finance Association, vol. 33(5), pages 2223-2273.
    7. Ma, Tian & Wang, Wanwan & Chen, Yu, 2023. "Attention is all you need: An interpretable transformer-based asset allocation approach," International Review of Financial Analysis, Elsevier, vol. 90(C).
    8. Shihao Gu & Bryan Kelly & Dacheng Xiu, 2020. "Empirical Asset Pricing via Machine Learning," The Review of Financial Studies, Society for Financial Studies, vol. 33(5), pages 2223-2273.
    9. Yang, Kuo & Tang, Yugui & Zhang, Shujing & Zhang, Zhen, 2022. "A deep learning approach to state of charge estimation of lithium-ion batteries based on dual-stage attention mechanism," Energy, Elsevier, vol. 244(PB).
    10. Daniel Kahneman & Amos Tversky, 2013. "Prospect Theory: An Analysis of Decision Under Risk," World Scientific Book Chapters, in: Leonard C MacLean & William T Ziemba (ed.), HANDBOOK OF THE FUNDAMENTALS OF FINANCIAL DECISION MAKING Part I, chapter 6, pages 99-127, World Scientific Publishing Co. Pte. Ltd..
    11. Diebold, Francis X & Mariano, Roberto S, 2002. "Comparing Predictive Accuracy," Journal of Business & Economic Statistics, American Statistical Association, vol. 20(1), pages 134-144, January.
    12. Lin William Cong & Ke Tang & Jingyuan Wang & Yang Zhang, 2021. "Deep Sequence Modeling: Development and Applications in Asset Pricing," Papers 2108.08999, arXiv.org.
    13. Chen Zhang, 2022. "Asset Pricing and Deep Learning," Papers 2209.12014, arXiv.org.
    14. Korangi, Kamesh & Mues, Christophe & Bravo, Cristián, 2023. "A transformer-based model for default prediction in mid-cap corporate markets," European Journal of Operational Research, Elsevier, vol. 308(1), pages 306-320.
    15. Junyi Ye & Bhaskar Goswami & Jingyi Gu & Ajim Uddin & Guiling Wang, 2024. "From Factor Models to Deep Learning: Machine Learning in Reshaping Empirical Asset Pricing," Papers 2403.06779, arXiv.org.
    16. Yuqi Nie & Yaxuan Kong & Xiaowen Dong & John M. Mulvey & H. Vincent Poor & Qingsong Wen & Stefan Zohren, 2024. "A Survey of Large Language Models for Financial Applications: Progress, Prospects and Challenges," Papers 2406.11903, arXiv.org.
    17. Edward Sharkey & Philip Treleaven, 2024. "BERT vs GPT for financial engineering," Papers 2405.12990, arXiv.org.
    18. Gu, Shihao & Kelly, Bryan & Xiu, Dacheng, 2021. "Autoencoder asset pricing models," Journal of Econometrics, Elsevier, vol. 222(1), pages 429-450.
    Full references (including those not matched with items on IDEAS)

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Shanyan Lai, 2025. "Multilayer Perceptron Neural Network Models in Asset Pricing: An Empirical Study on Large-Cap US Stocks," Papers 2505.01921, arXiv.org, revised May 2025.
    2. Tian Ma & Cunfei Liao & Fuwei Jiang, 2023. "Timing the factor zoo via deep learning: Evidence from China," Accounting and Finance, Accounting and Finance Association of Australia and New Zealand, vol. 63(1), pages 485-505, March.
    3. Wolfgang Drobetz & Tizian Otto, 2021. "Empirical asset pricing via machine learning: evidence from the European stock market," Journal of Asset Management, Palgrave Macmillan, vol. 22(7), pages 507-538, December.
    4. Eghbal Rahimikia & Stefan Zohren & Ser-Huang Poon, 2021. "Realised Volatility Forecasting: Machine Learning via Financial Word Embedding," Papers 2108.00480, arXiv.org, revised Nov 2024.
    5. Avramov, D. & Ge, S. & Li, S. & Linton, O. B., 2025. "Dual Industry Effects and Cross-Stock Predictability," Janeway Institute Working Papers 2506, Faculty of Economics, University of Cambridge.
    6. Zhao, Albert Bo & Cheng, Tingting, 2022. "Stock return prediction: Stacking a variety of models," Journal of Empirical Finance, Elsevier, vol. 67(C), pages 288-317.
    7. Uddin, Ajim & Tao, Xinyuan & Yu, Dantong, 2023. "Attention based dynamic graph neural network for asset pricing," Global Finance Journal, Elsevier, vol. 58(C).
    8. Xiao, Xiang & Hua, Xia & Qin, Kexin, 2024. "A self-attention based cross-sectional return forecasting model with evidence from the Chinese market," Finance Research Letters, Elsevier, vol. 62(PA).
    9. Cakici, Nusret & Fieberg, Christian & Metko, Daniel & Zaremba, Adam, 2023. "Machine learning goes global: Cross-sectional return predictability in international stock markets," Journal of Economic Dynamics and Control, Elsevier, vol. 155(C).
    10. Zhao, Xin & Guo, Yanhong & Liu, Chuanren, 2024. "Leveraging corporate governance characteristics for stock crash risk assessment," International Review of Financial Analysis, Elsevier, vol. 96(PA).
    11. Leippold, Markus & Wang, Qian & Zhou, Wenyu, 2022. "Machine learning in the Chinese stock market," Journal of Financial Economics, Elsevier, vol. 145(2), pages 64-82.
    12. Yulin Liu & Luyao Zhang, 2022. "Cryptocurrency Valuation: An Explainable AI Approach," Papers 2201.12893, arXiv.org, revised Jul 2023.
    13. Yanlong Wang & Jian Xu & Shao-Lun Huang & Danny Dongning Sun & Xiao-Ping Zhang, 2025. "Assessing Uncertainty in Stock Returns: A Gaussian Mixture Distribution-Based Method," Papers 2503.06929, arXiv.org.
    14. Ilias Chronopoulos & Aristeidis Raftapostolos & George Kapetanios, 2024. "Forecasting Value-at-Risk Using Deep Neural Network Quantile Regression," Journal of Financial Econometrics, Oxford University Press, vol. 22(3), pages 636-669.
    15. Jinghai He & Cheng Hua & Chunyang Zhou & Zeyu Zheng, 2025. "Reinforcement-Learning Portfolio Allocation with Dynamic Embedding of Market Information," Papers 2501.17992, arXiv.org.
    16. Victor DeMiguel & Javier Gil-Bazo & Francisco J. Nogales & André A. P. Santos, 2021. "Can Machine Learning Help to Select Portfolios of Mutual Funds?," Working Papers 1245, Barcelona School of Economics.
    17. Mykola Babiak & Jozef Barunik, 2020. "Deep Learning, Predictability, and Optimal Portfolio Returns," CERGE-EI Working Papers wp677, The Center for Economic Research and Graduate Education - Economics Institute, Prague.
    18. Cakici, Nusret & Zaremba, Adam, 2024. "What drives stock returns across countries? Insights from machine learning models," International Review of Financial Analysis, Elsevier, vol. 96(PA).
    19. Avramov, D. & Ge, S. & Li, S. & Linton, O. B., 2025. "Dual Industry Effects and Cross-Stock Predictability," Cambridge Working Papers in Economics 2512, Faculty of Economics, University of Cambridge.
    20. Cakici, Nusret & Shahzad, Syed Jawad Hussain & Będowska-Sójka, Barbara & Zaremba, Adam, 2024. "Machine learning and the cross-section of cryptocurrency returns," International Review of Financial Analysis, Elsevier, vol. 94(C).

    More about this item

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:arx:papers:2505.01575. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: arXiv administrators (email available below). General contact details of provider: http://arxiv.org/ .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.