Ray
ray-project / ray
分布式计算框架:把 Python 任务与 actor 扩展到多核多机;Ray Train / Serve / Data / Tune 覆盖训练、推理、数据加载与超参搜索。A distributed compute framework: scale Python tasks and actors across cores and machines; Ray Train / Serve / Data / Tune cover training, serving, data loading and hyperparameter search.
为什么选Why choose it
- 同一套 API 从笔记本扩到集群,不用先上 K8s。The same API scales from a laptop to a cluster without starting with Kubernetes.
- Ray Serve 能把多个模型/后端组成推理图。Ray Serve composes multiple models and backends into an inference graph.
- Ray Tune 适合并行扫参,和训练框架解耦。Ray Tune parallelizes sweeps and stays framework-agnostic.
不适合Not for
不是 Kubernetes 替代;集群运维、网络与存储仍要自己做。Not a Kubernetes replacement; cluster ops, networking and storage are still yours.
小任务调度开销可能大于收益,单机先跑通。Scheduling overhead can outweigh gains on tiny jobs — prove it on one machine first.
不是模型服务框架的全部;GPU 调度要单独规划。Not a complete model-serving stack; GPU scheduling needs separate design.
最小上手Minimum setup
- pip install ray,先用 ray.init() 跑一个远程 task。pip install ray and run a remote task with ray.init().
- 再用 Ray Data 读一批文件,确认分片与吞吐。Then read a batch of files with Ray Data to check sharding and throughput.
- 需要服务时试 Ray Serve,给一个模型包 deployment。For serving, try Ray Serve and wrap one model as a deployment.
依赖与成本Dependencies and cost
Python;多机需要网络与集群启动配置;GPU 任务需要 CUDA 驱动与显存调度;生产建议配对象存储与监控。Python; multi-node needs networking and cluster launch config; GPU jobs need CUDA drivers and VRAM scheduling; production wants object storage and monitoring.
许可与使用边界License and usage boundaries
Apache-2.0;部分生态组件(如 Ray Serve 依赖)各自许可,商用前核对。Apache-2.0; some ecosystem components and Ray Serve dependencies carry their own licences.
开源不等于可商用:GPL / AGPL 有传染性;代码许可、模型许可、生成内容许可要分开看。上线前读仓库 LICENSE 与模型卡,必要时让法务确认。Open source is not automatically commercial-use friendly: GPL / AGPL are copyleft; code, model and output licenses are separate. Read the LICENSE and model card before launch, and involve legal when needed.
替代与相邻Alternatives and neighbors
- DeepSpeed — 规模 / 性能Scale / performance,微软的大模型训练优化库:ZeRO、Offload、混合精度与 MoE 训练,把显存与吞吐压到可用。Microsoft's large-model training library: ZeRO, offload, mixed precision and MoE training to make VRAM and throughput usable.
- verl — 规模 / 性能Scale / performance,字节跳动的 RL 训练框架:面向 LLM Agent 与推理任务,支持 PPO/GRPO 与多轮工具调用。ByteDance's RL training framework for LLM agents and reasoning tasks, with PPO/GRPO and multi-turn tool use.
- Megatron-LM — 规模 / 性能Scale / performance,NVIDIA 的大规模 Transformer 训练框架,支持张量/流水/序列/上下文并行、FP8、MoE 和分布式 checkpoint。NVIDIA’s large-scale Transformer training framework with tensor, pipeline, sequence and context parallelism, FP8, MoE and distributed checkpointing.
下一步Next steps
- 打开 GitHub,先读 README、LICENSE、最近 release 与 issue。Open GitHub and read the README, LICENSE, latest release and issues first.
- 按“部署依赖 / 显存 / 数据 / 网络 / 权限”列一张上手清单。Make an onboarding checklist for deployment dependencies, VRAM, data, network and permissions.
- 用一个小样本跑通,再决定是否进生产;不要直接上生产数据。Run a small sample first, then decide on production; never start with production data.
GitHub 仓库 ↗GitHub repository ↗ 文档 ↗Docs ↗ 加入对比Add to compare