Ray
- Problem solved: distribute ordinary Python code (functions and stateful objects) across a cluster of CPUs and GPUs, with millions of small tasks per second, where batch frameworks such as Spark are too rigid for AI.
- Era: development from 2016 at the RISELab (UC Berkeley), v0.1 in May 2017, OSDI paper in October 2018, Ray 1.0 in September 2020, Ray 2.0 in August 2022, joined the PyTorch Foundation (Linux Foundation) on October 22, 2025.
- Publisher: Anyscale, founded in 2019 by the creators of Ray (non-Apache project).
- Category: general-purpose distributed computing framework, focused on AI and machine learning.
- Created by: Robert Nishihara and Philipp Moritz (PhD students), with Ion Stoica (Databricks co-founder) and professor Michael I. Jordan, at UC Berkeley's RISELab.
Historical context
In the mid-2010s, AI changes shape. Reinforcement learning (RL) chains simulation, training and serving of a model that continuously interacts with its environment. The OSDI 2018 paper sums up the need: "a dynamic computation framework that handles millions of heterogeneous tasks per second at millisecond-level latencies". Yet bulk-synchronous systems, "MapReduce, Apache Spark, and Dryad", handle neither fine-grained simulation nor model serving.
As a result, researchers hack their own systems. The BAIR blog of January 2018 cites an algorithm that fits in "about a dozen lines of pseudocode" but whose distributed implementation takes thousands of lines. Robert Nishihara and Philipp Moritz, PhD students at Berkeley, live this problem: "as graduate students working on AI, we needed to scale our algorithms across CPU and GPU clusters". They are inspired by "the previous generation of students in our lab who had created Apache Spark", that is, the creators of Spark.
Development starts in 2016 with Ion Stoica, Databricks co-founder, and Michael I. Jordan. According to Stephanie Wang, co-author of the OSDI paper, the very first version was written in Rust, before the core was rewritten in C++ in 2018. v0.1 ships in May 2017. In January 2018, the BAIR blog presents Ray with its first libraries, RLlib (RL) and Tune (hyperparameter search), then the paper "Ray: A Distributed Framework for Emerging AI Applications" is presented at OSDI in October 2018.
In 2019, the creators found Anyscale, with a 20.6M$ Series A led by Andreessen Horowitz. Ant Group is the first major production user, followed by Uber and Pinterest. Ray 1.0 (2020) stabilizes the API and adds Ray Serve; with Ray 2.0 (2022), the Datasets library natively shuffles 100 TB of data or more. The same year, Greg Brockman explains that OpenAI uses it "to train our largest models". In October 2025, Ray joins the PyTorch Foundation, part of the Linux Foundation.
Key idea
A single interface for two styles of computation: tasks (stateless functions run remotely) and actors (stateful objects living on a node), backed by "a single dynamic execution engine". You write almost ordinary Python; Ray builds the task graph on the fly, as execution goes, instead of requiring a static plan like a batch job. Ray does not aim to replace Spark for classic data processing: the paper states that it then lacks query optimization and straggler mitigation.
How it works
- Three primitives, tasks, actors and objects: a
@ray.remotedecorator turns a function into a task or a class into an actor; each call immediately returns a future (a reference to an object), whichray.getresolves. - Global Control Store (GCS): metadata (computation lineage, object directory) is kept in a sharded key-value store, on Redis in 2018, instead of a central master.
- Bottom-up distributed scheduler: each node first schedules its tasks locally and only forwards them to a global scheduler when it is overloaded or cannot satisfy the task (for example, no GPU).
- Shared-memory object store: on each node, objects are shared with no copy between tasks, in the Arrow format.
- Lineage-based fault tolerance: if a node fails, Ray recomputes the lost objects by replaying the tasks that produced them.
- Libraries: RLlib (RL), Tune (hyperparameters), Serve (model serving, 2020), Datasets (data), all built on the same core.
import ray
ray.init()
@ray.remote
def square(x):
return x * x
@ray.remote
class Counter:
def __init__(self):
self.n = 0
def incr(self):
self.n += 1
return self.n
futures = [square.remote(i) for i in range(4)] # 4 tasks in parallel
print(ray.get(futures)) # [0, 1, 4, 9]
c = Counter.remote() # an actor on the cluster
print(ray.get(c.incr.remote())) # 1
By the numbers
| Figure | Context | Source |
|---|---|---|
| 1.8 million | Tasks per second reached in the paper's experiments (2018) | OSDI 2018 paper |
| About 40,000 | Lines of code in Ray, 72% C++ and 28% Python (2018) | OSDI 2018 paper |
| 3.7 min vs 10 min | Evolution Strategies on 8,192 cores, against the best published result (2018) | OSDI 2018 paper |
| 20.6M$ | Anyscale Series A led by Andreessen Horowitz (December 2019) | Anyscale blog |
| 67 contributors, 458 commits | Contributions to the Ray 1.0 release (September 2020) | Anyscale blog, Ray 1.0 |
| 100 TB for 97$ | CloudSort with Exoshuffle on Ray, 33% cheaper than Spark's 2016 record (January 2023) | Anyscale blog, sortbenchmark.org |
| Over 237 million | Cumulative downloads when joining the PyTorch Foundation (October 2025) | Linux Foundation |
| Nearly 10x | Download growth over one year (October 2025) | Anyscale blog |
Milestones
- 2016: development starts at UC Berkeley's RISELab.
- May 2017: v0.1 is released.
- January 9, 2018: Ray, RLlib and Tune are presented on the BAIR blog.
- October 2018: paper "Ray: A Distributed Framework for Emerging AI Applications" at OSDI (Carlsbad).
- December 17, 2019: Anyscale launches with a 20.6M$ Series A.
- September 30, 2020: Ray 1.0, stable API and Ray Serve; first Ray Summit.
- August 23, 2022: Ray 2.0 and a 99M$ Series C extension for Anyscale.
- January 25, 2023: CloudSort world record, 0.97$ per terabyte sorted.
- October 22, 2025: Ray joins the PyTorch Foundation, part of the Linux Foundation.
Did you know?
- Ray and OpenAI: at Ray Summit 2022, Greg Brockman said OpenAI compared Dask, Ray and a "half dozen other projects", and that "Ray was by far the winner". The press [S] later linked Ray to ChatGPT training; in the primary source, OpenAI only mentions its "largest models".
- 7 lines: in the 2018 paper, parallelizing a serial implementation of Evolution Strategies with Ray required changing only 7 lines of code.
- RL, always: the first use case pursued was reinforcement learning; in 2025, Anyscale states that "nearly every open-source RL framework for post-training LLMs is built on top of Ray".
- Not Apache: according to The New Stack [S], Ray is sometimes mislabeled "Apache Ray"; it moved from Anyscale to the PyTorch Foundation, not to the ASF.
Strengths and limitations
| Strengths | Limitations |
|---|---|
| Distributes almost ordinary Python (tasks and actors) | Not a SQL engine nor a query optimizer like Spark |
| Millisecond-level latency, millions of tasks per second | A cluster to operate (or a managed service to pay for) |
| Built-in libraries: RL, hyperparameters, serving, data | Ecosystem very focused on Python and AI |
| Neutral governance since 2025 (PyTorch Foundation) | Historically driven by a single company, Anyscale |
Place in the system
- Follows Spark in the same Berkeley lab, but for a different problem: dynamic, fine-grained computation for AI rather than batch processing over data.
- Uses Arrow as the format of its shared-memory object store.
- Sits next to PyTorch in the training stack of large models, and serves as the distributed compute layer of RL post-training frameworks.
Sources
raw-data/ecosysteme/ray/ray.md- https://www.usenix.org/conference/osdi18/presentation/moritz
- https://www.usenix.org/system/files/osdi18-moritz.pdf
- https://bair.berkeley.edu/blog/2018/01/09/ray/
- https://www.anyscale.com/about
- https://www.anyscale.com/blog/founders-of-open-source-project-ray-launch-anyscale-with-20-6m-in-funding-to-democratize-distributed-programming
- https://www.anyscale.com/blog/announcing-ray-1-0
- https://www.anyscale.com/blog/announcing-ray-2-0
- https://www.anyscale.com/blog/anyscale-unveils-ray-2-0-and-anyscale-innovations-at-ray-summit-2022-adds-an
- https://www.youtube.com/watch?v=CqiL5QQnN64
- https://www.anyscale.com/blog/ray-breaks-the-usd1-tb-barrier-as-the-worlds-most-cost-efficient-sorting
- http://sortbenchmark.org/ExoshuffleCloudSort2022.pdf
- https://www.anyscale.com/blog/ray-by-anyscale-joins-pytorch-foundation
- https://www.linuxfoundation.org/press/pytorch-foundation-welcomes-ray-to-deliver-a-unified-open-source-ai-compute-stack
- https://haoailab.com/dsc204a-w24/assets/slides/UCSD_3_3_24_A_brief_history_of_the_Ray_ecosystem.pdf
- https://a16z.com/announcement/why-were-investing-in-anyscale/
- https://www.businessinsider.com/openai-chatgpt-trained-on-anyscale-ray-generative-lifelike-ai-models-2022-12 [S]
- https://thenewstack.io/ray-comes-to-the-pytorch-foundation/ [S]
- Ray's license (Apache 2.0 according to common usage): find a statement on ray.io or docs.ray.io.
- Direct link between Ray and ChatGPT training: only secondary sources.
- Read the NSDI 2021 paper ("Ownership") on the new core architecture.
- Detail Ray Data, Ray Train and KubeRay from the official documentation.