Code Translation using Large Language Models: What’s the role of the Research Software Engineer?
Stephen Thompson, Asif Tamuri
UCL Centre for Advanced Research Computing and UCL Innovative Clinical Trials Unit
2026-09-09
Today’s Talk
- Brief Introduction (UCL ICTU, UCL ARC)
- Code Translation Motivation
- Code Translation Mechanics
- Workshop Results
About Stata
- Closed source commercial statistics software.
- Supports community contribution with a package library and publication through the Stata journal.
- Stata journal encourages good software practice - tests, documentation.
Motivation: Example artbin.
![A screenshot of the artbin publication in the Stata Journal titled artbin: Extended sample size for randomized trials with binary outcomes.]()
Motivation: Example artbin.
- High quality software (including documentation and tests)
- Demonstrated impact - used and cited in published trials.
- Open source (GPL3) - free to download/modify
- need Stata License to run.
- Stata community is tiny compared to R or Python.
- Can we increase impact by translation.
Stata2R: Practicalities
- Pre-requisites:
- Well written/documented/tested Stata code 👍
- Language Expertise (Stata and R)
- Domain Expertise (Statistics)
- Time (funding)
- Lets leverage advances in agent based code translation?
Agentic Coding (Claude Code)
- Users communicate in plain text (for example “translate artbin to R”)
- Non deterministic (stochastic sampling from many possible answers).
- Will usually do what you ask, which may not be a good thing.
- We developed the Stata2R plugin with 4 skills to limit the impact of non deterministic behaviour and unquestioning behaviour.
- We delivered a 4 hour workshop to use the plugin.
What’s in a Plugin / Skill
Skills are defined in markdown.
Plugins are collections of skills that are easy to install
/plugins marketplace add https://github.com/stata-translations/Stata2R.git
/plugin install stata-translation
/reload-plugins
/stata-translation:hello
/stata-translation:translation-strategy
/stata-translation:stata-to-pseudocode
/stata-translation:pseudocode-to-r
/stata-translation:add-missing-tests
Plugin Skill 1: Translation Strategy
- Summarise the purpose of the library.
- Is it worth translating? (existing R libraries, users etc)
- Is the documentation and testing sufficient to enable a good translation.
Plugin Skill 2: Stata to Pseudocode
- Evidence that two stage translation creates better code.
- Enables a human review step.
- Use any documentation files (.sthlp) to inform the translation.
- Ignore all files in the testing directory.
Plugin Skill 3: Pseudocode to R
- Use the pseudocode to create an R package.
- Create automated tests.
- Port Stata documentation and examples to R (create vignettes)
- Port any dialogues (graphical user interfaces) to R.
- Copy over licence file and create README, CONTRIBUTING, files etc.
Plugin Skill 4: Add Missing Stata Tests to R
- Port the Stata tests to R and confirm they pass.
- Document Stata to R test correspondence and verify results.
Developed a training program.
We developed and delivered a Workshop to
10 statisticians aiming to:
- Teach statisticians to use Claude to translate code.
- Use statisticians to review the quality of resulting translations.
Pre-Workshop: Stata and R Fluency
Post-Workshop: Skills assessment (Target language quality).
Post-Workshop: Skills assessment Example (Time Taken).
Post-Workshop: Concerns Work Cloud
Post-Workshop: Ideas for Improvements / Future Work.
Further Considerations
- Ongoing development (do you plan on maintaining both versions?)
- Are you complying with the original license?
- Who owns the copyright?
- Preventing access to sensitive data.
Summary
- Claude can translate code.
- Results are non deterministic.
- The plugin provides some structure, but human intervention is still required to keep Claude on track.