An Evaluation Framework for LLM-Assisted SAS-to-R Translation Fidelity
The migration of statistical programming workflows from SAS to R in regulated clinical research environments has accelerated, and large language models are increasingly positioned as intermediaries capable of automating this translation. Yet the field lacks a systematic, domain-specific framework for evaluating whether an LLM-produced R program is a faithful translation of its SAS source. Existing metrics drawn from natural language processing and general software engineering—BLEU, CodeBLEU, pass@k, and exact match—capture surface or compilation-level properties but do not address the dimensions of fidelity that matter in pharmaceutical statistics: numerical equivalence of derived datasets, preservation of CDISC implementation logic, auditability of the translation lineage, and resilience to hallucinated functions or silently changed defaults. This paper develops and demonstrates an evaluation framework for LLM-assisted SAS-to-R translation fidelity organised around six dimensions: syntactic translatability, semantic and functional equivalence, data-level numerical agreement, regulatory and audit fidelity, maintainability and idiomaticity, and safety and hallucination resilience. The framework is operationalised through a mixed-method protocol that combines automated program comparison, structured human adjudication, and documentation review. An illustrative application to a corpus of forty clinical programming tasks translated by two commercially available LLMs shows that no single metric predicts overall fidelity and that syntactic similarity is weakly associated with data-level agreement. The paper argues that fidelity in this domain is irreducibly multidimensional and that evaluation must be designed as a compounding, reviewable process rather than a single benchmark score. Implications for programmer training, validation workflow design, and regulatory documentation are discussed.
Authors
- McKenzie Izev (ORCID: https://orcid.org/0009-0006-8450-4944)
Institutions
- AIT Austrian Institute of Technology GmbH (AT)
Publication Details
- Journal
- Research Square
- Published
- 2026-12-02
- DOI
- https://doi.org/10.21203/rs.3.rs-11957865/v1
- Primary Topic
- Software Engineering Research
- Type
- preprint