Research software is often slow, hard to install, or both. A Python script that needs the right packages, a pipeline that only runs inside Docker, a tool that will not run on Windows. Agents can now translate such code into Rust, a fast, compiled, memory-safe language, and give you one file that simply runs. But only if you prove that the translation gives the same answers.
Why Rust: speed, one self-contained program, no Conda or Docker, and possibly fewer security holes.
How: reference outputs first, static analysis to guide the agent, one function in and one function out, bottom-up.
Proof: identical outputs on many inputs, then an honest benchmark.
Judgement: when translating is not worth it, and what the licence of the original allows.
A workflow unit that builds directly on Reading other people’s code. It draws on a 2026 study by the author of this course.
The QC script works, but half the class cannot run it
The same script also takes hours on a full sequencing run.
Containers and Conda solve installation by shipping a whole computer
Rust is a compiled language: you build once, then run one file
One binary per system makes teaching and sharing simpler
Student laptops: download one file and run it. No Python, Conda or Docker, no admin rights.
Windows: a native .exe, not a Linux tool inside WSL or a container.
Apple and Linux: one binary each; Cargo can build for other systems and processors (cross-compiling).
HPC clusters: copy the binary into your home folder. No container runtime, no modules.
Archiving: the binary and its source, with exact library versions in Cargo.lock, rebuild the same program years later.
Cargo lets two versions of a library live side by side
In Python or R, one environment holds one version of each package. Two tools that need different versions conflict, so you make separate environments.
Cargo builds each program with exactly the versions it asks for, and can include two versions of the same library in one program.
The paper’s claim: after translating Bascet’s upstream tools, “version management is now solely managed by the Rust package manager Cargo”, removing the need for Conda.
Compiled languages use far less time and energy on the same task
A later analysis (van Kempen et al. 2025): power draw is similar across languages, so energy mostly follows run time.
The paper’s case: legacy code costs money, energy and hardware
Maintenance (technical debt): tools without maintainers, outdated libraries, hard to combine R and Python.
Energy: R, Python and MATLAB can use “>50x more energy than compiler or semi-compiled languages for certain workloads”.
Hardware: computers are becoming scarce, and new hardware needs software rewritten anyway.
Safety: legacy code “may also have security or safety problems that make it unsuited for use in clinical settings”.
People: a bioinformatician is expected to know R, Python, JavaScript and C or C++. One language for the “full stack” would help.
Rust rules out a class of memory bugs, not wrong science
Fewer dependencies is also a security gain, until updates are automated
A container image carries an operating system and hundreds of packages, each a possible way in.
The paper’s group counted roughly 2,000 to 3,500 transitive packages behind the 61 microbial tools they surveyed (a qualitative estimate made with Codex).
A Rust binary contains only the crates it was built with, listed with versions in Cargo.lock; cargo audit checks them against known vulnerabilities.
But: auto-updating many translations with agents would invite supply-chain attacks, as seen in the JavaScript ecosystem. The paper suggests “a more conservative approach to updating”.
A 2026 study translated about 35 research tools with agents
Henriksson J.Static analysis-guided agentic AI translation enables Rust as a full stack bioinformatics language. arXiv:2608.13029 (2026), CC BY 4.0.
About 40 attempts, 35 packages in sequencing (NGS), imaging and file-format libraries, “tested, benchmarked, and ready for use by early adopters”. Translation bugs are still expected.
11 weeks, Claude Code and Codex on three subscriptions, using up to about 90 % of their limits.
From days to weeks per tool: jpegxr (31,000 lines of C++) in under 20 hours; BWA-MEM2 took weeks.
Code, prompts and tools: one GitHub repository per tool; updates at github.com/henriksson-lab/rustification.
Naive prompts gave code that compiled, ran, and was wrong
The paper lists errors that agents made again and again:
swapped expressions (a<b became b>a) or reordered branches
wrong number types, causing overflows
changed order of operations, so decimals came out different
clever algorithms replaced with naive ones
the wrong one of several similar functions called
new “helper” functions that bent the design out of shape
speed tricks (SIMD) left out
Asking more firmly did not fix it: such prompts were “ineffective for Claude, and mostly insufficient for Codex”.
Rule one: one original function becomes one Rust function
Same files and folders as the original; stubs for every function are written first.
Static analysis gives the agent a map: translate from the bottom up
Three tools check the translation function by function
CCC (code complexity comparator): compares call graphs and, per function, the types, numbers, strings, branches and logic. A function with fewer * or fewer branches than its original has probably lost something.
tracehash: records a fingerprint of every function’s inputs and outputs in both programs and finds the first call that differs.
gdbtv: runs original and translation side by side in two debuggers and stops where they part ways. Neither agent reached for it on its own.
All three were “vibe coded” with Claude, and the agents learn to use them from instructions in their repositories.
A fingerprint of every function call shows where the translation goes wrong
The paper’s workflow: correctness first, speed later
Equivalence is tested on outputs, on real data, many times over
Compare the translation’s output with the original’s on many varied real datasets. The paper: tests written by the agents themselves were “largely insufficient”.
Audit file by file: every file listed in TOAUDIT.md must pass two consecutive audits without complaints.
Even then: systematic audits “did not remove all errors, as revealed by testing on real data”.
Bonus: the translation found at least 3 bugs in the originals (an outdated broken dependency, a use-after-free, an unhandled corner case).
Decimal numbers depend on the order of operations
The paper: agents “frequently did not respect order of operations”; translating HMMER was hard for this reason.
Most translations matched or beat the original’s speed
Memory use went down for most tools, and up for some
Bascet: one binary instead of a container, and native Windows
The paper: “the only single-cell pipeline able to run on native Windows, without a container”.
The big speed-up comes from using tools as libraries, not commands
Not everything could be translated
BLAST failed twice. Code that generates code (build-time generation, C++ templates, heavy preprocessor use) breaks the one-function-in, one-function-out idea.
C translates to unsafe Rust first: pointers and manual memory management, so no safety guarantees until a separate clean-up pass.
Memory sometimes went up, and reducing it would cost faithfulness or safety.
Speed tricks that reorder arithmetic (SIMD) could not be used without changing results.
Graphical interfaces were translated loosely, from screenshots, not faithfully.
The paper’s own caveats
Benchmarks are “best-effort estimates”, chosen by the agents with some steering, and differ per tool.
The prompts may work less well for others: the agents “picked up implicit assumptions based on our workspaces”. “Further independent testing is needed.”
Translations are for early adopters; new bugs are introduced as well as old ones fixed.
Agent-written tests were largely insufficient; real data had to do the work.
It is a single-author preprint, with models that changed during the study. It is not a comparison of models.
In the author’s experience, Codex translated more conservatively
Codex (GPT-5.4 and 5.5) for the first translation: “more conservative” in translating functions verbatim and in following instructions.
Claude (Opus 4.7) for difficult bugs that Codex could not find, for optimisation ideas, and for all graphical interfaces.
For benchmarks Codex was used, because Claude “frequently generated biased benchmarks”.
Claude starts parallel subagents on its own when the work suits it; Codex needed explicit prompting.
One person’s experience with one generation of models. Test on your own task (Choosing a model).
A benchmark is only fair if both programs do the same work
The workflow with your agent extends the recipe from the last unit
Golden files and property tests catch what a single example misses
Translate when it pays off, and when you can prove it is the same
A translation is a derived work: respect the licence and give credit
Licence: keep the original’s licence file and terms. No licence means all rights reserved: ask first.
Credit: cite the original authors and paper in the README, with the exact version (git hash) translated.
Say what it is: a different name (the paper adds -rs), a clear note that it is an AI-assisted translation, version 0.x.
Courtesy: tell the original authors; send bug reports about the translation to your repository, not to theirs.
Reproducibility: faithful means keeping the original’s logic bugs, so results stay comparable across studies.
A faithful translation can follow its original’s updates
The paper updated two translations (openslide, minibwa) to newer upstream versions in under an hour each, because one-to-one translation keeps every change in a known place.
“Every line of code is a liability”: maintaining a translation adds less than writing a competing new tool.
Translation also clarifies provenance: every Rust function points back to an original one, unlike code an agent writes from scratch out of unknown sources.
In our test run of the exercise, the port was identical and about 19 times faster
What the agent does and does not do here
It does well
writes Rust you could not write yourself
installs Rust and builds release binaries
writes comparison scripts and generates test inputs
finds and fixes differences, if pointed at them
runs benchmarks, when told what fair means
It does not
stay faithful without constant reminders
choose real, varied test data on its own
benchmark fairly without being asked
know whether the licence allows the port
decide whether the port is worth maintaining
Summary
Concept
Key fact
Rust
compiled, about as fast as C, memory-safe in ordinary code; Cargo builds and manages libraries
One binary
no Python, Conda or Docker on the machine that runs it; native Windows, macOS, Linux, clusters
Security
removes memory bugs, not logic bugs; unsafe code and dependencies still matter
Energy
roughly follows run time; interpreted code can need tens of times more
Faithful translation
one function in, one function out, no helpers, stubs first, bottom-up from the call graph
Summary (continued)
Concept
Key fact
Equivalence
identical outputs, error messages and exit codes on real data, edge cases and generated inputs
Benchmark
outputs identical first; same machine, input and threads; warm-up, several runs, median; time and memory
The paper
~35 tools; Bascet ~80x smaller, ~10x faster build, >3x faster key steps, native Windows; read as the paper’s claims
When not to
one-off scripts, code you cannot test, fast-moving upstream, licence that does not allow it
Credit
a translation is a derived work: keep the licence, cite the authors, name it clearly
Next (Using agents to train AI: curated and simulated data): how agents audit labelled data and write simulators that make training data with exact labels, and why a small real test set decides whether any of it works.