IDEAS home Printed from https://ideas.repec.org/a/gam/jftint/v17y2025i9p412-d1745033.html

GPT-4.1 Sets the Standard in Automated Experiment Design Using Novel Python Libraries

Author

Listed:
  • Nuno Fachada

    (Copelabs, Lusófona University, Campo Grande, 376, 1749-024 Lisboa, Portugal
    Center of Technology and Systems (UNINOVA-CTS) and Associated Lab of Intelligent Systems (LASI), 2829-516 Caparica, Portugal)

  • Daniel Fernandes

    (Copelabs, Lusófona University, Campo Grande, 376, 1749-024 Lisboa, Portugal)

  • Carlos M. Fernandes

    (Copelabs, Lusófona University, Campo Grande, 376, 1749-024 Lisboa, Portugal
    Center of Technology and Systems (UNINOVA-CTS) and Associated Lab of Intelligent Systems (LASI), 2829-516 Caparica, Portugal)

  • Bruno D. Ferreira-Saraiva

    (Copelabs, Lusófona University, Campo Grande, 376, 1749-024 Lisboa, Portugal
    CICANT, Lusófona University, Campo Grande, 376, 1749-024 Lisboa, Portugal)

  • João P. Matos-Carvalho

    (Center of Technology and Systems (UNINOVA-CTS) and Associated Lab of Intelligent Systems (LASI), 2829-516 Caparica, Portugal
    LASIGE and Departamento de Informática, Faculdade de Ciências, University of Lisbon, Campo Grande, 1749-016 Lisboa, Portugal)

Abstract

Large language models (LLMs) have advanced rapidly as tools for automating code generation in scientific research, yet their ability to interpret and use unfamiliar Python APIs for complex computational experiments remains poorly characterized. This study systematically benchmarks a selection of state-of-the-art LLMs in generating functional Python code for two increasingly challenging scenarios: conversational data analysis with the ParShift library, and synthetic data generation and clustering using pyclugen and scikit-learn . Both experiments use structured, zero-shot prompts specifying detailed requirements but omitting in-context examples. Model outputs are evaluated quantitatively for functional correctness and prompt compliance over multiple runs, and qualitatively by analyzing the errors produced when code execution fails. Results show that only a small subset of models consistently generate correct, executable code. GPT-4.1 achieved a 100% success rate across all runs in both experimental tasks, whereas most other models succeeded in fewer than half of the runs, with only Grok-3 and Mistral-Large approaching comparable performance. In addition to benchmarking LLM performance, this approach helps identify shortcomings in third-party libraries, such as unclear documentation or obscure implementation bugs. Overall, these findings highlight current limitations of LLMs for end-to-end scientific automation and emphasize the need for careful prompt design, comprehensive library documentation, and continued advances in language model capabilities.

