Skip to main content
Miles uses Ray’s object store by default to pass rollout data from rollout workers to trainers. Mooncake Store can replace Ray for this handoff. Both train.py and train_async.py support the Mooncake backend, and the trainer receives the same rollout dictionary with either backend. Rollout-data transfer and model-weight transfer are separate settings:
  • --object-store-backend selects the rollout object store.
  • --update-weight-transfer-mode selects the model-weight transfer path.

Requirements

Before starting a Miles job:
  • Run the same Miles revision and Mooncake version on every Ray node and on the host that runs mooncake_master.
  • Start mooncake_master, or provide a Mooncake HA endpoint, and make the endpoint reachable from every node. Miles connects as a client and does not manage the endpoint lifecycle.
  • Use routable data-network addresses for Ray and Mooncake clients.
  • Reserve enough host memory for global_segment_size and local_buffer_size.
  • For RDMA, expose the RDMA device to the Miles environment, allow memory locking, and set the local device name on each node. Leaving it to automatic selection can spread host-memory transfers across every HCA and run far slower (kvcache-ai/Mooncake#4322).
This backend imports the structured-object API from mooncake.structured_object_store (FieldSchema, MooncakeBundleTransfer, export_ref, import_ref), which Mooncake provides from 0.3.12.post1 on; earlier releases ship the module without these names. The Miles CUDA images use the Mooncake package that ships in the SGLang base image, and the ROCm images add Mooncake’s Python files from mooncake-transfer-engine-non-cuda (see docker/Dockerfile.rocm). For a custom environment, install a Mooncake package that matches the CUDA runtime and is compatible with the Miles revision. Follow the Mooncake installation guide for current package names and supported platforms. See Versions and Images for how the images pick their Mooncake.

Configure the backend

Choose the transfer protocol before starting Ray. TCP works on any routable data network. RDMA also requires a local RDMA device on every node; device names may differ between nodes. If Ray and the Mooncake endpoint are already running, set the protocol and endpoint:
Then add these options to an existing Miles training command:
Use a data-network address that every client can reach. The JSON value must remain one shell argument. MOONCAKE_MASTER_ADDR above is only a shell variable for these examples; the environment variable Miles itself falls back to is MOONCAKE_MASTER. Launch scripts and the Mooncake end-to-end tests assemble both pieces with start_mooncake_master() and get_mooncake_object_store_args() from miles/utils/external_utils/command_utils.py. The walkthrough below spells them out instead, so every setting stays visible.

Two-node walkthrough

The example below runs three synchronous rollout and training iterations with FSDP. It uses one eight-GPU node for rollout and one eight-GPU node for training. Set the variables to match your cluster, then complete the following steps in order. Both nodes must use the same Python environment, Miles revision, and Mooncake version. The model and dataset paths referenced by the job must be available to the processes that use them.

1. Choose the protocol and set node addresses

On the head node, select TCP or RDMA and set its data-network address:
On the worker node, select the same protocol and set both node addresses:
For RDMA, set MOONCAKE_DEVICE before starting Ray so that Ray workers inherit the node-local device setting.

2. Start Mooncake and Ray on the head

Activate the Miles environment first, then run:

3. Join the worker

Activate the same Miles environment on the worker, then run:
Mooncake uses each Ray node IP as local_hostname by default. Starting Ray with the data-network addresses above therefore keeps both systems on the same network.

4. Submit training from the head

Set the Store configuration and the repository, model, and dataset paths before submitting the job. The 2 GiB values are suitable for this small example; production jobs should size them for live rollout data, replicas, and concurrent transfers.
For fully asynchronous training, keep the same Mooncake options and use the normal Miles async entrypoint and flags:
See Fully Async Rollout for the remaining async settings.

Configuration reference

--mooncake-store-init-kwargs accepts the following fields: Values supplied in --mooncake-store-init-kwargs take precedence over environment variables. Use data-network addresses in multi-node jobs; loopback addresses work only when all clients run on one node. Not every client contributes a segment: the rollout manager never does, and among training actors one per node does. Size global_segment_size for that per-node contribution rather than for the total client count. Mooncake stores one replica by default. Request additional replicas with:
Additional replicas require additional Store capacity.