Natural-Language Decision Schemas Let LLMs Generate and Extend Reproducible Analysis Scripts
Summary:The research inserts a natural-language decision schema between an analysis manuscript and its executable code. By making data-cleaning choices, model specifications, and their rationales explicit, the workflow can use LLMs to generate and validate scripts, while a separate alternatives file describes competing versions of the analysis. The authors demonstrate the approach on a published regression involving heaped smoking data, reproducing the reported estimates and translating a reviewer-prop
The work represents a data analysis as a sequence of natural-language decisions with explicit rationales, then uses that representation as an intermediate layer through which LLMs generate and validate analysis scripts. An additional alternatives file can expand one analysis into a collection of comparable variants. The target is not simply whether the same code can be rerun, but whether the decisions that actually alter a result can be identified and modified.
Core mechanism: a semantic layer between manuscripts and code
The paper argues that code mixes analytical choices with implementation details, while manuscripts record major choices and their rationale in a fragmented form and often omit minor decisions that may still affect the outcome. Publishing code therefore provides only partial reproducibility: readers can inspect how a program executes without easily determining why data were cleaned in a particular way, which observations were removed, or which model specification was selected.
According to the abstract, the schema is a collection of analysis decisions expressed in natural language. The workflow can be represented conceptually as follows:
D = {d₁, d₂, ..., dₙ}denotes decisions ranging from data acquisition and cleaning to variable construction and model specification. Each decision records not only the selected path but also its rationale and constraints.S(D) = LLM(D, data_contract, environment)represents script generation from those decisions, followed by execution tests or output validation.- When an alternatives file changes one decision, the system derives
D' = Alternative(D), generatesS(D'), and compares the original and counterfactual analyses rather than rewriting every script by hand.
This resembles an intermediate representation in a compiler: natural-language schema at the semantic layer, executable code at the implementation layer. The benefit is broader than helping an LLM write code. Decisions can be reviewed, versioned, and compared independently. A reviewer can alter whether a cleaning rule is applied or which model specification is used, and the workflow can regenerate the corresponding analysis without requiring the reviewer to search manually for hidden analytical logic in the original code.
The paper covers two operating modes. When a schema exists, it is used to reproduce the original estimates and implement alternative specifications automatically. When no schema is available, the same workflow instead functions as a reproducibility check. The latter is closer to auditing: the system must determine whether an existing result can be reconstructed and whether it remains stable under changes to consequential decisions.
Why open code alone remains insufficient
Matching results does not necessarily mean matching analysis processes. Two different paths can produce similar estimates because errors cancel, while the same script can change behavior after dependency updates, altered random seeds, or external data changes. A schema therefore does not replace environment locking, containerization, or data versioning. It addresses the upstream problem of semantic traceability.
From an engineering perspective, the schema can provide three forms of evidence that code alone does not reliably preserve:
- Decision provenance: It records why a step exists, why a particular option was selected, and when it should not be used.
- Change boundaries: The alternatives file identifies which analytical choices differ, reducing unnecessary rewrites.
- Audit units: Teams can review, approve, and compare proposals by decision ID rather than reading every generated line of code.
The abstract does not disclose a formal schema grammar, field definitions, or whether the planner and validator are independent models. It also does not explain how natural-language constraints are compiled into typed parameters. The intermediate representation described above is therefore an engineering abstraction based on the paper's public description, not a claim that the authors implemented a particular JSON or DSL format.
Engineering trade-offs: auditability does not guarantee reliability
Natural language lowers the barrier to expression but introduces ambiguity. A phrase such as excluding missing values could mean dropping rows, dropping columns, or applying a specific imputation rule. The more a schema relies on unconstrained prose, the more assumptions the LLM must supply. Production systems should convert consequential decisions into typed constraints, including missingness thresholds, sample-filtering order, random seeds, and expected output ranges.
A generator and validator can share blind spots. If the same model generates the script and judges whether it faithfully implements the schema, both components may misunderstand the original decision. A more reliable design separates deterministic checks from independent model review. Deterministic validation can inspect schemas, column names, dependencies, statistical invariants, and output structure; a separate review stage should assess whether code semantics match the natural-language rationale.
The counterfactual space can explode combinatorially. If an analysis contains k independently switchable binary decisions, exhaustive enumeration produces 2ᵏ variants. A multiverse of analyses should therefore be treated as a potential space rather than a requirement to run every point. Practical systems should prioritize high-impact decisions and use pairwise comparisons, sensitivity grids, or sequential search to control cost.
Every derived variant adds inference and execution cost. The schema narrows the portion of code that must be rewritten, but LLM calls, dependency installation, data loading, and statistical execution still repeat. Evaluation should record token consumption, generation latency, runtime, failure rate, and human-review time, rather than merely counting the number of generated variants.
Reproducibility still depends on the execution environment. Even with fixed LLM output, changes in Python packages, BLAS implementations, random seeds, or data snapshots can alter results. Production pipelines should pin the model version, prompt template, schema version, data hash, dependency lockfile, and container image, while retaining generated scripts and their hashes.
Generated code introduces an execution risk. An analysis script may read files, issue network requests, or execute arbitrary commands, so it should not enter a high-privilege production environment directly. Execution should occur in a container with no network access, read-only data mounts, least-privilege permissions, and resource quotas, preceded by static checks, unit tests, and human approval.
Current evidence: two cases support the concept but do not quantify reliability
The first application is a published regression analysis involving heaped smoking data. The authors constructed a schema that reproduced the reported estimates and then expressed a reviewer-proposed alternative in the alternatives file before automatically generating the corresponding code. This demonstrates two connected capabilities: preserving the semantics of the original analysis and translating a natural-language counterfactual change into an executable experiment.
However, reproducing the reported estimates without absolute errors, tolerance intervals, or component-level statistical comparisons does not prove that the generated script is implementation-equivalent to the original. Similar estimates can conceal differences in variable handling, sample ordering, or model details. This is best interpreted as a concept validation rather than a comprehensive end-to-end reproducibility benchmark.
The second application is the many-analysts football study. Because no schema was available, the workflow served as a reproducibility check. This shows that the same framework can support both analysis extension and analysis auditing. The abstract does not explain how missing decisions were recovered, which estimates were checked, or whether the system measured decision coverage, false positives, or agreement with human auditors.
Several critical details are also absent: the LLMs and versions used, prompts and sampling settings, schema coverage, generation and validation success rates, rerun consistency, absolute errors, variance across repeated runs, token cost, execution time, baseline configurations, and code-release status. In particular, the abstract provides no controlled comparison among direct manuscript-to-code generation, code-only reproduction, expert-written alternatives, and a no-schema workflow. It is consequently impossible to determine whether the gain comes from the schema itself or from additional inference budget and human intervention.
A stronger evaluation should hold the model and token budget constant, repeat every case, and separately measure decision-extraction accuracy, script executability, original-estimate reproduction error, counterfactual consistency, manual edits, and end-to-end cost. Schema completeness needs its own evaluation: omitting one decision that changes sample selection or model specification can be more consequential than a wording error.
Deployment guidance for developers
- Start with high-impact decisions. Cover sample filtering, missing-value handling, variable construction, model specification, and exclusion rules before attempting to document every implementation detail.
- Separate the main schema from the alternatives file. Keep the current analysis in the main file and list changed decisions and rationales in the alternatives file so reviews remain focused.
- Add typed contracts. Machine-checkable constraints for data columns, parameter ranges, random seeds, expected outputs, and prohibited operations reduce the ambiguity of natural-language instructions.
- Separate generation from validation. Execute scripts in isolated containers, verify outputs with deterministic tests, and use an independent review stage to check fidelity to the decisions and rationales.
- Treat counterfactual analyses as CI artifacts. Preserve data hashes, schema and model versions, generated scripts, environment locks, and output differences for every variant.
- Keep human approval in the loop. Reviewer suggestions, data exclusions, and model changes should first become structured decisions and receive domain-expert approval rather than directly modifying a production analysis.
The central contribution is not a demonstration that LLMs can already perform statistical research autonomously. It is an auditable and extensible intermediate representation that separates the question of what an analysis should do from the mechanics of executing it. A separate alternatives file then supports systematic sensitivity analysis over consequential decisions. The idea has substantial engineering potential, but the current evidence remains a preprint-level feasibility demonstration.
— END —Source: ArXiv Machine Learning (cs.LG) (2026-11-26)
Tags: #LLM Code Generation #Reproducible Analysis #Natural-Language Schema #Analysis Decision Chain #AI for Science
Editorial & Fact-Checking Note: This article is compiled from primary research, official release documentation, and source papers by the ZICQ Newsroom pipeline with automated entity verification and human editorial review. If you notice any technical inaccuracy, please submit a correction via our corrections policy or email our editorial desk directly.
Community Comments