> This page is for version 2.1.5-pb7.
> For other versions, use one of these documentation indexes:
> - 2.1.7 (Latest) (default): https://docs.nvidia.com/nim/large-language-models/2.1.7/llms.txt
> - 2.1.6: https://docs.nvidia.com/nim/large-language-models/2.1.6/llms.txt
> - 2.1.5-pb7: https://docs.nvidia.com/nim/large-language-models/2.1.5-pb7/llms.txt
> - 2.1.5: https://docs.nvidia.com/nim/large-language-models/2.1.5/llms.txt
> - 2.1.4: https://docs.nvidia.com/nim/large-language-models/2.1.4/llms.txt
> - 2.0.13: https://docs.nvidia.com/nim/large-language-models/2.0.13/llms.txt
> - 2.0.12: https://docs.nvidia.com/nim/large-language-models/2.0.12/llms.txt
> - 2.0.11: https://docs.nvidia.com/nim/large-language-models/2.0.11/llms.txt
> - 2.0.10: https://docs.nvidia.com/nim/large-language-models/2.0.10/llms.txt
> - 2.0.4-pb6: https://docs.nvidia.com/nim/large-language-models/2.0.4-pb6/llms.txt
> - Archive: https://docs.nvidia.com/nim/large-language-models/archive/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nim/large-language-models/llms.txt.

# Multi-Node Deployment

> Run very large models across multiple physical nodes when a single node's GPU capacity is not enough for NIM for LLMs inference.

Multi-node deployment distributes a model across physical nodes when a single node lacks sufficient GPU capacity.

