cedar: Optimized and Unified Machine Learning Input Data Pipelines

Mark Zhao, Emanuel Adamiak, Christos Kozyrakis

TL;DR

This paper introduces "cedar," a novel framework that unifies and optimizes machine learning input data pipelines. cedar automates complex performance optimizations, significantly boosting data throughput and resource efficiency, which is crucial for handling massive datasets and accelerating ML training.

What Problem Does This Paper Address?

Training modern deep learning models requires processing enormous datasets, often involving complex, custom transformations. The "input data pipeline" is responsible for reading, transforming, and batching this data for the ML model. Current input data systems struggle to keep pace with the ever-increasing demands of ML training, leading to "data stalls" where expensive accelerators (like GPUs) sit idle waiting for data. This inefficiency stems from several factors:

  • Lack of unified optimization: Existing systems apply optimizations in isolation, making it hard to combine them effectively.
  • Inability to leverage context: They can't easily understand the semantics of custom Python user-defined functions (UDFs), which are common in ML pipelines.
  • Limited framework support: Many systems are tied to specific ML frameworks (like TensorFlow), excluding users of others (like PyTorch).
  • Resource inefficiency: To avoid stalls, organizations often over-provision expensive compute resources for data processing.

Methods

cedar tackles these challenges with a three-pronged approach:

  • Unified, Composable Operators: cedar provides a Python-native API allowing users to define data pipelines using modular, composable "Pipes" (operators). These Pipes can represent common data loading primitives or arbitrary Python UDFs, supporting various ML frameworks.
  • Extensible Optimizer: At its core is an "Optimizer" that systematically explores a vast space of potential optimizations. It uses a combination of rule-based and cost-based passes to identify the best execution plan. This includes:
  • Semantic-Preserving Reordering: Rearranging operators to improve performance, especially by placing size-reducing transformations earlier.
  • Context-Aware Caching: Intelligently deciding where to cache intermediate results, considering factors like randomness and computational cost vs. storage.
  • Fusion: Combining multiple operators into a single unit to reduce overhead.
  • Offloading: Distributing computation to local or remote parallel execution engines.
  • Prefetching: Overlapping data processing with model training. Crucially, cedar allows users to provide lightweight "hints" about UDF semantics (e.g., randomness, dependencies) to guide the optimizer safely.

  • Dynamic Scaling: During runtime, a "Scaler" component continuously monitors pipeline performance and dynamically adjusts parallelism and resource allocation to precisely match the training job's throughput demands, ensuring efficiency and avoiding over-provisioning.

Datasets

The paper evaluates cedar on eight diverse ML input data pipelines across computer vision (CV), natural language processing (NLP), and automatic speech recognition (ASR) domains. These pipelines are based on established benchmarks and tasks:

  • CV: SimCLR [18, 19] pipeline using ImageNet [25] dataset.
  • Object Detection: SSD [57] pipeline using COCO dataset [56].
  • NLP: Standard NLP pipeline using WikiText-103 dataset [61].
  • ASR: SpecAugment [72] pipeline using Common Voice dataset [5].

The paper also mentions the use of datasets like ImageNet, COCO, and WikiText-103, which are standard in their respective domains. No new benchmarks were introduced.

Key Insights and Ideas

  • The power of combining optimizations: The paper strongly emphasizes that isolated optimizations yield limited gains. The real performance leap comes from systematically combining techniques like reordering, fusion, and offloading.
  • Context is king for UDFs: ML pipelines heavily rely on custom Python UDFs. cedar's ability to leverage user-provided hints about these UDFs (like randomness) is key to safely applying optimizations like reordering and caching.
  • Not all operators are equal: Different operators have vastly different performance characteristics and benefits from specific optimizations. A one-size-fits-all approach (e.g., fusing everything) is detrimental. cedar's optimizer intelligently selects the best strategy per operator.
  • Dynamic scaling is crucial for efficiency: Even with an optimized plan, efficiently matching data throughput to accelerator demand requires dynamic resource adjustment. cedar's Scaler achieves this by right-sizing parallelism.
  • Over-provisioning is a major cost: The paper highlights how current systems often require massive over-provisioning of CPU resources to avoid data stalls, leading to significant infrastructure costs. cedar aims to reduce this.

Key Results

cedar demonstrates significant improvements across various pipelines:

  • Throughput Improvement: cedar improves pipeline throughput by up to 1.87x to 10.65x compared to state-of-the-art input data systems (including PyTorch DataLoader, TensorFlow's tf.data, Ray Data, Plumber, FastFlow, and tf.data service).
  • Resource Efficiency: By dynamically scaling resources, cedar can meet target throughput demands with significantly fewer resources, reducing costs. For example, for the CV-torch pipeline, cedar reduced the required remote CPU cost to 56% of the A100 GPU VM cost, compared to 83% for a baseline system.
  • Optimization Effectiveness: An ablation study showed that combining optimizations (parallelism, reordering, offloading, fusion) led to a massive throughput increase of 43.82x over the baseline.
  • Low Overhead: The tracing and optimization process introduced minimal overheads, with the optimizer finding solutions in under 6 seconds for complex pipelines.
  • Broad Compatibility: cedar supports arbitrary Python UDFs and multiple ML frameworks (PyTorch, TensorFlow, JAX), unlike many specialized systems.

Limitations and Future Work

  • UDF Semantics Inference: Currently, cedar relies on users to provide hints about UDF semantics (randomness, dependencies). Inferring these automatically via static code analysis is left as future work.
  • Caching Strategy: While cedar optimizes caching placement, the current implementation considers only one cache operator at a time. Exploring multi-cache strategies could be beneficial.
  • Distributed Caching: The paper focuses on single-job optimization. Extending cedar to support distributed caching and data reuse across multiple training jobs is a potential future direction.
  • New Optimizations and Engines: cedar's extensible design is intended to easily incorporate future optimization techniques and new execution engines (e.g., NVIDIA DALI, FusionFlow).

Summary updated

BibTeX
@article{zhao2024cedar,
  author = {Mark Zhao and Emanuel Adamiak and Christos Kozyrakis},
  title = {{cedar: Optimized and Unified Machine Learning Input Data Pipelines}},
  journal = {Proc. VLDB Endow.},
  year = {2024},
  doi = {10.14778/3705829.3705861},
}
Figure