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

ProfiX: Improving Profile-Guided Optimization in Compilers with Graph Neural Networks

Huiri Tan, Juyong Jiang, Jiasi ShenNeurIPS 2025

TL;DR

ProfiX is a novel machine learning framework that uses a hybrid Graph Neural Network (GNN) architecture to fix inaccuracies in sampling-based execution profiles. By combining sequential and structural program analysis, it allows compilers to achieve the high performance of "heavyweight" instrumentation-based optimization with the low overhead of production-ready sampling.

The Profile Inference Problem

Modern compilers use Profile-Guided Optimization (PGO) to make programs faster. By watching how a program actually runs (the "profile"), the compiler can make smarter decisions, like putting frequently used code closer together or inlining "hot" functions.

There are two ways to get these profiles:

  1. Instrumentation: Adding counters to the code. It’s very accurate but slows the program down significantly (high overhead), making it rare in production.
  2. Sampling: Using hardware features to "peek" at the program occasionally. It has negligible overhead but is "noisy." It often misses certain code blocks entirely (dangling blocks) or miscounts how often a branch is taken.
Comparison of real execution, ground truth, and sampled data in a Control-Flow Graph.

The challenge is the Profile Inference Problem: how do we take a messy, incomplete sampled profile and reconstruct a high-fidelity version that the compiler can actually use to optimize the binary? Traditional methods use rigid mathematical flow algorithms (like Minimum-Cost Flow), but these often struggle with complex code structures and fail to capture program-specific patterns.

Methods: A Hybrid Deep Learning Approach

The authors introduce ProfiX, a hybrid deep learning model designed to "denoise" sampled profiles. Its architecture is built on a key insight: programs have both a sequential order (the order instructions are written) and a structural order (the complex web of jumps and loops in a Control-Flow Graph).

The hybrid GNN architecture of ProfiX, combining LSTM and SAGEAttention layers.

Key components include:

  • Sequential Encoding (LSTM): Captures the linear dependencies of basic blocks as they appear in the code.
  • Structural Encoding (GraphSAGE): Uses a GNN to aggregate information from neighboring blocks in the Control-Flow Graph (CFG), allowing the model to understand the "topology" of the function.
  • SAGEAttention Layer: A custom fusion layer that combines GraphSAGE with Multi-Head Graph Attention (GAT). This allows the model to weigh the importance of different neighboring blocks dynamically.
  • LLVM Integration: ProfiX is built to work directly with the LLVM compiler infrastructure, making it compatible with real-world C/C++ development workflows.

Datasets

The researchers evaluated ProfiX using a diverse set of large-scale, real-world applications:

  • Compilers: Clang 20.0 and GCC 14.2.
  • Databases: MySQL 8.32 and SQLite 3.
  • Benchmarks: The SPEC CPU 2017 suite, which is the industry standard for measuring compute performance.

The dataset included over 13 million lines of code and thousands of functions, providing a robust test for the model's ability to generalize to unseen programs.

Key Insights and Ideas

  • The Hybrid Advantage: The "aha moment" is that neither GNNs nor LSTMs are enough on their own. LSTMs are great at local execution patterns, while GNNs understand the global "map" of the program. Combining them allows ProfiX to "hallucinate" missing data in sampled profiles by understanding how code should flow through a given structure.
  • Moving Beyond Heuristics: Traditional algorithms like Profi rely on hand-tuned heuristics. ProfiX proves that a data-driven approach can learn complex execution patterns that humans might miss, especially in fully optimized binaries where the code structure is already heavily transformed.
  • Inductive Learning: Unlike some GNNs that only work on the specific graph they were trained on, ProfiX uses an inductive approach. This means it can be trained on one set of programs (like Clang) and successfully infer profiles for completely different programs (like MySQL).

Key Results

  • Accuracy: ProfiX achieved a 93.50% overlap score (a measure of profile accuracy) across SPEC 2017 benchmarks, significantly outperforming traditional symbolic algorithms (91.76%) and standard GNN baselines.
  • Performance Gains: When the inferred profiles were fed back into the compiler, ProfiX delivered up to a 9.15% performance improvement over the state-of-the-art traditional algorithm.
  • Real-World Speedup: On the MySQL database, ProfiX-optimized binaries showed a 12.1% average speedup over the "native" (unoptimized) version, compared to only 8.3% for raw sampling and 9.7% for traditional inference methods.
  • Efficiency: Despite being a deep learning model, inference takes only 1.72 milliseconds per sample, making it fast enough for integration into standard build pipelines.

Limitations and Future Work

  • Static vs. Dynamic: Currently, ProfiX is designed for statically compiled programs. The authors note that highly dynamic environments or Just-In-Time (JIT) compilers (like those used for JavaScript or Python) might require further adaptations.
  • Hardware Specifics: While the model generalizes well across software, the authors suggest that fine-tuning for specific hardware architectures (like GPUs or embedded systems) could unlock even more performance.
  • Online Profiling: The current evaluation focuses on offline optimization. A promising future direction is exploring "online" or interactive profiling, where the model corrects profiles in real-time as a cloud service runs.

Summary updated

BibTeX
@inproceedings{tan2025profix,
  author = {Huiri Tan and Juyong Jiang and Jiasi Shen},
  title = {{ProfiX: Improving Profile-Guided Optimization in Compilers with Graph Neural Networks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=CIeWaq0JDl},
}
Figure