DreamShard: Generalizable Embedding Table Placement for Recommender Systems

Daochen Zha, Louis Feng, Qiaoyu Tan, Zirui Liu, Kwei-Herng Lai, Bhargav Bhushanam, Yuandong Tian, Arun Kejariwal, Xia Hu

Introduction

Modern deep learning recommendation models (DLRMs) rely heavily on massive embedding tables to process categorical features such as user IDs or content tags. These tables are often multi-terabyte in size, necessitating their distribution across multiple GPUs. The core challenge, known as "sharding," is deciding which table should be placed on which GPU to maximize performance.

Poor placement leads to significant load imbalances, where one GPU becomes a bottleneck while others remain idle. This optimization problem is further complicated by two factors: the non-linear performance gains from operation fusion (where multiple lookups are combined into a single kernel) and the dynamic nature of production environments, where the number of tables or available hardware can change frequently.

Methodology

DreamShard is a reinforcement learning (RL) framework that treats table placement as a sequential decision-making process. To overcome the high cost of training on physical hardware, the authors introduce a "World Model" approach using an Estimated MDP.

The DreamShard framework utilizes a cost network to simulate hardware performance, allowing the RL agent to train efficiently in a "dreamed" environment.

The Cost Network

Instead of executing every placement on real GPUs, DreamShard uses a cost network trained on a small amount of hardware data to predict computation and communication costs. This network accounts for the non-linear speedups of fused operations by predicting the cost of the entire fused operation directly, rather than summing individual table costs. This allows the RL agent to "dream" or train entirely within a simulated environment.

Generalizable Policy Architecture

The policy network is designed to be permutation-invariant, utilizing sum and max reductions to aggregate features. This architecture allows the model to handle a variable number of tables and GPUs without retraining. Consequently, a model trained on a small-scale task can be applied to large-scale production workloads with zero-shot transfer capabilities.

Experimental Evaluation

The researchers evaluated DreamShard on two large-scale benchmarks: an open-source DLRM synthetic dataset and an internal production dataset from Meta featuring hundreds of tables with diverse dimensions.

Execution traces comparing placement strategies: DreamShard (c) achieves significantly lower latency (35.95ms) and better GPU utilization than random (a) or expert-designed (b) methods.

Key Results

  • Significant Speedups: DreamShard outperformed the best human-designed greedy strategies by up to 19% on production tables.
  • Improved Load Balancing: Qualitative traces show that DreamShard achieves a much tighter balance across GPUs, significantly reducing the idle time seen in random or expert-designed placements.
  • Training and Inference Efficiency: The system is remarkably fast, reaching peak performance in under 200 seconds on standard benchmarks. Once trained, it can place hundreds of tables in less than one second.

Conclusion and Future Work

DreamShard demonstrates that RL agents can learn effective system optimization strategies using surrogate cost models. Its ability to generalize across different scales and configurations addresses a major hurdle in deploying RL for production systems. Future research directions include extending the framework to heterogeneous hardware clusters and tiered memory systems (e.g., HBM vs. DDR).

Summary updated

BibTeX
@inproceedings{zha2022dreamshard,
  author = {Daochen Zha and Louis Feng and Qiaoyu Tan and Zirui Liu and Kwei-Herng Lai and Bhargav Bhushanam and Yuandong Tian and Arun Kejariwal and Xia Hu},
  title = {{DreamShard: Generalizable Embedding Table Placement for Recommender Systems}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=IF9Cy4KhET},
}
Figure