Abstract: State-of-the-art machine learning frameworks support a wide variety of design features to enable a flexible machine learning programming interface and to ease the programmability burden on machine learning developers. Identifying and using a performance-optimal setting in feature-rich frameworks, however, involves a non-trivial amount of performance profiling efforts and often relies on domain-specific knowledge. This paper takes a deep dive into analyzing the performance impact of key design features in a machine learning framework and quantifies the role of parallelism. The observations and insights distill into a simple set of guidelines that one can use to achieve much higher training and inference speedup. Across a diverse set of real-world deep learning models, the evaluation results show that the proposed performance tuning guidelines outperform the Intel and TensorFlow recommended settings by 1.29x and 1.34x, respectively.
Introduction
Modern deep learning (DL) frameworks like TensorFlow and PyTorch are a double-edged sword. While they offer high-level APIs that make prototyping incredibly fast, this abstraction comes with a "programmability tax." Most developers rely on default settings or generic performance guides that fail to account for the specific structural nuances of their models. On many production systems, especially in datacenters, CPUs handle a significant portion of inference. Without proper tuning of inter-operator (between layers) and intra-operator (within a layer) parallelism, these systems often suffer from workload imbalance and synchronization overhead, leaving significant hardware capability on the table.
Methodology
The researchers performed a "deep dive" profiling of DL frameworks on Intel Skylake CPU platforms. Their approach involved systematic evaluation across four key design areas: scheduling mechanisms, operator design, library choice, and multi-socket scaling.
To simplify optimization, the authors distilled their findings into the "Average Width" guideline. This metric—the ratio of heavy operators to the number of layers—determines the optimal number of inter-op thread pools for a given model architecture.
Key Insights: Quantifying the Programmability Tax
A major finding of the study is the "Data Prep Bottleneck." A surprising amount of execution time is spent not in the math kernels themselves, but in "data preparation"—formatting tensors for high-performance libraries like MKL. For medium-sized matrices, this overhead can exceed 70% of the execution time.
Furthermore, the study reveals that hyperthreading can be a significant asset. By "colocating" different task types, one logical core can run a math-heavy thread (using FMA units) while its twin logical core runs a framework-native "intra-op" thread (using non-FMA units) to handle data preparation in parallel. This approach effectively exploits hardware units that would otherwise remain idle.
Evaluation and Results
The study utilized a diverse suite of production-grade models, including ResNet-50, Inception (v1-v3), Transformer, and recommendation models like Neural Collaborative Filtering (NCF).
- Superior Performance: The proposed tuning guidelines outperformed Intel’s recommended settings by 1.29× and TensorFlow’s settings by 1.34× on average.
- Heuristic Accuracy: In a design space of over 880,000 possible configurations, the simple heuristic achieved 95% of the performance of the global optimum found through exhaustive search.
- Significant Speedups: For specific models like Inception v3, proper tuning led to an overall performance improvement of 3.6× compared to untuned baselines.
Conclusion and Future Work
This research demonstrates that balancing inter-op and intra-op parallelism is more effective than simply maximizing thread counts. While the current study focuses on CPU platforms and static guidelines, it provides a foundation for future work in dynamic, runtime adjustments to thread pools and the exploration of model pipelining for extremely large-scale architectures.
Summary updated