TL;DR
Researchers from Qualcomm and Google have developed Topoformer, a novel Graph Neural Network (GNN) architecture that finds optimal execution orders for computation graphs. By using a non-autoregressive transformer-based approach, they achieved memory-efficient scheduling that is up to 4,000x faster than traditional optimization methods while maintaining or exceeding their performance.
What Problem Does This Paper Address?
When a compiler prepares a program (like a neural network) for execution, it must decide the order in which operations are performed. Because operations have dependencies—you cannot calculate $C$ until $A$ and $B$ are finished—this execution plan is represented as a Directed Acyclic Graph (DAG).
The specific challenge addressed in this paper is Peak Memory Minimization. If a compiler executes operations in a suboptimal order, it might have to keep many intermediate results in memory simultaneously. This can easily exceed hardware limits, especially on resource-constrained edge devices like smartphones. Finding the absolute best "topological order" to minimize this peak memory is a combinatorial optimization problem that is NP-hard. Existing solutions force a difficult trade-off: they are either fast but yield mediocre memory footprints (heuristics), or they find excellent sequences but are painfully slow to compute (Dynamic Programming).
Methods
The authors propose an end-to-end machine learning framework designed specifically to navigate this trade-off. The architecture consists of two main components:
- The Topoformer Encoder: Standard GNNs often struggle with DAGs because they typically only pass messages between immediate neighbors, losing the broader flow of computation. Topoformer introduces a "topological inductive bias" by using multiple Multi-Head Attention (MHA) layers. Each attention head is "masked" by a different structural view of the graph:
- Transitive Reduction (TR): The bare-bones skeleton of the graph.
- Transitive Closure (TC): A version where every node is connected to everything it eventually depends on.
- Incomparable Pairs: Connecting nodes that have no dependency relationship and could potentially be executed in parallel. This multi-view approach allows the model to understand both local dependencies and the global structure of the graph simultaneously.
- Non-Auto-Regressive (NAR) Decoder: Instead of picking nodes one by one to build a sequence (which is computationally slow), the model predicts a "priority" value for every node in a single pass. A simple, fast algorithm then uses these priorities to construct a valid topological order.
The entire model is trained using Reinforcement Learning (REINFORCE), where the "reward" signal is the actual reduction in peak memory usage achieved by the predicted order.
Datasets
To train and evaluate the model, the researchers utilized two types of data:
- Layered Graphs (Synthetic): The authors introduced a new algorithm to generate synthetic graphs that mimic the layered structure and skip connections of real-world neural networks. These were used to train the model and test its ability to scale from 500 up to 2,000 nodes.
- Real-World Computation Graphs: A set of 115 representative graphs extracted from commercial AI applications (such as classifiers and denoisers), ranging from dozens to 1,000 nodes, used to validate real-world applicability.
Key Insights and Ideas
- Topological Inductive Bias Matters: Simply treating a DAG like a generic graph yields poor results. By forcing the attention mechanism to look at specific topological transforms (like Transitive Reduction and Closure), the model learns the "flow" of data much more effectively.
- NAR for Scalability: Most previous ML approaches for sequence ordering were "auto-regressive" (predicting one step at a time). By moving to a non-auto-regressive priority-based system, the authors made the model viable for massive graphs with thousands of nodes.
- Zero-Shot Generalization: A model trained exclusively on 500-node graphs performed remarkably well on 2,000-node graphs without any further training or fine-tuning. This suggests the model is learning fundamental principles of graph topology rather than just memorizing size-specific patterns.
Key Results
The Topoformer model demonstrated significant improvements over existing baselines across multiple dimensions:
- Speed: On 2,000-node synthetic graphs, Topoformer was 4,000x faster than the strongest baseline (Approximate Dynamic Programming).
- Performance: On real-world graphs, the model produced sequences that were 50% better (resulting in lower peak memory) than the best traditional heuristic baseline.
- Efficiency: Even the "Greedy" version of their neural model (the fastest inference mode) consistently outperformed classic heuristics like Breadth-First Search (BFS) and Depth-First Search (DFS).
Limitations and Future Work
- Proprietary Data: While the synthetic graph generator is public, the real-world computation graphs used for final validation are proprietary, making exact reproduction of those specific results difficult for outside researchers.
- Single Objective: The current work focuses purely on memory minimization. In real compiler pipelines, engineers often need to balance memory usage with execution time (latency). Extending this framework to multi-objective optimization is a natural next step.
- Integration: The paper demonstrates the model's power as a standalone tool. The next major challenge is integrating such a "neural compiler" component into production toolchains like LLVM or MLIR.
Summary updated