David Krčmář, Kamila Hodasová, Martin Zatlakovič, Natália Bahnová
{"title":"Knowledge-Augmented Large Language Model for Autonomous MODFLOW 6 Input File Generation","authors":"David Krčmář, Kamila Hodasová, Martin Zatlakovič, Natália Bahnová","doi":"10.1111/gwat.70102","DOIUrl":null,"url":null,"abstract":"<p>A large language model (LLM) coding agent can build complete MODFLOW 6 input file sets from natural-language descriptions when given the right reference material, without retraining the model. The reference material, which we call a plugin, comprises 42 plain-text package files (one per MODFLOW 6 package, written from the official Input/Output Guide, the Fortran source code, and the simulator's runtime error messages), plus seven workflow files and one configuration file. A suite of 59 pass-or-fail checks covered five tasks: steady-state flow, transient flow with pumping, coupled flow and solute transport, coupled flow and heat transport, and validation of an existing model. On the unmodified plugin, 52 of 59 checks passed (88%); the seven failures were all runtime errors, six of them caused by constraints spanning more than one input file. Two independent improvement strategies followed: an expert-guided batch correction and an automated one-failure-at-a-time loop. Both reached 59 of 59 (100%) and modified the same four skill files; the expert-guided strategy, which identified five root causes, made one additional edit to a workflow command file. This convergence indicates that the failures came from gaps in the reference files, not from random variation in the model's output. The automated loop required no human intervention. The methodology has been replicated on a sibling simulator (MODFLOW USG-Transport; Krčmář et al. 2026b) with 100% first-attempt success. The result is a reusable design pattern for adapting an LLM coding agent to a scientific simulator without retraining the model.</p>","PeriodicalId":12866,"journal":{"name":"Groundwater","volume":"64 5","pages":"565-575"},"PeriodicalIF":2.6000,"publicationDate":"2026-09-13","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Groundwater","FirstCategoryId":"89","ListUrlMain":"https://onlinelibrary.wiley.com/doi/10.1111/gwat.70102","RegionNum":4,"RegionCategory":"地球科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"2026/9/6 0:00:00","PubModel":"Epub","JCR":"Q3","JCRName":"GEOSCIENCES, MULTIDISCIPLINARY","Score":null,"Total":0}
引用次数: 0
Abstract
A large language model (LLM) coding agent can build complete MODFLOW 6 input file sets from natural-language descriptions when given the right reference material, without retraining the model. The reference material, which we call a plugin, comprises 42 plain-text package files (one per MODFLOW 6 package, written from the official Input/Output Guide, the Fortran source code, and the simulator's runtime error messages), plus seven workflow files and one configuration file. A suite of 59 pass-or-fail checks covered five tasks: steady-state flow, transient flow with pumping, coupled flow and solute transport, coupled flow and heat transport, and validation of an existing model. On the unmodified plugin, 52 of 59 checks passed (88%); the seven failures were all runtime errors, six of them caused by constraints spanning more than one input file. Two independent improvement strategies followed: an expert-guided batch correction and an automated one-failure-at-a-time loop. Both reached 59 of 59 (100%) and modified the same four skill files; the expert-guided strategy, which identified five root causes, made one additional edit to a workflow command file. This convergence indicates that the failures came from gaps in the reference files, not from random variation in the model's output. The automated loop required no human intervention. The methodology has been replicated on a sibling simulator (MODFLOW USG-Transport; Krčmář et al. 2026b) with 100% first-attempt success. The result is a reusable design pattern for adapting an LLM coding agent to a scientific simulator without retraining the model.
期刊介绍:
Ground Water is the leading international journal focused exclusively on ground water. Since 1963, Ground Water has published a dynamic mix of papers on topics related to ground water including ground water flow and well hydraulics, hydrogeochemistry and contaminant hydrogeology, application of geophysics, groundwater management and policy, and history of ground water hydrology. This is the journal you can count on to bring you the practical applications in ground water hydrology.