Suggested Citation

  • Nuno Fachada & Daniel Fernandes & Carlos M. Fernandes & Bruno D. Ferreira-Saraiva & João P. Matos-Carvalho, 2025. "GPT-4.1 Sets the Standard in Automated Experiment Design Using Novel Python Libraries," Future Internet, MDPI, vol. 17(9), pages 1-28, September.
  • Handle: RePEc:gam:jftint:v:17:y:2025:i:9:p:412-:d:1745033
    as

    Download full text from publisher

    File URL: https://www.mdpi.com/1999-5903/17/9/412/pdf
    Download Restriction: no

    File URL: https://www.mdpi.com/1999-5903/17/9/412/
    Download Restriction: no
    ---><---

    References listed on IDEAS

    as
    1. Charles R. Harris & K. Jarrod Millman & Stéfan J. Walt & Ralf Gommers & Pauli Virtanen & David Cournapeau & Eric Wieser & Julian Taylor & Sebastian Berg & Nathaniel J. Smith & Robert Kern & Matti Picu, 2020. "Array programming with NumPy," Nature, Nature, vol. 585(7825), pages 357-362, September.
    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. Tan Wang & L. Jeff Hong, 2023. "Large-Scale Inventory Optimization: A Recurrent Neural Networks–Inspired Simulation Approach," INFORMS Journal on Computing, INFORMS, vol. 35(1), pages 196-215, January.
    2. Geeraert, Joke & Rocha, Luis E.C. & Vandeviver, Christophe, 2024. "The impact of violent behavior on co-offender selection: Evidence of behavioral homophily," Journal of Criminal Justice, Elsevier, vol. 94(C).
    3. Léon Faure & Bastien Mollet & Wolfram Liebermeister & Jean-Loup Faulon, 2023. "A neural-mechanistic hybrid approach improving the predictive power of genome-scale metabolic models," Nature Communications, Nature, vol. 14(1), pages 1-14, December.
    4. Claudia Quinteros-Cartaya & Guillermo Solorio-Magaña & Francisco Javier Núñez-Cornú & Felipe de Jesús Escalona-Alcázar & Diana Núñez, 2023. "Microearthquakes in the Guadalajara Metropolitan Zone, Mexico: evidence from buried active faults in Tesistán Valley, Zapopan," Natural Hazards: Journal of the International Society for the Prevention and Mitigation of Natural Hazards, Springer;International Society for the Prevention and Mitigation of Natural Hazards, vol. 116(3), pages 2797-2818, April.
    5. Furqan Dar & Samuel R. Cohen & Diana M. Mitrea & Aaron H. Phillips & Gergely Nagy & Wellington C. Leite & Christopher B. Stanley & Jeong-Mo Choi & Richard W. Kriwacki & Rohit V. Pappu, 2024. "Biomolecular condensates form spatially inhomogeneous network fluids," Nature Communications, Nature, vol. 15(1), pages 1-17, December.
    6. Philipp Fey & Daniel Ludwig Weber & Jannik Stebani & Philipp Mörchel & Peter Jakob & Jan Hansmann & Karl-Heinz Hiller & Daniel Haddad, 2023. "Non-destructive classification of unlabeled cells: Combining an automated benchtop magnetic resonance scanner and artificial intelligence," PLOS Computational Biology, Public Library of Science, vol. 19(2), pages 1-31, February.
    7. Nina Tiel & Fabian Fopp & Philipp Brun & Johan Hoogen & Dirk Nikolaus Karger & Cecilia M. Casadei & Lisha Lyu & Devis Tuia & Niklaus E. Zimmermann & Thomas W. Crowther & Loïc Pellissier, 2024. "Regional uniqueness of tree species composition and response to forest loss and climate change," Nature Communications, Nature, vol. 15(1), pages 1-12, December.
    8. López Pérez, Mario & Mansilla Corona, Ricardo, 2022. "Ordinal synchronization and typical states in high-frequency digital markets," Physica A: Statistical Mechanics and its Applications, Elsevier, vol. 598(C).
    9. Jessica M. Vanslambrouck & Sean B. Wilson & Ker Sin Tan & Ella Groenewegen & Rajeev Rudraraju & Jessica Neil & Kynan T. Lawlor & Sophia Mah & Michelle Scurr & Sara E. Howden & Kanta Subbarao & Melissa, 2022. "Enhanced metanephric specification to functional proximal tubule enables toxicity screening and infectious disease modelling in kidney organoids," Nature Communications, Nature, vol. 13(1), pages 1-23, December.
    10. Kiran Krishnamachari & Dylan Lu & Alexander Swift-Scott & Anuar Yeraliyev & Kayla Lee & Weitai Huang & Sim Ngak Leng & Anders Jacobsen Skanderup, 2022. "Accurate somatic variant detection using weakly supervised deep learning," Nature Communications, Nature, vol. 13(1), pages 1-8, December.
    11. Larissa Samaan & Leonie Klock & Sandra Weber & Mirjam Reidick & Leonie Ascone & Simone Kühn, 2024. "Low-Level Visual Features of Window Views Contribute to Perceived Naturalness and Mental Health Outcomes," IJERPH, MDPI, vol. 21(5), pages 1-35, May.
    12. Dennis Bontempi & Leonard Nuernberg & Suraj Pai & Deepa Krishnaswamy & Vamsi Thiriveedhi & Ahmed Hosny & Raymond H. Mak & Keyvan Farahani & Ron Kikinis & Andrey Fedorov & Hugo J. W. L. Aerts, 2024. "End-to-end reproducible AI pipelines in radiology using the cloud," Nature Communications, Nature, vol. 15(1), pages 1-9, December.
    13. Pablo García-Risueño, 2025. "Historical Simulation Systematically Underestimates the Expected Shortfall," JRFM, MDPI, vol. 18(1), pages 1-12, January.
    14. Lauren L. Porter & Allen K. Kim & Swechha Rimal & Loren L. Looger & Ananya Majumdar & Brett D. Mensh & Mary R. Starich & Marie-Paule Strub, 2022. "Many dissimilar NusG protein domains switch between α-helix and β-sheet folds," Nature Communications, Nature, vol. 13(1), pages 1-12, December.
    15. Ali Rezaei & Virág Kocsis-Jutka & Zeynep I. Gunes & Qing Zeng & Georg Kislinger & Franz Bauernschmitt & Huseyin Berkcan Isilgan & Laura R. Parisi & Tuğberk Kaya & Sören Franzenburg & Jonas Koppenbrink, 2025. "Correction of dysregulated lipid metabolism normalizes gene expression in oligodendrocytes and prolongs lifespan in female poly-GA C9orf72 mice," Nature Communications, Nature, vol. 16(1), pages 1-17, December.
    16. Oren Amsalem & Hidehiko Inagaki & Jianing Yu & Karel Svoboda & Ran Darshan, 2024. "Sub-threshold neuronal activity and the dynamical regime of cerebral cortex," Nature Communications, Nature, vol. 15(1), pages 1-17, December.
    17. Matthew Rosenblatt & Link Tejavibulya & Rongtao Jiang & Stephanie Noble & Dustin Scheinost, 2024. "Data leakage inflates prediction performance in connectome-based machine learning models," Nature Communications, Nature, vol. 15(1), pages 1-15, December.
    18. Jackie Grant & Mark Hindmarsh & Sergey E. Koposov, 2022. "The distribution of loss to future USS pensions due to the UUK cuts of April 2022," Papers 2206.06201, arXiv.org.
    19. Sayedali Shetab Boushehri & Katharina Essig & Nikolaos-Kosmas Chlis & Sylvia Herter & Marina Bacac & Fabian J. Theis & Elke Glasmacher & Carsten Marr & Fabian Schmich, 2023. "Explainable machine learning for profiling the immunological synapse and functional characterization of therapeutic antibodies," Nature Communications, Nature, vol. 14(1), pages 1-16, December.
    20. Hector F. Loponte & Jing Zheng & Yajie Ding & Isadora A. Oliveira & Kristoffer Basse & Adriane R. Todeschini & Peter L. Horvatovich & Guinevere S. M. Lageveen-Kammeijer, 2025. "GlycoGenius: a streamlined high-throughput glycan composition identification tool," Nature Communications, Nature, vol. 16(1), pages 1-17, December.

    More about this item

    Keywords

    ;
    ;
    ;

    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:gam:jftint:v:17:y:2025:i:9:p:412-:d:1745033. 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: MDPI Indexing Manager (email available below). General contact details of provider: https://www.mdpi.com .

    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.