mlsanityData to 7 Oct 2026

GraphMend: Code Transformations for Fixing Graph Breaks in PyTorch 2

arXiv 2509.16248 ↗First posted 17 Sep 2025cs.PL cs.LG cs.SEcited by 1

Not on the map. Why?

Abstract (arXiv)

This paper presents GraphMend, a compiler technique that automatically fixes FX graph breaks in PyTorch 2 programs. Although PyTorch 2 introduced TorchDynamo and TorchInductor to enable just-in-time graph compilation, certain code patterns still cause graph breaks that force execution to fall back to Python eager mode, introducing costly CPU-GPU synchronization and reducing optimization opportunities. Our investigation of 195 Hugging Face models reveals that 13.8% of models exhibit graph breaks. GraphMend automatically eliminates fixable breaks through source-level program analysis and transformations. It analyzes AST-level program structure to identify graph-break patterns and applies transformations only when their semantic preservation can be statically established. These transformations enable PyTorch to capture larger, uninterrupted FX graphs without manual refactoring by developers. We evaluate GraphMend on all 27 models found to exhibit graph breaks in our investigation. GraphMend eliminates 107 of 147 graph breaks (73%), fully fixing all breaks in 21 models. In our experiments on NVIDIA GPUs, GraphMend achieves up to 26x cold-start speedup, 5x on average, and up to 1.39x steady-state forward pass speedup. These results demonstrate that semantics-aware source-level analysis and transformation are effective complements to PyTorch's dynamic JIT compilation pipeline, substantially improving both usability and performance.

Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Builds on 26 of its 68 references that are in the map. First posted on arXiv 17 Sep 2025.

Builds on

26 of 68 references.

References · 26

  1. 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,160
  2. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
  3. 2019BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehensioncited by 5,874
  4. 2022Robust Speech Recognition via Large-Scale Weak Supervisioncited by 3,972
  5. 2020Longformer: The Long-Document Transformercited by 3,362
  6. 2023Grounding DINO: Marrying DINO with Grounded Pre-Training for Open-Set Object Detectioncited by 3,274
  7. 2022Scaling Instruction-Finetuned Language Modelscited by 2,997
  8. 2024Chronos: Learning the Language of Time Seriescited by 712
  9. 2022Large-scale Contrastive Language-Audio Pretraining with Feature Fusion and Keyword-to-Caption Augmentationcited by 707
  10. 2023Qwen-Audio: Advancing Universal Audio Understanding via Unified Large-Scale Audio-Language Modelscited by 591
  11. 2022BioGPT: Generative Pre-trained Transformer for Biomedical Text Generation and Miningcited by 531
  12. 2022LayoutLMv3: Pre-training for Document AI with Unified Text and Image Maskingcited by 481
14 more
  1. 2023Florence-2: Advancing a Unified Representation for a Variety of Vision Taskscited by 403
  2. 2021Large-Scale Chemical Language Representations Capture Molecular Structure and Propertiescited by 203
  3. 2024Jasper and Stella: distillation of SOTA embedding modelscited by 109
  4. 2018Glow: Graph Lowering Compiler Techniques for Neural Networkscited by 73
  5. 2020MLIR: A Compiler Infrastructure for the End of Moore's Lawcited by 64
  6. 2021Torch.fx: Practical Program Capture and Transformation for Deep Learning in Pythoncited by 38
  7. 2022Hidet: Task-Mapping Programming Paradigm for Deep Learning Tensor Programscited by 28
  8. 2019TensorFlow Eager: A Multi-Stage, Python-Embedded DSL for Machine Learningcited by 22
  9. 2025HydraServe: Minimizing Cold Start Latency for Serverless LLM Serving in Public Cloudscited by 12
  10. 2018AutoGraph: Imperative-style Coding with Graph-based Performancecited by 9
  11. 2023The Jaseci Programming Paradigm and Runtime Stack: Building Scale-out Production Applications Easy and Fastcited by 4
  12. 2024MTP: A Meaning-Typed Language Abstraction for AI-Integrated Programmingcited by 3
  13. 2025PyGraph: Robust Compiler Support for CUDA Graphs in PyTorchcited by 3
  14. 2025Extending Data Spatial Semantics for Scale Agnostic Programmingcited by 2

Built on by

Cited by year

Citing papers per year: 2025: 1.

1 paper.