Scalable model serving library for building online inference APIs
open sourceApache-2.0self-hostablefree
Ray Serve is the model serving library of Ray, the open source distributed compute engine whose creators built Anyscale, installed with pip install "ray[serve]". Deployments are Python classes or functions that serve PyTorch, TensorFlow, scikit-learn or any Python business logic; several deployments compose into one application whose calls between models read like function calls, and each scales by replicas, with fractional GPUs, autoscaling, request batching and response streaming. Ray Serve LLM adds an OpenAI-compatible API over vLLM or SGLang with multi-node, multi-GPU serving, multi-LoRA and prefill-decode disaggregation. Applications are managed with the serve CLI and a REST API, and run on any Ray cluster, on Kubernetes through KubeRay, or as Anyscale services, which add high availability and zero-downtime upgrades. It is Apache-2.0 licensed.
Problems it solves
- serve several ML models plus Python business logic behind one HTTP API written in plain Python
- compose a pipeline of models where one model's output feeds the next, scaled independently
- share one GPU between several small models by giving each a fraction of it
- autoscale model replicas up and down with request load across a cluster
- batch incoming inference requests together to make better use of the GPU
- stream tokens back from an LLM endpoint as they're generated
- serve an open-weight LLM across several GPUs and nodes behind an OpenAI-compatible API
- serve many LoRA adapters on top of one shared base model
- scale LLM prefill and decode separately to cut serving cost
- add model serving to a FastAPI app without building our own scaling layer
- deploy model serving apps on Kubernetes with zero-downtime upgrades
- framework-agnostic model serving that isn't tied to PyTorch or TensorFlow
- run the same serving code on a laptop and on a large cluster
- manage deployed model APIs from the command line and a REST API
- managed hosting for our Python model serving apps with high availability
Features
- deployments written as Python classes or functions
- model composition with a programmable Python API
- replica autoscaling and load balancing
- fractional GPUs and multi-GPU, multi-node serving
- dynamic request batching and response streaming
- FastAPI integration and gRPC
- Ray Serve LLM: OpenAI-compatible chat, completions and embeddings over vLLM or SGLang
- multi-LoRA serving and prefill-decode disaggregation
- serve CLI and a REST API for declarative deploys
- Kubernetes deployment through KubeRay's RayService
View 1 more
- runs as Anyscale services with high availability and zero-downtime upgrades
Limitations
- No model lifecycle management or model performance dashboards: Ray Serve is a serving library, not a full ML platform1
- Doesn't optimize models for you: unlike framework-specific servers, you apply optimizations such as PyTorch JIT or ONNX Runtime yourself1
- Windows support is in beta: multi-node Ray clusters on Windows are experimental and untested2
Ways to run it
Ray Serve
Not included
- high availability and zero-downtime upgrades managed for you
You arrange
- a Ray cluster, on your own machines or on Kubernetes with KubeRay
- GPUs or CPUs to serve on
Anyscale services
pay as you go per compute hour (CPU-only 0.0135 AC/hr, NVIDIA T4 0.5682 AC/hr, A100 4.9591 AC/hr); $100 credit to start; committed contracts through sales45
Only in this edition
- high availability
- zero-downtime upgrades
- hosted or in your own cloud account (BYOC)
Capabilities
| Has an API | plan not known |
|---|---|
| Has a command line tool | plan not known |
| Has official SDKs | plan not known |
Alternatives
The same job
These do what Ray Serve does.
- BentoML Unified model serving framework for building model inference APIs and multi-model serving systems
- NVIDIA Dynamo-Triton Open source inference serving software that deploys AI models from any major framework
- vLLM A high-throughput and memory-efficient inference and serving engine for LLMs
- Seldon Core An MLOps and LLMOps framework for deploying, managing and scaling AI systems in Kubernetes
- KServe Standardized distributed generative and predictive AI inference platform for scalable, multi-framework deployment on Kubernetes