depyf: 機械学習研究者のためのPyTorchコンパイラの不透明な箱を開く
PyTorch 2.xのコンパイラは深層学習プログラムを高速化するが、Pythonバイトコードレベルで動作するため不透明で、研究者には活用が難しい。depyfはこの課題を解決するツールである。
キーポイント
PyTorch 2.xコンパイラの内部動作を可視化するツール「depyf」を発表
バイトコードをソースコードに逆コンパイルし、デバッガで行単位のステップ実行を可能にする
非侵入的でユーザーフレンドリーな設計で、2つのコンテキストマネージャが主要機能
Apple、UCバークレー、清華大学の研究者らが共同開発
機械学習研究者がPyTorchコンパイラを最大限活用する障壁を低減
影響分析・編集コメントを表示
影響分析
depyfはPyTorchコンパイラの「ブラックボックス化」を解消し、研究者が内部処理を理解・デバッグできるようにすることで、AIモデル開発の効率化と最適化を促進する。この透明性向上は、特に学術研究や新規アルゴリズム開発において重要な進展となる。
編集コメント
PyTorchの普及を背景に、コンパイラの内部を「開ける」ツールが登場した点が画期的。研究者の生産性向上に直結する実用的な成果と言える。
depyf: PyTorchコンパイラの不透明な箱を開き、機械学習研究者のためのツールとして提供する
著者Kaichao You**†, Runsheng Bai†, Meng Cao, Jianmin Wang†, Ion Stoica‡, Mingsheng Long†
出版物を見る
ソースコードを見る (GitHub)
PyTorch \texttt{2.x}は、深層学習プログラムを高速化するために設計されたコンパイラを導入しました。しかし、機械学習研究者にとって、PyTorchコンパイラを最大限に活用することは困難な場合があります。このコンパイラはPythonバイトコードレベルで動作するため、不透明な箱のように見えます。この問題に対処するため、PyTorchコンパイラの内部動作を解明するように設計されたツール、\texttt{depyf}を紹介します。\texttt{depyf}は、PyTorchによって生成されたバイトコードを同等のソースコードに逆コンパイルし、メモリ内のコードオブジェクトとディスク上の対応するソースコードとの間に関連付けを確立します。この機能により、ユーザーはデバッガを使用してソースコードを1行ずつステップ実行できるようになり、基礎となるプロセスに対する理解を深めることができます。特筆すべきは、\texttt{depyf}が非侵入的でユーザーフレンドリーであり、そのコア機能は主に2つの便利なコンテキストマネージャに依存している点です。
† 清華大学 BNRist ソフトウェア学院、中国北京
‡ カリフォルニア大学バークレー校 コンピュータサイエンス学部
** Apple在籍時の研究成果
関連する読み物と最新情報。
UICoder: 自動化されたフィードバックを通じて大規模言語モデルをファインチューニングし、ユーザーインターフェースコードを生成する
2025年8月15日研究分野 ヒューマンコンピュータインタラクション、研究分野 手法とアルゴリズム会議 NAACL
大規模言語モデル(LLM)は、コンパイル可能で視覚的に適切なデザインを生成するUIコードを一貫して生成するのに苦労しています。生成を改善するための既存のアプローチは、高価な人間のフィードバックや独自モデルの蒸留に依存しています。本論文では、自動化されたフィードバック(コンパイラとマルチモーダルモデル)を使用してLLMを導き、高品質なUIコードを生成させる方法を探ります。私たちの手法は、既存のLLMから始めて、反復的に改善された…
Apple Neural EngineへのTransformerのデプロイ
2022年6月6日研究分野 コンピュータビジョン、研究分野 音声・自然言語処理
Appleで私たちが構築する機械学習(ML)モデルのうち、Transformerアーキテクチャを部分的または完全に採用するモデルの数は年々増加しています。このアーキテクチャは、HyperDETRを用いたCameraのパノプティックセグメンテーション、Photosのオンデバイスシーン分析、アクセシビリティのための画像キャプション生成、機械翻訳など、多くの体験を実現するのに役立っています。今年のWWDC 2022において、AppleはTransformerアーキテクチャのオープンソースの参照PyTorch実装を公開し、世界中の開発者が最先端のTransformerモデルをAppleデバイスにシームレスにデプロイする方法を提供します。
機械学習における機会を発見する。
私たちの機械学習研究は、日々新たな領域を切り拓いています。

原文を表示
depyf: Open the Opaque Box of PyTorch Compiler for Machine Learning Researchers
AuthorsKaichao You**†, Runsheng Bai†, Meng Cao, Jianmin Wang†, Ion Stoica‡, Mingsheng Long†
View publication
View source code (GitHub)
PyTorch \texttt{2.x} introduces a compiler designed to accelerate deep learning programs. However, for machine learning researchers, adapting to the PyTorch compiler to full potential can be challenging. The compiler operates at the Python bytecode level, making it appear as an opaque box. To address this, we introduce \texttt{depyf}, a tool designed to demystify the inner workings of the PyTorch compiler. \texttt{depyf} decompiles bytecode generated by PyTorch back into equivalent source code, and establishes connections between in-memory code objects and their on-disk source code counterparts. This feature enables users to step through the source code line by line using debuggers, thus enhancing their understanding of the underlying processes. Notably, \texttt{depyf} is non-intrusive and user-friendly, primarily relying on two convenient context managers for its core functionality.
† School of Software, BNRist, Tsinghua University, Beijing, China
‡ Division of Computer Science, University of California, Berkeley
** Work done while at Apple
Related readings and updates.
UICoder: Finetuning Large Language Models to Generate User Interface Code through Automated Feedback
August 15, 2025research area Human-Computer Interaction, research area Methods and Algorithmsconference NAACL
Large language models (LLMs) struggle to consistently generate UI code that compiles and produces visually relevant designs. Existing approaches to improve generation rely on expensive human feedback or distilling a proprietary model. In this paper, we explore the use of automated feedback (compilers and multi-modal models) to guide LLMs to generate high-quality UI code. Our method starts with an existing LLM and iteratively produces improved…
Deploying Transformers on the Apple Neural Engine
June 6, 2022research area Computer Vision, research area Speech and Natural Language Processing
An increasing number of the machine learning (ML) models we build at Apple each year are either partly or fully adopting the Transformer architecture. This architecture helps enable experiences such as panoptic segmentation in Camera with HyperDETR, on-device scene analysis in Photos, image captioning for accessibility, machine translation, and many others. This year at WWDC 2022, Apple is making available an open-source reference PyTorch implementation of the Transformer architecture, giving developers worldwide a way to seamlessly deploy their state-of-the-art Transformer models on Apple devices.
Discover opportunities in Machine Learning.
Our research in machine learning breaks new ground every day.

関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み