Article

Can large language models implement agent-based models? An ODD-based replication study

Ecological Modelling

Nuno Fachada; Daniel Fernandes; João P. Matos-Carvalho2026Elsevier

Key information

Authors:

Nuno Fachada (Nuno Fachada); Daniel Fernandes; Carlos M. Fernandes (Carlos Miguel da Costa Fernandes); João P. Matos-Carvalho

Published in

1 de julho de 2026

Abstract

Large language models (LLMs) can now synthesize non-trivial executable code from textual descriptions, raising an important question: can LLMs reliably implement agent-based models from standardized specifications in a way that supports replication, verification, and validation? We address this question by evaluating 17 contemporary LLMs on a controlled ODD-to-code translation task, using the PPHPC predator–prey model as a fully specified reference. Generated Python implementations are assessed through staged executability checks, model-independent statistical comparison against a validated NetLogo baseline, and quantitative measures of runtime efficiency and maintainability. Results show that behaviorally faithful implementations are achievable but not guaranteed, and that executability alone is insufficient for scientific use. GPT-4.1 consistently produces statistically valid and efficient implementations, with Claude 3.7 Sonnet performing well but less reliably. Overall, the findings clarify both the promise and current limitations of LLMs as model engineering tools, with implications for reproducible agent-based and ecological modeling.

Publication details

Authors in the community:

Publication version

VoR - Version of Record

Publisher

Elsevier

Link to the publisher's version

https://doi.org/10.1016/j.ecolmodel.2026.111624

Title of the publication container

Ecological Modelling

First page or article number

111624

Volume

517

ISSN

1872-7026

Fields of Science and Technology (FOS)

computer-and-information-sciences - Computer and information sciences

Keywords

  • Natural language model specification
  • Specification-to-code translation
  • Code generation
  • Computational reproducibility
  • Verification and validation

Publication language (ISO code)

eng - English

Rights type:

Restricted access

Financing entity

Fundação para a Ciência e a Tecnologia

Title of the project, award or grant: INESC INOV – Laboratório de Investigação & Desenvolvimento

Visit project

Funding Stream: Avaliação UID 2023/2024

Identifier for the funding entity: https://doi.org/10.13039/501100001871

Type of identifier of the funding entity: Crossref Funder

Number for the project, award or grant: UID/06486/2025

Financing entity

Fundação para a Ciência e a Tecnologia

Title of the project, award or grant: INESC INOV – Laboratório de Investigação & Desenvolvimento

Visit project

Funding Stream: Avaliação UID 2023/2024 PRR

Identifier for the funding entity: https://doi.org/10.13039/501100001871

Type of identifier of the funding entity: Crossref Funder

Number for the project, award or grant: UID/PRR/06486/2025

Financing entity

Fundação para a Ciência e a Tecnologia

Title of the project, award or grant: INESC INOV – Laboratório de Investigação & Desenvolvimento

Visit project

Funding Stream: EQUIPAR +2 - UID.PRR2

Identifier for the funding entity: https://doi.org/10.13039/501100001871

Type of identifier of the funding entity: Crossref Funder

Number for the project, award or grant: UID/PRR2/06486/2025

Financing entity

Fundação para a Ciência e a Tecnologia

Title of the project, award or grant: Instituto de Telecomunicações

Visit project

Funding Stream: Avaliação UID 2023/2024

Identifier for the funding entity: https://doi.org/10.13039/501100001871

Type of identifier of the funding entity: Crossref Funder

Number for the project, award or grant: UID/50008/2025

Financing entity

Fundação para a Ciência e a Tecnologia

Title of the project, award or grant: Instituto de Telecomunicações

Visit project

Funding Stream: Avaliação UID 2023/2024 PRR

Identifier for the funding entity: https://doi.org/10.13039/501100001871

Type of identifier of the funding entity: Crossref Funder

Number for the project, award or grant: UID/PRR/50008/2025

Financing entity

Fundação para a Ciência e a Tecnologia

Title of the project, award or grant: Instituto de Telecomunicações

Visit project

Funding Stream: EQUIPAR +2 - UID.PRR2

Identifier for the funding entity: https://doi.org/10.13039/501100001871

Type of identifier of the funding entity: Crossref Funder

Number for the project, award or grant: UID/PRR2/50008/2025

Financing entity

Fundação para a Ciência e a Tecnologia

Title of the project, award or grant: João P. Matos-Carvalho

Identifier for the funding entity: https://doi.org/10.13039/501100001871

Type of identifier of the funding entity: Crossref Funder

Number for the project, award or grant: 2023.15441.TENURE.051/CP00003/CT00029

Financing entity

Fundação para a Ciência e a Tecnologia

Title of the project, award or grant: LASIGE Centro de Investigação em Ciência e Engenharia da Computação

Visit project

Funding Stream: Avaliação UID 2023/2024

Identifier for the funding entity: https://doi.org/10.13039/501100001871

Type of identifier of the funding entity: Crossref Funder

Number for the project, award or grant: UID/00408/2025

Financing entity

Fundação para a Ciência e a Tecnologia

Title of the project, award or grant: LASIGE Centro de Investigação em Ciência e Engenharia da Computação

Visit project

Funding Stream: Avaliação UID 2023/2024 PRR

Identifier for the funding entity: https://doi.org/10.13039/501100001871

Type of identifier of the funding entity: Crossref Funder

Number for the project, award or grant: UID/PRR/00408/2025

Financing entity

Fundação para a Ciência e a Tecnologia

Title of the project, award or grant: A computational pipeline for modeling and predicting wildfire behavior

Visit project

Funding Stream: CEEC INST 2ed

Identifier for the funding entity: https://doi.org/10.13039/501100001871

Type of identifier of the funding entity: Crossref Funder

Number for the project, award or grant: CEECINST/00002/2021/CP2788/CT0001

Financing entity

Instituto Lusófono de Investigação e Desenvolvimento

Title of the project, award or grant: FireGuard: Fire Management with Autonomous UAV Navigation

Visit project

Funding Stream: Seed Funding

Identifier for the funding entity: http://isni.org/isni/0000000458956849

Type of identifier of the funding entity: ISNI

Number for the project, award or grant: COFAC/ILIND/COPELABS/1/2024

Financing entity

Ministerio de Ciencia, Innovación y Universidades

Title of the project, award or grant: SINTESIS Y EXPLORACION DE SISTEMAS COMPLEJOS EFICIENTES APLICADAS A CIBERSEGURIDAD, VIDEOJUEGOS Y ANALISIS DE SOCIEDADES HISTORICAS

Funding Stream: MICIU/AEI/10.13039/501100011033

Identifier for the funding entity: https://doi.org/10.13039/100014440

Type of identifier of the funding entity: Crossref Funder

Number for the project, award or grant: PID2023-147409NB-C21