ray.serve.llm.LLMServer.collective_rpc#

async LLMServer.collective_rpc(method: str, timeout: float | None = None, args: tuple = (), kwargs: dict | None = None) list[source]#

Execute a collective RPC call on all workers.

This is used for RLHF workflows where a trainer needs to execute methods on all TP/PP workers (e.g., for weight synchronization).

Parameters:
  • method – Name of the worker method to execute.

  • timeout – Maximum time in seconds to wait for execution.

  • args – Positional arguments to pass to the worker method.

  • kwargs – Keyword arguments to pass to the worker method.

Returns:

A list containing the results from each worker.