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

Abstract

Traditional distributed computing frameworks, such as Apache Spark and TensorFlow, were designed for static data processing and batch training. However, the rise of Reinforcement Learning (RL) and real-time decision-making systems introduces a new set of requirements: millisecond-level latency, dynamic task graphs, and extreme heterogeneity. This paper identifies the architectural gaps in existing systems and proposes a novel distributed framework—the precursor to Ray—that utilizes a logically centralized control plane and a hybrid "bottom-up" scheduler. Experimental results demonstrate a 63x performance improvement over Spark for RL applications, with task submission overhead reduced to tens of microseconds.

Introduction

In 2017, the UC Berkeley RISELab identified a critical shift in the machine learning landscape. While the previous decade focused on "Big Data" and offline model training, the next frontier was "Real-Time ML." Applications like autonomous driving, high-frequency trading, and robotics require agents to interact with complex environments in real-time. These applications are often powered by Reinforcement Learning (RL), which breaks the traditional "train-then-serve" paradigm.

The Challenge of Real-Time ML

Standard distributed frameworks are built for the Bulk Synchronous Parallel (BSP) model. In this model, data is processed in predictable stages across large batches. While efficient for training a classifier on a static dataset like ImageNet, this approach fails for RL.

Comparison of (a) traditional offline ML training/serving and (b) the dynamic feedback loop of Reinforcement Learning.

As shown in Figure 1, RL agents operate in a continuous feedback loop. An agent observes the environment, computes a policy, and takes an action. This cycle repeats millions of times. The computational demands are unique:

  1. Millisecond Latency: Decisions must be made nearly instantaneously to ensure safety and performance in physical environments.
  2. Dynamic Task Graphs: Unlike deep learning models with fixed architectures, RL often involves search algorithms (like Monte Carlo Tree Search) where the next computation depends on the result of the previous one.
  3. Heterogeneity: A single workflow might involve simulating physics on a CPU, performing neural network inference on a GPU, and aggregating results across a cluster.

Existing tools are either too slow due to high scheduling overhead or too rigid because they require a static execution graph defined upfront.

Proposed Architecture

To address these needs, the authors proposed a system architecture designed for high-throughput, low-latency execution of dynamic tasks. This architecture is built on two primary pillars: a sharded control plane and a hybrid scheduling model.

The proposed system architecture featuring a sharded Control State and a hybrid scheduling hierarchy.

Logically Centralized Control Plane

In traditional systems, metadata about task lineage and object locations is often scattered across different components. This paper introduces a Control State—a sharded, high-performance database (implemented using Redis) that stores all system metadata. By centralizing this state, the other components of the system (schedulers, workers) become stateless. This design simplifies fault tolerance; if a node fails, the system can reconstruct the lost data by replaying the lineage stored in the Control State.

Hybrid Bottom-Up Scheduling

Global schedulers in frameworks like Spark can become a bottleneck when handling millions of tiny, short-lived tasks. The proposed system employs a hybrid scheduling approach. Tasks are first submitted to a Local Scheduler on the same node. If the node has sufficient resources, the task starts immediately, avoiding network round-trips. If the local node is overloaded, the task is pushed to a Global Scheduler, which balances the load across the cluster. This "bottom-up" approach ensures sub-millisecond latency for local work while maintaining global resource efficiency.

Evaluation and Results

The system was evaluated using synthetic microbenchmarks and real-world RL workloads, specifically training agents to play Atari games.

  • Performance Gains: The prototype achieved a 63x speedup over a Spark-based implementation for RL training. It also outperformed a highly optimized single-threaded implementation by 7x, demonstrating the effectiveness of its distributed scaling.
  • Low Overhead: The system achieved a task creation latency of just 35 microseconds. Local task execution took approximately 290µs, while remote tasks were handled in about 1ms.
  • The "Wait" Primitive: A key feature is the inclusion of a wait function with a timeout. In real-time systems, waiting for a "straggler" (a slow task) can be detrimental. The ability to proceed with partial results (e.g., 99% of simulations) is crucial for maintaining the "heartbeat" of autonomous systems.

Conclusion and Impact

This paper laid the foundational architecture for what would become Ray, a widely adopted framework for scaling AI and Python applications. By moving away from the rigid constraints of batch processing and embracing a dynamic, stateless, and hybrid-scheduled design, the authors provided the "missing pieces" for the next generation of real-time machine learning systems. While the 2017 work was a prototype, its core principles—sharded metadata and local-first scheduling—remain central to modern high-performance distributed computing.

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