Editor’s introduction
The study assesses R code generated for biomedical analyses using RBioBench, a benchmark of 296 tasks from Bioconductor and Pharmaverse. The best-performing language models pass only about 55.4% of tasks, often due to calling nonexistent functions. This indicates that execution feedback helps agents learn software usage but does not ensure correct analytical outcomes. The evidence shows that silent errors are frequently missed because incorrect results appear valid and lack explicit error signals in the software interface.
Introduction
Artificial intelligence is changing how science is done, from generating hypotheses to running experiments. In biomedicine, agents built on language models now plan and carry out data analyses, and many researchers already use such models to write code. In biomedical research, R is the de facto standard programming language, with applications spanning omics data analysis, drug development pipelines, and clinical regulatory reporting. This is because R was built specifically for statistical computing, with native support for tabular and vectorized data structures that naturally reflect the characteristics of molecular and clinical data. Recognizing its central role in the field, the FDA formally accepted R-based file formats in electronic regulatory submissions in September 2025. The reliability of this computational foundation is therefore critical to the credibility of biomedical findings and the decisions they inform. Errors in analysis code can propagate into scientific conclusions while leaving outputs that appear plausible. For example, a single software error led to five retractions, while silent gene-name conversions by spreadsheet software affected about a fifth of papers publishing gene lists. As AI increasingly writes biomedical analyses, the key question is not whether it can generate R code, but whether the resulting analyses can be trusted.
In this work, we examine the boundaries of AI’s ability to generate reliable R code for biomedical research. Reliability requires more than executable code: an analysis must preserve the scientific meaning of the data and the validity of the operations applied to them. This rests on two foundations: knowledge of R’s ecosystem of specialized packages and knowledge of the biomedical principles that govern their use. Package knowledge includes knowing which functions are available, what arguments they require, and which data objects they accept. Biomedical knowledge, in turn, is needed to ensure that the use of these packages is appropriate for the data and the scientific question. This includes understanding data-generating processes, statistical assumptions, and domain conventions that are often left implicit in code. We focus on a distinction between interface errors, which trigger explicit execution errors, and silent errors, in which code executes successfully but produces incorrect results. For example, clinical trial-day calculations exclude day 0; code that violates this convention can run without error while reporting incorrect study days.
Recently, a growing number of benchmarks have been proposed to evaluate coding capabilities and accelerate the development of coding agents. However, most benchmarks focus on Python, and few evaluate R-based biomedical analyses against reference results. BioCoder evaluates bioinformatics-specific code generation and BioDSBench studies biomedical data-science programming copilots, but these evaluations rarely distinguish between interface errors and silent errors. These limitations leave a gap in evaluating the reliability of AI-generated biomedical R code: execution success alone cannot establish whether an analysis is correct. A shared, executable testbed is needed to distinguish execution failures from silent errors and compare systems against domain-specific reference results.
The benchmark
Performance is reported as Pass@1, the proportion of tasks passed in a single attempt. Direct LLMs and the agent frameworks made three attempts per task; for these settings, Pass@1 is the mean across attempts, and Pass@3 is the proportion of tasks passed at least once. Diagnostic tools then characterize each failure. An error classifier identifies the R error underlying each crash, with errors arising from package misuse classified as interface errors, and predefined rules assign each failed task to one or more of six failure categories.
Silent errors remain difficult for agents to correct
Agents can correct errors that R reports, but R reports crashes, not silent errors. Within agents, crashes become rare: for the four models evaluated in both modes on both tracks, the crash rate on Clinical Study falls from 31.7–66.4% of direct attempts to at most 2.0%. Silent errors, however, persist at 13–25% of Clinical Study attempts with or without an agent, and on Bioinformatics they become the most common failure type among agents.
Implications for building and evaluating scientific agents
Reliable scientific agents will depend as much on the checks available to them as on the models they use. Checks such as comparisons with reference outputs, unit checks, and domain-specific tests make silent errors visible, and could be used to evaluate self-improving agents, to reward them during training, or to select their best attempts. Because such checks require reference outputs, they are better suited to training and evaluation than to routine use, and held-out tasks are needed to prevent agents from optimizing for the checks rather than for the task. In addition, fields should make their conventions explicit: step-by-step workflows that state rules and checks, as some clinical pipelines already do, may help where agents cannot infer a rule on their own.
This study has several limitations. RBioBench covers selected Bioconductor and Pharmaverse packages at fixed versions. Models may have encountered similar code during training, although newly created input data and the grading of outputs rather than code reduce this risk. The Clinical Study tasks do not assess practices required by regulators, such as independent double programming, so passing them does not indicate readiness for regulatory work. Agents also work with the input files rather than a preview and can take many steps, so part of their improvement may stem from these differences rather than from code execution alone (Methods). The agent-run analyses cover seven settings, detect events by text matching, and report associations that are not adjusted for task difficulty. Finally, our data cannot separate silent errors caused by missing domain knowledge from those caused by tasks that leave a convention unstated. We hypothesize that unstated domain conventions, more than coding ability, limit current agents, and we will continue to update RBioBench and its testbed to test this hypothesis.
Benchmark design
RBioBench is designed as a reusable execution-based resource for biomedical R code generation in two package ecosystems. The Bioinformatics track contains 149 tasks grounded mainly in Bioconductor workflows, along with a few CRAN packages commonly used alongside them (for example, Seurat, ape, and survival), including omics data processing, genomic intervals, sequence analysis, mutation summaries, network analysis, and related structured outputs. The Clinical Study track contains 147 tasks grounded in Pharmaverse/CDISC-style workflows, including ADaM derivation, SDTM conversion, date and datetime processing, pharmacokinetic summaries and table/listing/figure generation. Each task includes a natural-language instruction, structured input files, reference outputs, and an executable evaluator, enabling future systems to be tested against the same scientific programming contract. The final denominator used for each reported result is recorded in the corresponding result source data. Every reported row is graded on the full task set of its track (149 Bioinformatics or 147 Clinical Study tasks); Gemini 3.1 Pro and Grok-4.3 were evaluated as direct LLMs on Clinical Study only.
Failure categories
We analyzed non-passing tasks with a non-exclusive set of failure categories derived from execution traces, generated programs, and output-comparison reports. The categories follow prior work that classified bioinformatics-agent failures from execution logs, studies of production-genomics workflow failures and requirements for reproducible bioinformatics analysis.
Guided by these precedents and restricted to evidence observable under the frozen evaluator, we used six categories: (1) input data and artifacts, covering absent, unreadable or incorrectly addressed inputs and required outputs; (2) metadata, identifiers and annotation, including gene or sample identifiers, labels, species, groups and column semantics; (3) data structure and interoperability, including incompatible matrices, tables, indices, serialized objects and Bioconductor/Pharmaverse structures; (4) quantitative and statistical validity, covering numerical disagreement, missing-value discordance and tolerance failures; (5) biological result and output validity, covering incorrect labels, classes, result content and other domain-facing outputs; and (6) execution and environment, covering syntax, dependency, API, timeout, resource and other code-engineering failures. We did not infer an unobserved workflow or parameter-selection cause solely from an incorrect final output. Labels were assigned by deterministic rules over the evaluator’s recorded diagnostics (execution status, standard error, checker tier and mismatch type); no language model was used for labeling, and the release provides the rules and the evidence fields behind every label.
Use of large language models
This work studies large language models and coding agents. LLM-based coding assistants were used for code inspection, analysis scripting and language editing; all outputs were checked by the authors, who take responsibility for the scientific claims, analyses and manuscript content.
Benchmark construction
RBioBench tasks are constructed from package-grounded biomedical R workflows. Each benchmark instance contains a task instruction, structured inputs, a reference solution, expected outputs and a grading specification. The public release freezes the final task manifest, which records task ID, domain, package, method category, input modalities, expected output files, checker type and inclusion status. The released benchmark contains 149 Bioinformatics tasks and 147 Clinical Study tasks. Task identifiers are stable across releases and therefore not contiguous.
Evaluation design
All settings are graded by the same evaluator and checkers. Direct LLMs receive the task instruction and a description of the inputs; each produces three independent samples, scored by Pass@1 (the mean over samples) and Pass@3. Managed coding agents and mini-SWE-agent receive the same instruction and the input files and are scored by Pass@1. Open-source agent frameworks were run in two modes. In the independent mode (Pass@3), three runs start from the original task and cannot see one another’s results. In the sequential mode (Feedback@3), one run may use up to three generate-and-execute rounds; each round receives filtered feedback from the previous one, and the run stops at the first pass. The main-text figures use only the independent mode, and the two modes are not pooled. Feedback@3 task pass rates on Clinical Study and Bioinformatics are: Biomni 38.8% and 56.4%; ToolUniverse 33.3% and 47.0%; ReAct 30.6% and 36.2%; DSWizard 27.9% and 53.0%; CodeGen 24.5% and 44.3%. Feedback@3 exceeds the single-attempt Pass@1 of the same framework (mean of the three independent samples; 22.2–34.5% on Clinical Study and 30.4–42.7% on Bioinformatics) in all ten framework–track pairs, but falls below the independent Pass@3 in eight; only Biomni (56.4% versus 55.7%) and DSWizard (53.0% versus 43.6%) on Bioinformatics do better with sequential feedback. The two protocols also differ in temperature (0.0 for Feedback@3, 1.0 for independent samples), so the comparison is descriptive (source data: feedback3_vs_independent.csv). Claude Opus 4.8 results were obtained by regrading its archived code with the same evaluator, without new generation.
Case studies
Agents learn what the execution environment reveals. In BIO_0054, the prompt asks for per-gene interquartile ranges with genefilter::rowIQRs. Every direct LLM fails, GLM-5.2 in all three samples with ’rowIQRs’ is not an exported object from ’namespace:genefilter’. Inside mini-SWE-agent the same model reads the error, lists the package exports, locates the unexported function with getAnywhere, prints its source, learns that it expects an ExpressionSet, wraps the matrix accordingly and passes. In BIO_0047 the agent read the help page of rowpAUCs before writing any code and never hit the S4 slot errors (no slot of name “y.values”) that ended the direct attempts by the same model. The knowledge the direct model lacked was present in the installed package, and the error message pointed to it.
Silent errors become visible only against an independent check. CLIN_0011 asks for the MDRD estimated glomerular filtration rate from creatinine given in mg/dL, with the formula written in the prompt. By default, the admiral function compute_egfr assumes SI units and silently divides creatinine by 88.42. Kimi K3 prompted directly used the default in all three samples; the code ran, the summary table matched and only the clinical values were wrong. Inside mini-SWE-agent the same model printed the function body, noticed the unit conversion, recomputed the stated formula by hand and asserted that the two agreed before submitting. The agent caught the error because the prompt gave an independent check, the formula; without it, the default value would have looked as plausible as the correct one.
Related work
Code generation benchmarks. Large language models (LLMs) have motivated a growing number of benchmarks for evaluating code generation and programming capabilities. Typically, benchmarks such as HumanEval and MBPP assess whether models can synthesize executable programs from natural-language descriptions, primarily focusing on self-contained programming tasks. Subsequent benchmarks have expanded towards more realistic programming environments. DS-1000 evaluates data science code generation across a broad range of Python libraries, while BigCodeBench introduces more diverse function calls and complex instructions to measure practical code composition ability. However, these benchmarks mainly evaluate general-purpose programming capability and provide limited coverage of domain-specific scientific software ecosystems. In scientific computing, correctness often depends not only on generating syntactically valid code, but also on satisfying package-specific interfaces, structured data requirements and domain-defined output conventions.
Scientific and data science coding benchmarks. Recent work has extended code-generation evaluation towards scientific and engineering workflows, where agents must interact with datasets, execute experiments and produce verifiable computational results. MLAgentBench evaluates language agents on machine learning experimentation tasks, requiring systems to inspect data, write code and iteratively improve experiments. MLE-bench further evaluates machine learning engineering agents through real Kaggle competitions and human-validated leaderboard performance. ScienceAgentBench introduces a benchmark for data-driven scientific discovery, combining executable workflows with expert evaluation. These studies establish execution-based evaluation as a more realistic paradigm than text-level code similarity. Nevertheless, existing scientific coding benchmarks largely focus on Python-based machine learning workflows or general scientific tasks. They rarely capture the specialized computational contracts present in biomedical R ecosystems, where correctness depends on domain-specific packages, object systems and standardized analytical outputs.
Biomedical agents and benchmarks. Biomedical research has recently become an important application domain for LLM-based agents. Several systems have demonstrated the ability of AI agents to retrieve biomedical information, invoke scientific tools and assist with research workflows. Coscientist demonstrated autonomous chemical research through integration of language models with laboratory tools, while ChemCrow and CheMatAgent augmented LLMs with chemistry-specific tool environments. In computational biology, Biomni introduced a general-purpose biomedical AI agent framework that connects language models with hundreds of biomedical tools covering databases, genomics, molecular biology and cheminformatics. Meanwhile, emerging biomedical benchmarks including BioCoder, LAB-Bench, BiomniBench, GeneBench, BixBench, BioMysteryBench and BioXArena evaluate various aspects of biomedical reasoning, tool use and executable research workflows. Despite these advances, systematic evaluation of biomedical R programming remains limited. Existing biomedical coding benchmarks primarily focus on Python-based bioinformatics pipelines or broad biomedical reasoning tasks, while many real-world biomedical workflows rely on R ecosystems such as Bioconductor and Pharmaverse. These ecosystems introduce unique challenges, including S4 object structures, package-specific APIs, statistical workflow conventions and CDISC-style output schemas. RBioBench addresses this gap by providing an execution-based benchmark specifically designed for biomedical R code generation.
Scientific workflow reliability and long-horizon reasoning. Scientific workflows are inherently multi-stage processes that require maintaining consistency across sequential analyses, intermediate representations and domain-specific objectives. Unlike isolated code generation tasks, successful scientific automation requires agents to plan appropriate procedures, preserve contextual constraints throughout execution and verify intermediate results before producing final results. Recent advances in agent architectures have emphasized interleaving reasoning traces with external actions, enabling models to interact dynamically with environments during problem solving, while Reflexion shows that verbal self-evaluation and feedback-driven refinement can improve performance on challenging tasks. Execution-based scientific and machine-learning benchmarks have adopted such multi-step agent loops. Improving reliability on complex tasks has also motivated research on inference-time reasoning and adaptive computation. Scaling test-time compute has been shown to improve reasoning performance by allocating additional computation during inference, while recent studies on agentic systems suggest that effective scaling requires not only generating longer agent runs but also improving agent run selection, reflection and verification mechanisms. These developments indicate that future scientific AI systems will require integrated capabilities for planning, execution and self-verification to reliably perform extended computational workflows.


