← Latest papers
🤖 AI

Agentic Framework for Deep Learning workload migration via In-Context Learning

This paper proposes an autonomous agentic framework that leverages In-Context Learning and an execution oracle derived from actual PyTorch outputs to enable highly reliable, automated migration of deep learning models from PyTorch to JAX, achieving 91% numerical equivalence through iterative self-debugging.

Original authors: Qiyue Liang, Steven Ingram, George Vanica, Andi Gavrilescu, Newfel Harrat, Hassan Sipra, Sethuraman Sankaran

Published 2026-06-16
📖 5 min read🧠 Deep dive

Original authors: Qiyue Liang, Steven Ingram, George Vanica, Andi Gavrilescu, Newfel Harrat, Hassan Sipra, Sethuraman Sankaran

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are trying to move a family from a house built with wood and nails (PyTorch) into a house built entirely of glass and steel (JAX). Both houses have the same number of rooms and serve the same purpose, but the rules for how they are built are completely different.

In the "wood" house, you can hammer a nail in, change it later, and the structure is flexible. In the "glass" house, everything must be pre-planned, rigid, and immutable. If you try to build the glass house using the same hammering techniques you used for the wood, the whole thing will shatter.

This paper describes a new AI construction crew (an "Agentic Framework") designed to automate this move. Here is how they solved the problem, using simple analogies:

The Problem: The AI Architect Gets Confused

Usually, when you ask a smart AI (a Large Language Model) to translate code from PyTorch to JAX, it acts like an architect who has never seen a glass house. It tries to guess the blueprints.

  • It might get the math wrong because it can't "do" the complex calculations in its head.
  • It might forget that the glass house needs different rules for how rooms connect.
  • The result? A building that looks okay on paper but collapses when you try to live in it.

The Solution: A Three-Part Safety Net

The authors built a system that stops the AI from guessing and forces it to follow a strict, verified process. They call this a "grounded generation" system.

1. The "Style Guide" (In-Context Learning)

Instead of letting the AI guess how to write the glass house code, the team gave it a strict style guide.

  • The Analogy: Imagine giving the AI a photo album of the best glass houses ever built, showing exactly how the windows and doors should be placed.
  • What it does: This "In-Context Learning" (ICL) acts as an anchor. It shows the AI, "This is how we write code in JAX." It prevents the AI from hallucinating (making things up) and keeps it on the right track.

2. The "Truth Machine" (The Oracle)

This is the most important part. The AI is bad at doing complex math in its head. So, the team didn't ask the AI to calculate the numbers. Instead, they let the original PyTorch code do the math first.

  • The Analogy: Before the AI tries to build the glass house, they run the wood house through a simulator and take a "snapshot" of exactly how every room behaves, how heavy the furniture is, and how the light hits the walls. They save this snapshot as an Oracle (a source of absolute truth).
  • What it does: The AI doesn't guess the numbers. It has to build a glass house that matches this snapshot exactly. If the glass house doesn't match the snapshot, it's wrong.

3. The "Self-Correcting Inspector" (Iterative Debugging)

The AI builds a draft of the glass house. Then, a robot inspector checks it against the "Truth Machine" snapshot.

  • The Analogy: If the inspector finds a window that is the wrong size or a door that doesn't open, they don't just say "Fail." They hand the blueprint back to the AI architect and say, "Look, the light hits this wall differently than in the photo. Fix it."
  • What it does: The AI tries again, reads the error, and fixes the code. It loops this process until the glass house matches the snapshot perfectly.

The Results: From "Maybe" to "Perfect"

The team tested this system on two types of tasks:

  1. Simple Math Operations (Level 1): Like moving a single brick.
  2. Complex Neural Modules (Level 2): Like building a whole wing of the house with complex wiring.

Without this system (The Baseline):

  • The AI got the math right only 9% of the time for complex modules. It was mostly guessing.

With just instructions (No Oracle):

  • The AI got better at following rules but still got the math wrong 73% of the time. It was building a house that looked right but didn't work.

With the Full System (The Paper's Method):

  • Simple tasks: 100% success.
  • Complex tasks: 91% success.

The system successfully migrated famous models like SAM (which helps computers "see" images), T5 (a text translator), and Code Whisper (a coding assistant) from PyTorch to JAX with high accuracy.

The Bottom Line

The paper proves that you can't just ask an AI to "translate" complex code and hope for the best. You have to give it:

  1. Examples of how to do it right (The Style Guide).
  2. Proof of what the result should look like (The Oracle).
  3. A chance to fix its mistakes based on that proof (The Inspector).

By combining these three, they created a reliable, automated way to move deep learning models between different frameworks without needing a human to check every single line of code.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →