SearcharxivSearch

arXiv · 2507.08144

AI for NONMEM Coding in Pharmacometrics Research and Education: Shortcut or Pitfall?

Abstract

Artificial intelligence (AI) is increasingly being explored as a tool to support pharmacometric modeling, particularly in addressing the coding challenges associated with NONMEM. In this study, we evaluated the ability of seven AI agents to generate NONMEM codes across 13 pharmacometrics tasks, including a range of population pharmacokinetic (PK) and pharmacodynamic (PD) models. We further developed a standardized scoring rubric to assess code accuracy and created an optimized prompt to improve AI agent performance. Our results showed that the OpenAI o1 and gpt-4.1 models achieved the best performance, both generating codes with great accuracy for all tasks when using our optimized prompt. Overall, AI agents performed well in writing basic NONMEM model structures, providing a useful foundation for pharmacometrics model coding. However, user review and refinement remain essential, especially for complex models with special dataset alignment or advanced coding techniques. We also discussed the applications of AI in pharmacometrics education, particularly strategies to prevent over-reliance on AI for coding. This work provides a benchmark for current AI agents performance in NONMEM coding and introduces a practical prompt that can facilitate more accurate and efficient use of AI in pharmacometrics research and education.

Explore related subjects

Keep this discovery

BibTeXRIS

Wenhao Zheng, Wanbing Wang, Carl M. J. Kirkpatrick, Cornelia B. Landersdorfer, Huaxiu Yao, Jiawei Zhou. 2025-07-10. AI for NONMEM Coding in Pharmacometrics Research and Education: Shortcut or Pitfall?. https://arxiv.org/abs/2507.08144

Cite the original work for its findings. Save a collection to share your selection of sources.

KEEP EXPLORING

Related papers

MarkerScout: A Disease-Agnostic Machine Learning Framework for Biomarker Prediction from Multi-Scale Mechanistic Models

We demonstrate the framework on three infectious diseases derived from a companion mechanistic immune-simulation platform: SARS-CoV-2, Influenza A Virus, and Plasmodium falciparum. Each disease was evaluated across hospitalization and intensive care unit cohorts, yielding six cohorts in total. Best-pipeline cross-validated macro F1 ranged from 0.82 for IAV-HOSP to 0.99 for COV-ICU, and the framework produced tiered, direction-aware biomarker lists for each disease and phase. Interleukin-18 (IL-18) reached the strongest tier in both SARS-CoV-2 phases with consistent direction. When benchmarked against three separate, independently collected clinical ICU datasets, MarkerScout's top-ranked features outperformed 94.4% of randomly selected feature sets of equivalent size for SARS-CoV-2, with a weaker but directionally consistent advantage for Influenza A Virus (66.7%) and Plasmodium falciparum (60.7%).

q-bio.OT

Enhancing Clinical Decision Support and Differential Diagnosis with Knowledge Graphs, and Retrieval Augmented Generation in Generative AI

Diagnostic error carries a burden, while unconstrained large language models (LLMs) remain vulnerable to hallucination and weak integration of quantitative laboratory dynamics. We developed a decision-support pipeline combining disease-specific biomarker correlation graphs, ordinary differential equations (ODEs), deep sequence classification, and retrieval-augmented generation (RAG). For 103 disease classes from a full blood count (FBC) repository, biomarker networks were used as coupling matrices to generate 30 trajectories per disease (3,090 total). A one-dimensional convolutional neural network (CNN) and long short-term memory (LSTM) network classified disease trajectories and six dynamical clusters. A constrained GPT-4o-mini RAG layer used a 19-pattern BMJ Best Practice/NICE corpus to generate differential diagnoses evaluated for diagnostic suitability, evidential grounding, and clinical plausibility. Across five random-seed runs, disease-level accuracy was $0.940 \pm 0.006$ for the CNN (95\% CI 0.933--0.948) and $0.852 \pm 0.019$ for the LSTM (95\% CI 0.828--0.875); the CNN advantage was 8.87 percentage points (95\% CI 6.47--11.27; $t(4)=10.26$, $p=5.1\times10^{-4}$; Hedges' $g=3.67$). Among 100 sampled RAG cases, 96 parsed successfully; evidence was cited in 97.9\%, the true diagnosis was mentioned in 71.9\%, and the composite score was 3.82/5 with a 47.9\% strict pass rate. The central finding was a decoupling between grounding and diagnostic correctness: classifier-correct versus classifier-wrong outputs differed in diagnostic suitability but not evidential grounding. Post-hoc analysis confirmed a 1.02-point diagnostic-score difference (Mann--Whitney $p=0.0024$; Hedges' $g=0.72$), whereas grounding differed by only $-0.02$ points ($p=0.839$; $g=-0.04$).

q-bio.OT

Expanding the Human Ancestry Ontology to include under-represented populations and ethnicities for broader utility in annotations

Successful discovery, integration and reuse of data relies on the availability of rich, well-structured and machine-readable metadata to describe every aspect of the data, from sample sources to collection processes to experimental protocols. The use of standardised terminologies to express concepts in a harmonised fashion lies at the core of high-quality data annotation, increasing the FAIRness of the data, facilitating data integration and promoting reproducibility. Here, we describe the Human Ancestry Ontology (HANCESTRO), originally developed to improve standardised reporting of genetic ancestry genomic resources such as the NHGRI-EBI GWAS Catalog and the Human Cell Atlas through high-level population descriptors, and more recently expanded to include diverse and previously under-represented populations in genomics and genetics research. HANCESTRO provides a framework for population descriptors that includes both ancestry based on the analysis of genetic information and self-reported ethnicity, which is based on social and cultural factors that don't necessarily align with genetic populations. By enabling the accurate and interoperable representation of population-related data, it promotes inclusive, representative and reproducible science.

q-bio.OT