NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Optimizing DNN Computation Graph using Graph Substitutions

Jingzhi Fang, Yanyan Shen, Yue Wang, Lei Chen

Introduction

Deep Neural Networks (DNNs) have become the backbone of modern artificial intelligence, yet their increasing scale—often reaching hundreds of millions of parameters—imposes significant computational and energy costs. A primary strategy for enhancing DNN efficiency is the optimization of the computation graph, a directed acyclic graph (DAG) where nodes represent mathematical operations and edges represent data flow. This paper explores the theoretical foundations and practical implementations of graph-level optimizations using graph substitutions.

The OCGGS Problem

The core of graph optimization involves graph substitutions: replacing a specific subgraph with a functionally equivalent but more efficient alternative. Common examples include operator fusion, such as combining a convolution, bias, and ReLU into a single optimized kernel.

The authors formalize this as the OCGGS (Optimizing Computation Graph using Graph Substitutions) problem. They demonstrate that OCGGS is NP-hard and Poly-APX-complete, indicating that finding an optimal or even a near-optimal sequence of substitutions is computationally intractable for large graphs. Existing approaches often rely on greedy heuristics, which frequently fail by becoming trapped in local optima.

A formal representation of a graph substitution rule mapping a source subgraph $G_s$ to a target subgraph $G_t$.

Methodology

To address the complexity of OCGGS, the researchers propose several innovative techniques:

  1. Partial-Order Pruning: The search space for substitution sequences is often redundant because the order of independent substitutions does not affect the final result. By defining a partial order, the search can prune these redundant paths, significantly reducing the exploration space.
  2. Dynamic Programming with Pruning (DPP): This exact algorithm utilizes a cache to store and reuse results from previously explored subgraphs. By avoiding redundant subgraph matching, DPP accelerates the search process compared to basic pruning methods.
  3. Sampling-based Heuristic: For extremely large or complex graphs where exact search is unfeasible, a sampling method is introduced. Unlike greedy approaches, this heuristic employs a "potential" metric to identify substitution sequences that may initially appear suboptimal but enable significant performance gains in later steps.

The Importance of Non-Greedy Moves

A critical insight of this work is that the path to an optimal computation graph often requires intermediate steps that temporarily increase computational cost. Greedy algorithms, which only accept moves that provide immediate improvement, cannot reach these superior global configurations.

Illustration of a non-greedy optimization sequence: an intermediate "bad" move (b) is required to unlock the optimal final graph (c).

Experimental Results

The proposed methods were evaluated across seven diverse DNN architectures, including CNNs (ResNet, Inception-v3, NasNet-A), RNNs (SRU, NasRNN), and Transformers (BERT).

  • Optimization Performance: On complex models like NasNet-A, the sampling heuristic produced graphs that were 15% faster than those generated by MetaFlow.
  • Search Efficiency: The DPP algorithm demonstrated a 3x speedup over standard pruning on ResNet.
  • Scalability: While baseline tools like TASO often timed out on complex architectures, the sampling heuristic consistently found high-quality solutions within seconds or minutes. Furthermore, it reduced memory overhead by up to 85% on memory-intensive models like NasNet-A.

Conclusion

This research highlights the limitations of greedy heuristics in DNN graph optimization and provides a robust theoretical and practical framework for graph substitutions. By leveraging partial-order pruning and sampling-based heuristics, the proposed methods achieve superior optimization results with significantly lower computational overhead. Future work will focus on integrating these high-level graph optimizations with low-level hardware-specific kernel tuning.

Summary updated

BibTeX
@article{fang2020optimizing,
  author = {Jingzhi Fang and Yanyan Shen and Yue Wang and Lei Chen},
  title = {{Optimizing DNN Computation Graph using Graph Substitutions}},
  journal = {Proc. VLDB Endow.},
  year = {2020},
}
Figure