Multi-Node Cluster Deployment for Private LLM Inference: A Practical Guide

    This guide explains how to plan and deploy a multi-node cluster for private large language model inference. It covers why a single server is often insufficient, how to estimate memory capacity for weights, KV cache, and runtime overhead, how to design a tiered memory and NVMe storage strategy, how to plan high-speed interconnects with RDMA and lossless Ethernet, how to choose parallelism strategies, and how to execute a step-by-step deployment process from environment checks to service exposure through a gateway.

    1. Why LLM Inference Needs a Multi-Node Cluster

    A single server struggles to host very large models for three main reasons: model weights consume large amounts of GPU memory or RAM, the KV cache during inference grows with context length and concurrency, and the runtime also needs headroom for activations, communication buffers, and system services. Combined, these demands typically exceed what one machine can provide.

    Mixture of Experts (MoE) models are a special case. They contain many expert sub-networks, and each token activates only a small fraction of them, so the compute per token is far lower than what the total parameter count would suggest. However, at inference time all expert weights must reside in quickly accessible storage; otherwise, whichever expert a token is routed to has to be loaded on the fly, and latency spikes dramatically. This means the bottleneck for MoE models is usually capacity and memory bandwidth rather than raw compute.

    Enterprises choose private deployment for reasons such as keeping data within their own domain, predictable response latency, predictable call costs, and model customizability. A multi-node cluster is a common solution under these constraints: scale out horizontally to distribute weights and cache across multiple machines, then serve requests through a unified scheduling layer.

    2. Capacity Planning: Calculate Memory First, Then Choose Node Count

    Cluster sizing should start from a capacity formula, not from device specifications. A practical estimation framework is:

    Total requirement = weight footprint + KV cache footprint + runtime overhead

    1. Weight footprint

    Weight footprint is determined by parameter count and numeric precision. Estimating at 1 byte per parameter, in 8-bit floating-point format the weights roughly equal the parameter count (in billions) in GB; 16-bit formats double that. 4-bit quantization compresses further but introduces accuracy loss, which must be validated through evaluation.

    Below is a worked example. The numbers are hypothetical and do not represent any specific model:

    • Assume 300 billion total parameters. At 8-bit precision, weights are roughly 300 GB.
    • At 16-bit precision, weights are roughly 600 GB, and the required node count increases significantly.

    2. KV cache footprint

    The KV cache size is approximately:

    2 × number of layers × number of KV heads × per-head dimension × context length × bytes per element × concurrent requests

    The longer the context, the larger the cache. In long-context scenarios, the KV cache can even exceed the weights themselves. Therefore, capacity planning must fix both the maximum context length and the target concurrency. Some models use attention architecture optimizations that significantly reduce the number of KV heads; these optimizations should be reflected in the estimate rather than blindly applying the generic formula.

    3. Runtime overhead

    Reserve 10% to 30% of capacity for the runtime, covering activations, communication buffers, fragmentation, and system processes.

    Example calculation

    Assume a single node has 128 GB of memory available for the model, weights are about 300 GB, and KV cache plus runtime overhead total about 100 GB, for a total requirement of roughly 400 GB. Split across four nodes, each node carries about 100 GB, leaving about 28 GB of headroom—enough for basic needs. If concurrency doubles or context length increases substantially, that headroom is quickly exhausted, and you need to add nodes or reduce precision.

    3. Tiered Strategy for Unified Memory and High-Speed Storage

    Many newer compute platforms use a unified memory architecture where the CPU and acceleration units share the same physical memory pool. This reduces data copying, but capacity is still limited. When model weights and cache exceed the memory ceiling, NVMe storage can be introduced as a second tier.

    The core principle of tiered design is distinguishing hot data from cold data:

    • Hot data: content accessed at every inference step—such as attention layer weights, frequently used expert weights, and active KV cache—should stay resident in memory.
    • Warm data: content accessed at moderate frequency can sit in memory with prefetching strategies.
    • Cold data: infrequently accessed or bulk-readable content, such as certain lookup structures or rarely used configurations, is suitable for NVMe storage.

    Access latency matters here. NVMe reads have far higher latency and lower bandwidth than memory access, so if hot data is mistakenly placed in the storage tier, inference latency increases noticeably. In practice, use profiling to confirm the access patterns of each data category before deciding on a tiering plan.

    The storage tier also requires attention to prefetching and cache replacement policies. If prefetching is not timely, compute units stall waiting for data; if the replacement policy is poor, hot data gets evicted repeatedly. Both problems are especially pronounced in long-context and high-concurrency scenarios.

    4. High-Speed Interconnect Network Design

    Multi-node inference places much higher demands on the network than ordinary business traffic. Key metrics include bandwidth, latency, and packet loss rate.

    4.1 Direct Connection vs. Switched Topology

    Dimension Direct node-to-node links Switched star topology
    Topology complexity Cabling grows sharply as node count increases Clear topology; new nodes simply connect to the switch
    Forwarding load Intermediate nodes may carry forwarding traffic Nodes do not relay data; the switch handles forwarding
    Fault localization Requires checking links one by one Quickly located via switch port statistics
    Scalability Limited by physical interface count Limited by switch port count and bandwidth

    For a four-node cluster, both approaches are feasible. The switched topology offers a uniform structure with lower operational and expansion costs, but the switch itself becomes a critical device whose redundancy and bandwidth ceiling must be evaluated.

    4.2 RDMA and Lossless Ethernet

    Remote Direct Memory Access (RDMA) lets nodes read and write each other’s memory directly, bypassing the operating system network stack to reduce latency and CPU overhead. RDMA over Ethernet is commonly known as RoCE. With this approach, the network should be as lossless as possible; otherwise packet loss triggers retransmission and causes jitter in collective communication latency.

    Common configuration practices include:

    • Enable Priority Flow Control (PFC) to reserve a dedicated queue for RDMA traffic and reduce congestion-related packet loss.
    • Enable Explicit Congestion Notification (ECN) so senders slow down at the early stage of congestion.
    • Assign inference traffic to a dedicated VLAN or priority to avoid interference with management traffic.
    • Unify MTU settings to avoid the performance penalty of fragmentation.

    Run connectivity and bandwidth tests both before and after configuration. Measure point-to-point bandwidth, many-to-many concurrent bandwidth, and latency distributions separately—don’t rely on averages alone.

    4.3 Communication Volume vs. Parallelism Strategy

    The communication volume of multi-node inference depends on the parallelism approach:

    • Tensor parallelism: requires a global reduction after each layer’s computation, so communication is frequent and latency-sensitive. During decoding, each step carries small amounts of data but at high frequency, and latency jitter shows up directly in per-token output intervals.
    • Pipeline parallelism: nodes only exchange inter-layer activations, so communication is infrequent, but it introduces pipeline bubbles. It suits throughput-first scenarios.
    • Expert parallelism: in MoE models, different experts live on different nodes, and after routing, tokens must be dispatched and collected—an irregular all-to-all exchange pattern that demands strong load-balancing capability from the network.

    Therefore, when choosing a parallelism strategy, consider network conditions and business goals together. When bandwidth is ample and latency is stable, tensor parallelism works well; when network conditions are mediocre or nodes are far apart, consider hybrid parallelism.

    5. Parallel Sharding and Inference Service Configuration

    5.1 Configuration Highlights

    Key inference service parameters typically include parallelism size, maximum context length, memory utilization ceiling, numeric precision, maximum concurrency, and batching policy. Below is a generic parameter illustration; refer to the documentation of your chosen inference framework for exact parameter names:

    1. inference:
    2. model_path: /data/models/moe-model
    3. dtype: fp8
    4. tensor_parallel_size: 4
    5. pipeline_parallel_size: 1
    6. max_model_len: 131072
    7. gpu_memory_utilization: 0.90
    8. max_num_seqs: 64
    9. enable_prefix_caching: true
    10. scheduler:
    11. policy: continuous_batching
    12. max_batched_tokens: 8192

    A few parameters deserve elaboration:

    • max_model_len determines the KV cache reservation ceiling. Setting it too large consumes significant memory; setting it too small rejects long requests. Base it on the business distribution rather than the theoretical maximum.
    • gpu_memory_utilization controls the fraction of memory the inference engine may occupy. Leaving headroom avoids out-of-memory failures caused by fragmentation or burst requests during operation.
    • enable_prefix_caching is highly effective in scenarios with many repeated prefixes (such as fixed system prompts or multi-turn conversations), reducing redundant prefill computation.
    • Continuous batching allows new requests to dynamically join an in-flight batch, effectively improving throughput at the cost of increased scheduling complexity.

    5.2 Precision Selection

    Numeric precision directly affects capacity and quality. A common approach is to establish a baseline with the original precision, then progressively try lower precisions and compare output quality on the same evaluation set. The evaluation set should cover different task types—factual QA, long-text comprehension, code generation, and multi-step reasoning—since relying on a single metric easily leads to one-sided conclusions.

    6. Deployment Process

    Deployment can be divided into six stages.

    Step 1: Environment checks

    Verify each node’s driver version, system kernel parameters, clock synchronization status, and network connectivity. Excessive clock skew affects distributed startup and log tracing.

    1. # Check inter-node connectivity and latency
    2. for host in node01 node02 node03 node04; do
    3. ping -c 4 -q "$host"
    4. done
    5. # Check error counters on the network interface
    6. ip -s link show eth0

    Step 2: Weight distribution and verification

    Model weights are large and prone to corruption during distribution. Generate a checksum for each file and verify them one by one after distribution.

    1. # Generate the checksum file
    2. sha256sum /data/models/moe-model/*.safetensors > checksums.txt
    3. # Verify on the target node
    4. sha256sum -c checksums.txt

    Step 3: Distributed startup

    Start the coordinator process first, then start worker processes on each node in sequence, and wait until all nodes have registered before accepting requests. Startup scripts should include timeouts and retries to prevent one stuck node from hanging the entire cluster.

    Step 4: Health checks

    Health checks should cover three categories: whether processes are alive, whether memory is allocated normally, and whether a complete forward pass returns within a time limit. Checking process liveness alone is insufficient, because a node may be in a partially failed state.

    Step 5: Service exposure and gateway

    External access typically goes through a unified gateway that handles authentication, rate limiting, request auditing, and routing. It is recommended to expose a mainstream conversational HTTP API so upper-layer applications can integrate easily.

    ```bash
    curl -s http://gateway.internal:8080/v1/chat/completions \
    -H “Authorization: Bearer ${API_TOKEN}” \
    -H “Content-Type: application/json” \
    -d ‘{
    “model”: “moe-model”,
    “messages”: