Translating deep learning models from PyTorch's flexible, object-oriented design to JAX's functional, stateless setup is usually a manual and error-prone task. Automated migration is challenging because Large Language Models (LLMs) struggle with strict and dynamic API alignment and are prone to mistakes for exacting operations. We propose a fully autonomous system that combines In-Context Learning (ICL) with oracle-driven self-debugging. First, we curated an ICL context that serves as a strict reference for idiomatic JAX styling and test case generation. Second, instead of depending on the LLM to deduce mathematical outputs, we run the source PyTorch modules to get their actual dynamic tensor states. This creates an unchangeable execution oracle. We then use an autonomous agentic loop to synthesize tests based on the oracle data. The test cases are executed repeatedly, and the traceback is sent back to the LLM for self-correction. Ablations show that combining ICL references with oracle grounding and self-debugging greatly outperforms pure instructional and basic agentic baselines. This improvement does not add an excessive computational overhead. Our lightweight pipeline achieves 91% numerical equivalence (compared to baseline: 9%, instruction + self-debugging: 27%) on neural modules, providing a highly reliable, scalable blueprint for cross-framework migration. This has been validated across several state-of-the-art models including SAM (segment anything), T5, Code Whisper amongst others showing high numerical equivalency. Code: https://github.com/AI-Hypercomputer/accelerator-agents/tree/main/MaxCode


翻译:将深度学习模型从PyTorch灵活的面向对象设计迁移至JAX的函数式、无状态架构通常是一项需要手动完成且易出错的任务。自动化迁移极具挑战性,因为大型语言模型(LLM)难以实现严格且动态的API对齐,且在精确操作中容易出错。我们提出了一种完全自主的系统,该系统将上下文学习(ICL)与预言驱动的自调试相结合。首先,我们整理了一个作为惯用JAX样式和测试用例生成严格参考的ICL上下文。其次,我们不依赖LLM推导数学输出,而是运行源代码PyTorch模块获取其实际动态张量状态,从而创建不可变的执行预言。接着,我们使用自主智能体循环基于预言数据合成测试。测试用例被重复执行,并将回溯信息反馈至LLM进行自我修正。消融实验表明,将ICL参考与预言约束及自调试相结合,其性能远超纯指令型和基础智能体基线方法。这种改进不会带来额外的计算开销。我们的轻量级流水线在神经模块上实现了91%的数值等价性(对比基线:9%,指令+自调试:27%),为跨框架迁移提供了高度可靠且可扩展的蓝图。该方案已在多个最先进模型(包括SAM(分割一切)、T5、Code Whisper等)上经过验证,展现出高度的数值等价性。代码地址:https://github.com/AI-Hypercomputer/accelerator-agents/tree/main/MaxCode

0
下载
关闭预览

相关内容

AgentOps综述:智能体系统运维框架
专知会员服务
18+阅读 · 6月4日
迁移自适应学习最新综述,附21页论文下载
【迁移学习】简述迁移学习在深度学习中的应用
产业智能官
15+阅读 · 2018年1月9日
迁移学习在深度学习中的应用
专知
24+阅读 · 2017年12月24日
国家自然科学基金
338+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
31+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
6+阅读 · 2014年12月31日
国家自然科学基金
12+阅读 · 2014年12月31日
国家自然科学基金
12+阅读 · 2013年12月31日
国家自然科学基金
17+阅读 · 2008年12月31日
Arxiv
0+阅读 · 5月18日
VIP会员
最新内容
学习数据的几何:形状空间分析数学综述
专知会员服务
6+阅读 · 6月17日
定向能反无人机系统最新发展动态
专知会员服务
7+阅读 · 6月17日
从燃煤战舰到算法战争:水面指挥的永恒要求
专知会员服务
4+阅读 · 6月17日
相关VIP内容
AgentOps综述:智能体系统运维框架
专知会员服务
18+阅读 · 6月4日
相关基金
国家自然科学基金
338+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
31+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
6+阅读 · 2014年12月31日
国家自然科学基金
12+阅读 · 2014年12月31日
国家自然科学基金
12+阅读 · 2013年12月31日
国家自然科学基金
17+阅读 · 2008年12月31日
Top
微信扫码咨询专知VIP会员