IDEAS home Printed from https://ideas.repec.org/a/eee/finlet/v86y2025ipds1544612325017945.html

Code like an economist: Analyzing LLMs’ code generation capabilities in economics and finance

Author

Listed:
  • Song, Ziyu
  • Wu, Shan
  • Zhou, Yuqin

Abstract

This study investigates the code generation capabilities of large language models (LLMs) in the context of economics and finance research. Using a curated dataset of 1,088 academic papers from top-tier journals across 19 subfields, we design prompts that task a current LLM with generating code to replicate the analytical procedures described in each study. We evaluate the generated outputs for accuracy and document regeneration behaviors under autonomous (self-regeneration) and human-assisted settings. Employing a two-stage model with clustered bootstrap, we find that repeated self-regeneration improves output quality, while higher initial accuracy is associated with diminishing marginal improvements. Human-assisted regeneration further enhances code quality, particularly when built upon effective prior self-regenerations. Author expertise positively correlates with regeneration success, whereas theoretical papers are linked to lower performance, reflecting their abstract and complex nature. Robustness checks using post-2021 Q4 publications, which lie outside the LLM’s training data, confirm the consistency of these findings. Our results highlight both the promise and limitations of LLMs in supporting reproducibility and automation in computational economic and financial research.

Suggested Citation

  • Song, Ziyu & Wu, Shan & Zhou, Yuqin, 2025. "Code like an economist: Analyzing LLMs’ code generation capabilities in economics and finance," Finance Research Letters, Elsevier, vol. 86(PD).
  • Handle: RePEc:eee:finlet:v:86:y:2025:i:pd:s1544612325017945
    DOI: 10.1016/j.frl.2025.108540
    as

    Download full text from publisher

    File URL: http://www.sciencedirect.com/science/article/pii/S1544612325017945
    Download Restriction: Full text for ScienceDirect subscribers only

    File URL: https://libkey.io/10.1016/j.frl.2025.108540?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    As the access to this document is restricted, you may want to

    for a different version of it.

    More about this item

    Keywords

    ;
    ;
    ;

    JEL classification:

    • C80 - Mathematical and Quantitative Methods - - Data Collection and Data Estimation Methodology; Computer Programs - - - General
    • C87 - Mathematical and Quantitative Methods - - Data Collection and Data Estimation Methodology; Computer Programs - - - Econometric Software

    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:eee:finlet:v:86:y:2025:i:pd:s1544612325017945. 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.

    We have no bibliographic references for this item. You can help adding them by using 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: Catherine Liu (email available below). General contact details of provider: http://www.elsevier.com/locate/frl .

    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.