NIM LLM and VLM uses [Ray](https://docs.ray.io/) to form a cluster and [vLLM](https://docs.vllm.ai/) to distribute inference across it.

Multi-node deployment splits model weights across nodes using two parallelism strategies:

* **Pipeline Parallelism (PP)** splits a model into stages. For example, PP=2 can place one stage on each of two nodes.
* **Tensor Parallelism (TP)** splits model layers across the GPUs in each stage. For example, TP=8 uses eight GPUs per stage.

The most common configuration sets the tensor-parallel size to the number of GPUs per node and the pipeline-parallel size to the number of nodes.

A topology with two nodes and eight GPUs each can use these settings:

* TP = 8 (8 GPUs per node)
* PP = 2 (2 nodes)
* Total GPUs = 16

In some cases, *multi-node tensor parallelism* is used instead, where a single tensor-parallel group spans multiple physical nodes:

* TP = 16
* PP = 1
* Node A: 8 GPUs, Node B: 8 GPUs
* One TP group spans 2 nodes with 16 GPUs total

> **Note**
>
> Multi-node TP requires continuous cross-node GPU communication. Performance depends on network bandwidth, latency, and Remote Direct Memory Access (RDMA) availability.

## Known Limitations

Multi-node Ray workers cannot use the NIM JSON log formatter.

> **Warning**
>
> **Disable structured (JSON) logging for multi-node deployments.** Set `model.jsonLogging=false` in Helm values. The NIM JSON log formatter is not available in the backend's Ray worker processes and causes worker initialization to fail.

## Architecture

NIM multi-node deployments run the same container image in leader and worker pods. The
leader starts a Ray head node, downloads the model, and launches vLLM with the Ray
distributed executor. Worker pods join the Ray cluster and provide GPU resources for
model execution.

The following diagram shows this architecture:

```mermaid
flowchart LR
    subgraph Leader["Leader Node"]
        RH["Ray Head"]
        ENGINE["Inference Server<br />(vLLM)"]
    end

    subgraph Worker1["Worker Node 1"]
        RW1["Ray Worker"]
        GPU1["GPUs"]
    end

    subgraph Worker2["Worker Node N"]
        RW2["Ray Worker"]
        GPU2["GPUs"]
    end

    RH <-->|"Ray cluster"| RW1
    RH <-->|"Ray cluster"| RW2
    ENGINE -->|"NCCL"| GPU1
    ENGINE -->|"NCCL"| GPU2

    style Leader fill:#76b900,stroke:#333,color:#fff
    style Worker1 fill:#1a1a2e,stroke:#333,color:#fff
    style Worker2 fill:#1a1a2e,stroke:#333,color:#fff
```

## Prerequisites

Before you deploy NIM in multi-node mode, complete the following prerequisites:

1. Provision a Kubernetes cluster with GPU nodes, where each node has the same number and type of GPUs.

2. Install the [LeaderWorkerSet](https://github.com/kubernetes-sigs/lws) CRD on the cluster. LeaderWorkerSet is a Kubernetes-native mechanism for managing leader/worker pod groups:

   ```bash
   kubectl apply --server-side -f https://github.com/kubernetes-sigs/lws/releases/latest/download/manifests.yaml
   ```

3. Provide shared storage (recommended): a PVC with `ReadWriteMany` access mode or an NFS mount, so the leader downloads the model once and shares it with workers.

4. Provide high-speed networking (recommended): InfiniBand or [RDMA over Converged Ethernet (RoCE)](https://docs.nvidia.com/networking-ethernet-software/cumulus-linux-516/Layer-1-and-Switch-Ports/Quality-of-Service/RDMA-over-Converged-Ethernet-RoCE/) for optimal NCCL performance in multi-node configurations.

5. Confirm sufficient GPU resources across all nodes to satisfy the TP × PP requirement.

6. Fetch and extract the chart by following [Fetch the Helm Chart](/nim/large-language-models/2.1.5-pb7/deployment/kubernetes-deployment/helm-k8s#fetch-the-helm-chart).

7. Create the `ngc-secret` registry secret and the `nvidia-nim-secrets` API key
   secret by following [Create NGC Credentials](/nim/large-language-models/2.1.5-pb7/deployment/kubernetes-deployment/helm-k8s#helm-k8s-ngc-credentials). Use the namespace
   where you will install the chart.

8. For a gated Hugging Face checkpoint, accept its access terms, export
   `HF_TOKEN`, and create the source credential in the same namespace:

   ```bash
   kubectl create secret generic hf-token --from-literal=HF_TOKEN="$HF_TOKEN"
   ```

## Deploy with Helm

The NIM LLM and VLM Helm chart natively supports multi-node deployments using LeaderWorkerSet. Use the following sections to install a minimal chart, review the multi-node Helm values, and choose a model profile.

### Minimal Configuration

To deploy a minimal multi-node Helm example, complete the following steps:

1. Create `values.yaml` with the topology below. Set `model.modelPath` to a
   compatible checkpoint for your GPU configuration and set the shared storage
   class and size for the model's cache. If the checkpoint requires a Hugging
   Face token, set `model.hfTokenSecret: hf-token`.

   ```yaml
   image:
     repository: "nvcr.io/nim/nvidia/model-free-nim-pb7"
     tag: "2.1.5-pb7.0"

   model:
     modelPath: "<compatible-model-uri>"
     ngcAPISecret: nvidia-nim-secrets
     jsonLogging: false

   imagePullSecrets:
     - name: ngc-secret

   multiNode:
     enabled: true
     workers: 1                  # Number of worker pods (total nodes = workers + 1 leader)
     tensorParallelSize: 8       # GPUs per tensor-parallel group
     pipelineParallelSize: 2     # Number of pipeline stages (typically = number of nodes)

   resources:
     limits:
       nvidia.com/gpu: 8
     requests:
       nvidia.com/gpu: 8

   persistence:
     enabled: true
     size: "<cache-size>"
     accessMode: ReadWriteMany   # Required for multi-node with shared storage
     storageClass: <your-rwx-storage-class>
   ```

2. Install the chart:

   ```bash
   helm install nim-llm nim-llm/ -f values.yaml
   ```

### Helm Values Reference

Use the following Helm values to configure multi-node deployment behavior, model profile selection, and Ray communication settings.

| Parameter                        | Description                                                                                                                                           | Default |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `multiNode.enabled`              | Enable multi-node deployment mode                                                                                                                     | `false` |
| `multiNode.workers`              | Number of worker pods per replica                                                                                                                     | `1`     |
| `multiNode.tensorParallelSize`   | Number of GPUs per tensor-parallel group (sets `NIM_TENSOR_PARALLEL_SIZE`). Set to `0` to omit.                                                       | `0`     |
| `multiNode.pipelineParallelSize` | Number of pipeline stages across nodes (sets `NIM_PIPELINE_PARALLEL_SIZE`). Set to `0` to omit.                                                       | `0`     |
| `multiNode.expertParallelSize`   | Expert-parallel group size for MoE models (sets `NIM_EXPERT_PARALLEL_SIZE`). NIM system-config validation enforces `ep == tp*dp`. Set to `0` to omit. | `0`     |
| `multiNode.dataParallelSize`     | Data-parallel replicas (sets `NIM_DATA_PARALLEL_SIZE`). Set to `0` to omit.                                                                           | `0`     |
| `multiNode.ray.port`             | Ray head node communication port                                                                                                                      | `6379`  |
| `model.profile`                  | Explicit profile name or hash (alternative to TP/PP values). Sets `NIM_MODEL_PROFILE`.                                                                | `""`    |
| `model.hfTokenSecret`            | Kubernetes secret name containing `HF_TOKEN` for Hugging Face model downloads.                                                                        | `""`    |

### Profile Selection

You must specify how the model profile is selected. Choose **one** of these approaches:

#### Option A: TP/PP Values (Recommended)

Set `multiNode.tensorParallelSize` and `multiNode.pipelineParallelSize` directly. The Helm chart injects `NIM_TENSOR_PARALLEL_SIZE` and `NIM_PIPELINE_PARALLEL_SIZE` environment variables, and the correct profile is selected automatically.

Use the values in [Minimal Configuration](#minimal-configuration) and size the
GPU requests to match the selected topology.

#### Option B: Explicit Profile

Set `model.profile` to the description or full ID of a profile that supports
your topology. Get it from `list-model-profiles` for the image and model you
plan to deploy. Omit the TP and PP overrides from `values.yaml` and allocate
enough GPUs per pod for the chosen profile.

> **Warning**
>
> Multi-node deployment requires either `tensorParallelSize`/`pipelineParallelSize` (both >0) **or** `model.profile` to be set. The Helm chart will fail to render if neither is provided.

## Configure Model Storage

The leader and all worker nodes must have access to the model weights at the same filesystem path. There are two supported approaches:

### Shared Storage (Recommended)

Use a PVC with `ReadWriteMany` access mode or NFS. With shared storage:

* The **leader** downloads the model once to the shared volume.
* **Workers** detect the cached model blobs in shared storage and materialize a local workspace at `/tmp/nim_workspace` without a network download.

The Helm chart supports two shared storage backends:

* **PVC with `existingClaim`**: Pre-create a `ReadWriteMany` PVC. The PVC survives `helm uninstall`, so the model cache persists across deployments and subsequent installs skip the download.
* **NFS direct mount**: Set `nfs.enabled=true` with `nfs.server` and `nfs.path`. Same persistence behavior as PVC.

The following example shows a PVC-based configuration:

```yaml
persistence:
  enabled: true
  size: 200Gi
  accessMode: ReadWriteMany
  storageClass: <your-rwx-storage-class>
```

> **Warning**
>
> If persistence is enabled, `accessMode` must be `ReadWriteMany`. A `ReadWriteOnce` PVC cannot be mounted on multiple nodes.

### Independent Downloads

If shared storage is not available, each node downloads the model independently to local storage (`emptyDir`). This works but is **not recommended** because it wastes time and network bandwidth.

> **Note**
>
> Model-free NIM deployments (using `model.modelPath`) support both shared and independent storage. However, shared storage is strongly recommended for multi-node deployments.

## Deploy with the NIM Operator

The [NIM Operator](https://docs.nvidia.com/nim-operator/) provides a fully automated deployment experience for multi-node NIM. The operator manages the `NIMService` custom resource and automatically:

* Generates leader and worker pod specifications
* Injects the appropriate Ray startup commands
* Handles PVC setup through `NIMCache`
* Manages probes, networking, and secrets

Refer to the [NIM Operator Deployment](/nim/large-language-models/2.1.5-pb7/deployment/kubernetes-deployment/nim-operator-deployment) documentation for full details on deploying with the NIM Operator.

## Review Multi-Node Examples

Use the following examples to configure common multi-node deployments with different tensor and pipeline parallelism settings.

### Multi-Node Tensor Parallelism (TP=16, PP=1)

Two nodes, each with eight GPUs. A single TP group spans both nodes. Apply these overrides to the minimal configuration for a model and hardware that support this topology.

```yaml
multiNode:
  enabled: true
  workers: 1
  tensorParallelSize: 16
  pipelineParallelSize: 1
```

> **Note**
>
> Multi-node TP requires high-bandwidth, low-latency interconnect (for example, InfiniBand with RDMA) for acceptable performance.

### Model-Free Multi-Node Deployment

This example uses Llama 3.1 405B from Hugging Face to show the Model-Free
configuration for two nodes with eight GPUs per node. Before installing with
Helm, confirm your checkpoint fits the selected GPUs and set a shared storage
class and capacity.

```yaml
image:
  repository: "nvcr.io/nim/nvidia/model-free-nim-pb7"
  tag: "2.1.5-pb7.0"

model:
  modelPath: "hf://meta-llama/Llama-3.1-405B-Instruct"
  ngcAPISecret: nvidia-nim-secrets
  hfTokenSecret: hf-token
  jsonLogging: false

multiNode:
  enabled: true
  workers: 1
  tensorParallelSize: 8
  pipelineParallelSize: 2

resources:
  limits:
    nvidia.com/gpu: 8
  requests:
    nvidia.com/gpu: 8

persistence:
  enabled: true
  size: 1Ti
  accessMode: ReadWriteMany
  storageClass: "<your-rwx-storage-class>"

imagePullSecrets:
  - name: ngc-secret
```

## Troubleshoot Multi-Node Deployments

Use the following checks when leader or worker pods fail to form a Ray cluster, download a model, or schedule GPUs.

### Workers Cannot Join the Ray Cluster

Use the following checks if workers cannot join the Ray cluster:

* Verify that the Ray port (default `6379`) is accessible between pods. Check network policies.
* Ensure that `LWS_LEADER_ADDRESS` is being injected correctly by the LeaderWorkerSet controller.
* Check worker logs for Ray connection errors:

  ```bash
  kubectl logs "your-worker-pod-name"
  ```

### Model Download Failures

Use the following checks if model downloads fail:

* Confirm that `NGC_API_KEY` is set correctly in the referenced secret.
* If using shared storage, verify the PVC is bound and has `ReadWriteMany` access mode.
* Check that the storage class supports the required access mode.

### NCCL Communication Errors

Use the following checks if NCCL communication errors occur:

* For multi-node TP, ensure high-speed interconnect (InfiniBand/RoCE) is available and configured.
* Verify that NCCL environment variables are set appropriately for your network topology. You can pass these via `env` in `values.yaml`:

  ```yaml
  env:
    - name: NCCL_IB_DISABLE
      value: "0"
    - name: NCCL_DEBUG
      value: "INFO"
  ```

### Pod Scheduling Issues

Use the following checks if pods cannot be scheduled:

* Verify that each node has the required GPU resources available.
* Check that `nodeSelector`, `affinity`, or `tolerations` are configured correctly for GPU nodes.
* Confirm that `nvidia.com/gpu` resource requests match the available GPUs per node.

## Next Steps

Continue with operator-managed multi-node, profile selection, or single-node Helm:

* [NIM Operator Deployment](/nim/large-language-models/2.1.5-pb7/deployment/kubernetes-deployment/nim-operator-deployment) — Automated multi-node NIMService deployments
* [Model Profiles and Selection](/nim/large-language-models/2.1.5-pb7/deployment/model-profiles-and-selection) — Profile names for TP and PP
* [Helm and Kubernetes](/nim/large-language-models/2.1.5-pb7/deployment/kubernetes-deployment/helm-k8s) — Single-node Helm values and probes