AI
New Benchmark Tests AI Coding Agents on Framework Migration Tasks
Researchers introduce T2J-BENCH to evaluate how well AI agents can migrate machine learning code from PyTorch to JAX, with execution-grounded verification that goes beyond standard code similarity metrics.
Converting a machine learning codebase from one framework to another—such as moving from PyTorch to JAX—is a common yet resource-intensive task in software engineering. The shift between these frameworks demands more than simple syntax updates; it requires fundamentally restructuring code from object-oriented, stateful modules into pure, functional programs that can be compiled efficiently. Researchers have now created a new benchmark to assess whether AI coding agents can handle such complex, whole-repository migrations.
The Benchmark and the Problem#
Existing code benchmarks typically measure success by counting passing unit tests or comparing surface-level similarity between generated code and reference implementations. These approaches fall short when evaluating framework migrations because they cannot ensure the migrated system actually behaves the same as the original. More critically, they allow a JAX reimplementation to pass tests by secretly importing PyTorch itself, defeating the purpose of a true framework shift.
To address these shortcomings, researchers introduced T2J-BENCH, a benchmark containing 63 complete PyTorch-to-JAX migration tasks across 18 different model families. The benchmark covers both model training and inference scenarios, and requires migration teams to handle torch-free checkpoint conversion as part of the work.
How the Grading Works#
T2J-BENCH uses execution-grounded functional equivalence scoring, which runs each candidate solution inside an isolated, PyTorch-free environment. This offline verifier compares the migrated code's behavior against frozen reference outputs from the original PyTorch implementation. The scoring uses a hard independence gate—confirming no PyTorch imports—and a continuous, threshold-free reward system rather than binary pass/fail metrics.
Current Performance and Solutions#
Testing showed that even the strongest AI agent-model combinations recovered only 67.6% of possible reward points against an oracle baseline of 98.0%, despite achieving high rates on specification tests. Many solutions exhibited numeric drift and unexpected behavioral differences from the originals.
To boost performance, the researchers developed TWINHARNESS, a harness that leverages the agent's own executable PyTorch source as self-verification feedback. When applied to an Opus-5 agent, TWINHARNESS raised the reward score from 64.9% to 72.3%—the highest among all tested configurations—using only resources visible to the task itself.

