Real-Time Machine Learning: The Missing Pieces

Robert Nishihara, Philipp Moritz, Stephanie Wang, Alexey Tumanov, William Paul, Johann Schleier-Smith, Richard Liaw, Mehrdad Niknami, Michael I. Jordan, Ion Stoica · OpenReview

TL;DR

Modern machine learning applications, especially in reinforcement learning, require real-time, low-latency, and high-throughput execution of dynamic, heterogeneous tasks. This paper introduces a new distributed execution framework designed to meet these stringent demands, offering significant performance improvements over existing systems for representative real-time ML workloads.

What Problem Does This Paper Address?

Traditionally, machine learning (ML) has focused on training models offline and then serving predictions based on static models. However, a new wave of ML applications, particularly in reinforcement learning (RL), involves tight integration with dynamic, real-time feedback loops. These applications need to process sensory data, perform continuous micro-simulations, and make decisions rapidly. This shift creates a significant challenge for existing distributed execution frameworks, which are often not optimized for:

  • Millisecond-level latency: Crucial for reactive systems where decisions must be made in real-time.
  • High throughput: Necessary to handle millions of micro-simulations or data processing tasks per second.
  • Adaptive task graphs: The structure of computations needs to change dynamically based on intermediate results or environmental feedback.
  • Heterogeneous tasks: Executing a mix of tasks with vastly different computational requirements and durations (e.g., simple data processing vs. complex neural network inference vs. physics simulations).

The authors argue that existing frameworks fall short in combining these requirements, necessitating a new approach.

Methods

The paper proposes a new distributed programming model and system architecture to address the identified challenges.

API and Execution Model: The core of their approach is a flexible API that allows developers to specify arbitrary functions as remotely executable tasks. Key features include:

  • Non-blocking task creation: Tasks are submitted asynchronously, and a "future" object is returned immediately, representing the eventual result.
  • Arbitrary function invocation: Any function can be designated as a remote task, supporting heterogeneous kernels. Arguments can be regular values or futures, enabling arbitrary DAG dependencies.
  • Dynamic task creation: Tasks can create new tasks without blocking, allowing computation graphs to be built dynamically during execution. This is crucial for RL scenarios like Monte Carlo Tree Search (MCTS).
  • get and wait primitives: These allow developers to retrieve task results (blocking until completion) or wait for a subset of tasks to finish, enabling fine-grained control over latency requirements.

Proposed Architecture: The system comprises multiple worker processes per node, local schedulers, global schedulers, and an in-memory object store. The two principal architectural features are:

  • Centralized Control State: A logically centralized control plane (implemented using Redis in their prototype) manages system state, enabling stateless components and lineage replay for fault tolerance. This design also facilitates profiling and debugging.
  • Hybrid Scheduling: A combination of local and global schedulers. Local schedulers handle tasks on their node for low latency, while global schedulers manage inter-node task distribution based on global information like resource availability and object locality. This hybrid approach aims to balance low latency with high throughput.

Datasets

Not discussed in the paper. The paper focuses on a representative RL workload for evaluation rather than specific benchmark datasets.

Key Insights and Ideas

  • The "Missing Pieces" are a Combination: While individual requirements like low latency or dynamic task creation exist in other systems, the real challenge lies in combining them effectively for real-time ML.
  • Dynamic Task Graphs are Essential: For applications like RL, where decisions adapt to the environment, the ability to construct and modify computation graphs on the fly is not a luxury but a necessity.
  • Hybrid Scheduling is Key to Performance: Balancing local, fast scheduling with global, informed scheduling is critical for achieving both millisecond latency and high throughput.
  • Stateless Components + Centralized State = Fault Tolerance: By making most system components stateless and relying on a fault-tolerant control plane for state and lineage, the system can recover from failures more easily.
  • Fine-grained Control for Latency: The wait primitive with timeouts allows developers to manage straggler tasks and ensure that critical paths meet latency requirements, even with variable task durations.

Key Results

  • Latency Microbenchmarks: The prototype system achieves sub-millisecond scheduling latencies. Task creation takes ~35μs, retrieving a result takes ~110μs (locally scheduled), and end-to-end task execution is ~290μs (locally) or ~1ms (remotely).
  • Reinforcement Learning Workload: A representative RL workload (training an RL agent for an Atari game) implemented in their prototype achieved a 63x speedup compared to a bulk synchronous parallel (BSP) implementation in Spark. This significant improvement is attributed to the system's ability to handle small, heterogeneous tasks and dynamic execution.

Limitations and Future Work

  • Prototype System: The results are based on a preliminary, proof-of-concept prototype.
  • Representative Workload: While the RL example is representative, more extensive evaluation across a wider range of real-time ML applications would be beneficial.
  • Future Work: The authors suggest that their proposed API and architecture provide a foundation for supporting the emerging class of real-time ML applications and can be extended to incorporate other practical requirements like advanced debugging and profiling tools.

Summary updated

BibTeX
@inproceedings{nishihara2017real,
  author = {Robert Nishihara and Philipp Moritz and Stephanie Wang and Alexey Tumanov and William Paul and Johann Schleier-Smith and Richard Liaw and Mehrdad Niknami and Michael I. Jordan and Ion Stoica},
  title = {{Real-Time Machine Learning: The Missing Pieces}},
  booktitle = {HotOS},
  year = {2017},
  doi = {10.1145/3102980.3102998},
}
Figure