Deep Learning Inference in Facebook Data Centers: Characterization, Performance Optimizations and Hardware Implications

Jongsoo Park, Maxim Naumov, Protonu Basu, Summer Deng, Aravind Kalaiah, Daya Shanker Khudia, James Law, Parth Malani, Andrey Malevich, Nadathur Satish, Juan Miguel Pino, Martin Schatz, Alexander Sidorov, Viswanath Sivakumar, Andrew Tulloch, Xiaodong Wang, Yiming Wu, Hector Yuen, Utku Diril, Dmytro Dzhulgakov, Kim M. Hazelwood, Bill Jia, Yangqing Jia, Lin Qiao, Vijay Rao, Nadav Rotem, Sungjoo Yoo, Mikhail SmelyanskiyarXiv 2018

TL;DR

This paper provides a deep dive into the computational characteristics of deep learning (DL) models used at Facebook, revealing significant differences from commonly studied academic benchmarks. The authors propose optimizations for existing hardware and offer crucial insights for designing future inference accelerators, emphasizing the need for co-design between algorithms, numerics, and hardware.

What Problem Does This Paper Address?

The rapid growth of deep learning (DL) applications in social networks like Facebook has led to a massive increase in computational demand, particularly for inference. This surge poses a significant challenge for data centers, which need to balance performance, energy efficiency, and cost. Existing research on DL inference often focuses on models and workloads that don't fully represent the diverse and evolving landscape of real-world applications. This gap means that hardware optimizations and designs might not be optimally suited for the actual demands of large-scale DL inference in production environments. The paper aims to bridge this gap by characterizing Facebook's DL workloads and providing actionable insights for hardware and software co-design.

Methods

The authors conducted a detailed characterization of DL models used across various Facebook services, including recommendation systems, computer vision, and natural language processing. They analyzed computational characteristics, memory requirements, and performance bottlenecks. Based on this analysis, they explored and implemented performance optimizations targeting existing CPU infrastructure, focusing on reduced-precision inference (e.g., FP16, 8-bit integer arithmetic) and leveraging libraries like FBGEMM. They also investigated whole-graph optimizations, such as operator fusion, to further improve efficiency. The insights gained from this empirical study informed their recommendations for future hardware designs.

Datasets

The paper does not explicitly list specific datasets used for training or evaluation. Instead, it refers to the internal datasets and models used within Facebook's social network services. The evaluation of optimizations and performance is based on these internal workloads, with references to public benchmarks like ImageNet for context when discussing model architectures (e.g., ResNet, ResNeXt).

Key Insights and Ideas

  • Real-world DL is Diverse and "Messy": Unlike the often "nice" square matrices found in academic benchmarks, Facebook's DL models frequently involve "tall and skinny" matrices and a long tail of less common operators beyond standard FCs and convolutions. This diversity demands more flexible hardware.
  • Embedding Layers are Memory Bottlenecks: Recommendation models, a significant workload, are heavily dominated by embedding lookups, which are memory bandwidth-bound and require massive memory capacity (tens of GBs). This highlights the need for high-bandwidth memory solutions.
  • Reduced Precision is Crucial, but Accuracy is Paramount: While reduced precision (FP16, INT8) offers significant speedups and energy savings, maintaining accuracy (often <1% drop) is critical for production systems. This necessitates fine-grained quantization and quantization-aware training.
  • CPU Still Matters: Despite the rise of accelerators, CPUs remain important for DL inference due to their flexibility, availability, and tight integration with business logic. Optimizations for CPUs are therefore highly relevant.
  • Co-design is Essential: The rapid evolution of DL models and the complexity of hardware mean that a co-design approach, where algorithms, numerics, and hardware are developed in tandem, is the most effective path forward.

Key Results

  • Performance Gains from Reduced Precision: The paper demonstrates significant speedups using optimized reduced-precision libraries like FBGEMM. For example, FP16 and i8-acc32 GEMMs achieved up to 2x and 4x speedups over MKL's FP32 GEMM, respectively, leading to up to 15% overall latency reduction in recommendation models.
  • Whole-Graph Optimization Impact: Merging batched matrix multiplies with tensor manipulation operations (which account for ~17% of CPU time) resulted in over 10% savings in run time.
  • Hardware Requirements: The characterization identified key requirements for future DL hardware: high memory bandwidth and capacity for embeddings, powerful matrix and vector engines, large on-chip memory for small batches, and support for half-precision floating-point computation.
  • Accuracy Preservation: Techniques like fine-grain quantization, quantization-aware training, selective quantization, and outlier-aware quantization were shown to be effective in meeting the stringent accuracy requirements of Facebook's DL workloads.

Limitations and Future Work

  • Model Evolution: The paper acknowledges the fast pace of change in DL models, meaning that hardware optimized for current models may quickly become inefficient for future ones. This underscores the need for adaptable hardware.
  • Benchmark Relevance: The authors highlight a gap between commonly studied academic benchmarks and the actual workloads run in their data centers, suggesting that future research should focus more on real-world application characteristics.
  • Future Hardware Design: The paper strongly advocates for better co-design of algorithms, numerics, and computing platforms. It suggests that future hardware should be more flexible to accommodate diverse matrix shapes and operator types, and that the development of specialized linear algebra interfaces and compilers for DL is crucial. The authors also point to the need for continued research in areas like outlier-aware quantization and efficient handling of sparse computations.

Summary updated

BibTeX
@misc{park2018deep,
  author = {Jongsoo Park and Maxim Naumov and Protonu Basu and Summer Deng and Aravind Kalaiah and Daya Shanker Khudia and James Law and Parth Malani and Andrey Malevich and Nadathur Satish and Juan Miguel Pino and Martin Schatz and Alexander Sidorov and Viswanath Sivakumar and Andrew Tulloch and Xiaodong Wang and Yiming Wu and Hector Yuen and Utku Diril and Dmytro Dzhulgakov and Kim M. Hazelwood and Bill Jia and Yangqing Jia and Lin Qiao and Vijay Rao and Nadav Rotem and Sungjoo Yoo and Mikhail Smelyanskiy},
  title = {{Deep Learning Inference in Facebook Data Centers: Characterization, Performance Optimizations and Hardware Implications}},
  year = {2018},
  eprint = {1811.09886},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1811.09886},
}
Figure