How to Build, Tune, and Operate a 4-Node LLM Inference Cluster

    A practical engineering guide to standing up a four-node distributed large language model inference cluster for private deployment. It covers the four-layer architecture (compute, network, storage, service governance), how to read hardware specs without confusing accelerator memory with host or pooled memory, a capacity planning checklist for MoE models (weights, KV cache, long-context concurrency limits, expert routing bandwidth, storage and logs), InfiniBand versus RoCEv2 selection with a pre-deployment checklist and troubleshooting directions for 400G RDMA networks, tensor/expert/pipeline parallelism tradeoffs, a recommended tuning order, monitoring thresholds with the actions each alert should trigger, and a rollout path with gray release, change windows, and compliance controls.

    Four-Node Distributed LLM Inference in Practice: An Engineering Guide from Selection to Production

    The core of private LLM inference is not stacking servers together. It is systems engineering driven by model size, context length, concurrency targets, and network conditions. For large MoE models, a four-node cluster fits mid-sized private deployments: it keeps data in-house and services under control, while balancing accelerator memory, host memory, RDMA networking, inference scheduling, and operational governance. This article lays out a reusable framework, with particular attention to hardware specification clarity, capacity estimation, RDMA check items, monitoring thresholds, and risk control.

    1. Overall Architecture: Four Coordinated Layers

    Layer Core responsibility Key checks
    Compute Model sharding, matrix computation, sampling, scheduling Accelerator memory, CPU core count, NUMA affinity, accelerator model
    Network Tensor parallelism, expert parallelism, cache synchronization Per-node NIC bandwidth, switch capacity, RDMA type
    Storage Model weights, KV cache, logs, cold data Hot/warm/cold tiering, SSD I/O, cache eviction policy
    Service governance API, authentication, rate limiting, auditing, canary release Monitoring and alerting, version rollback, resource metering

    The value of a four-node design is that a model can be split across nodes via tensor parallelism or expert parallelism, with requests coordinated across them after scheduling. It handles large-parameter models better than a single machine, and is easier to deploy and operate than a large-scale cluster.

    2. Hardware Configuration: First, Be Precise About “512GB”

    When evaluating a four-node cluster, it is not enough to write “high-bandwidth accelerators” and “512GB unified memory.” The following must be distinguished:

    1. Accelerator memory: on-board GPU/NPU memory used for weights, activations, and KV cache. Report it as “per-card memory × cards × nodes.”
    2. Host memory: memory accessible to the CPU, typically used for the framework runtime, CPU-side cache, parameter offloading, and log buffering.
    3. Pooled or unified memory: if formed via CXL, NVLink, or a software cache pool, state whether it is physical memory pooling, software-managed, or cross-node shared. Do not conflate it with accelerator memory or host memory.
    4. Local storage: usually high-speed SSD for model files, warm/cold data, logs, and archive cache.

    A verifiable configuration template follows. It is an example only; adjust it to your model size.

    • Nodes: 4 homogeneous compute nodes
    • CPU: roughly 80 cores total, with multi-NUMA scheduling support
    • Accelerators: high-bandwidth cards per node; at least 64GB per card, at least 256GB per node, at least 1TB across four nodes
    • Host memory or unified memory pool: roughly 512GB total, for runtime cache, CPU-side KV cache, and parameter offloading
    • Local storage: roughly 8TB of high-speed SSD total
    • Network: 200Gbps interface per node, forming an RDMA fabric through 400G-class switches
    • Inference engine: continuous batching, tensor parallelism, expert parallelism, prefix caching, and paged KV cache management

    Applicability boundary: this configuration suits MoE models with roughly 300B–700B total parameters, 10B–30B activated parameters, FP8/INT8/W4A8 quantization, and 32K–128K context. If total parameters exceed 1T, context exceeds 256K, or many models must coexist, re-evaluate memory, bandwidth, and caching strategy.

    3. Capacity Planning Checklist: Don’t Plan on Activated Parameters Alone

    A MoE model activates only some experts per inference pass, but capacity planning cannot look at activated parameters alone. Estimate each item below:

    1. Weight footprint — roughly “parameter count × bytes per parameter at the target quantization precision.” Under tensor or expert parallelism, weights are split or distributed across nodes. Reserve extra headroom for the framework runtime, communication buffers, and transient activation space; 10%–20% is a reasonable allowance.

    2. KV cache footprint — depends on layer count, KV head count, head dimension, precision, context length, and concurrency. A simplified form:

      KV cache bytes ≈ 2 × layers × KV heads × head dimension × bytes per element × sequence length × concurrency

      The factor of 2 accounts for K and V. In long-context workloads, KV cache is more often the bottleneck than weights.

    3. Long-context concurrency ceiling — divide available KV memory by average per-request KV usage, then multiply by a safety factor of 0.7–0.8. If the result is insufficient, enable paged caching, history compression, tiered queues, or cap extreme context lengths.

    4. Expert routing bandwidth — under expert parallelism, requests are dispatched to experts on different nodes and outputs are returned. Demand scales with tokens per second, number of activated experts, hidden dimension, data type, and the fraction of cross-node communication. Insufficient bandwidth makes compute units stall waiting for expert data, cutting throughput.

    5. Storage and log capacity — account for the number of model files, number of versions, log retention period, audit logs, and cold cache archiving. Long-term log retention requires rotation and redaction policies.

    4. 400G RDMA Networking: Selection and Checks

    In four-node distributed inference, the network is not an accessory; it is the performance core. Expert routing, tensor-parallel synchronization, and cache transfer all amplify network load.

    4.1 Choosing a technology path

    RDMA typically comes in two flavors:

    • InfiniBand: low latency and relatively self-contained operations; well suited to HPC and inference clusters, but higher cost and operational overhead.
    • RoCEv2: Ethernet-based and easy to merge with existing networks, but it depends on a lossless configuration and places heavy demands on PFC, ECN, and congestion control.

    With RoCEv2, confirm that switches and NICs support PFC, ECN, DCQCN, or another congestion control mechanism. With InfiniBand, confirm version compatibility across switches, NICs, drivers, and the subnet manager.

    4.2 Pre-deployment checklist

    • NIC/switch compatibility: verify firmware, drivers, PCIe slots, and GPUDirect RDMA support.
    • Link rate: confirm 200Gbps links negotiate per node with no downgraded ports.
    • RDMA subnet: confirm consistent GID, MTU, VLAN, routing, and subnet configuration.
    • Lossless configuration: check PFC priorities, ECN thresholds, queue scheduling, and congestion control parameters.
    • Traffic isolation: logically separate inference, management, and storage traffic so they do not contend with each other.
    • Baseline stress tests: validate point-to-point bandwidth and latency, then run collective tests such as allreduce and alltoall.
    • Failure drills: verify that single-link failures, single-NIC failures, and switch anomalies can be located quickly.

    4.3 Common problems and where to look

    If RDMA performance is unstable, check in this order: unexpected packet loss or retransmission, frequent PFC triggering, switch queue congestion, NIC link speed drops, inconsistent MTU, GPU and NIC on different NUMA nodes, and long-tail nodes in collective operations. A misconfigured RDMA fabric can cause inference latency jitter or even take an online service down, so validation must happen inside a change window.

    5. Inference Engine and Parallelism Strategy: Choose by Workload

    Strategy When to use Advantages Main cost Latency impact
    Tensor parallelism Heavy per-layer compute; the layer doesn’t fit on one node Reduces per-node memory pressure, raises intra-layer parallelism Frequent cross-node synchronization Poor networks push communication overhead into time-to-first-token
    Expert parallelism Large-scale MoE models Scales well; experts spread across nodes Routing imbalance and network load Uneven load raises tail latency
    Pipeline parallelism Many layers; insufficient per-node resources Lowers per-node resource usage Pipeline bubbles and scheduling complexity Efficiency drops when request lengths vary widely

    A four-node cluster commonly combines tensor and expert parallelism. The scheduler should support continuous batching, separation of long and short requests, priority queues, prefix cache reuse, dynamic batch size, and timeout circuit breaking. For interactive workloads, prioritize low first-token latency; for batch document processing, prioritize throughput.

    6. Tuning Order: Baseline First, Then Parallelism, Then Caching

    Tune in this order rather than raising parallelism immediately.

    1. Single-node stress test: confirm single-node accelerator memory, host memory, CPU, and local inference capability, and establish a baseline.
    2. Network baseline: measure inter-node bandwidth, latency, and collective performance to rule out network bottlenecks.
    3. Batching policy: keep batch size controlled for interactive use; push batch throughput for offline use.
    4. Parallelism adjustment: add tensor or expert parallel nodes incrementally and watch throughput and latency. If gains flatten, inspect communication overhead.
    5. Cache optimization: enable prefix caching for fixed system prompts, frequently used knowledge base fragments, and repeated prefixes.
    6. Long-context governance: queue very long requests separately, cap input length, compress conversation history, and enable paged KV cache management.
    7. Expert load balancing: monitor expert hit distribution; if skew is severe, adjust routing, add replicas, or revise model configuration.

    7. Monitoring and Alerting: From Metrics to Actions

    LLM inference monitoring cannot stop at CPU utilization. Set thresholds around performance, resources, and business risk. Cover at least the following:

    Metric Suggested threshold Action when triggered
    Accelerator memory utilization Alert above 90%; rate limit above 95% Reduce concurrency, cap context, add sharding
    Host memory or memory pool watermark Alert above 85% Check KV cache, eviction behavior, and leaks
    Request queue length Sustained alert above 80% of max concurrency Trigger degradation, scale out, or rate limit
    Time to first token (TTFT) P95 exceeds SLA by 20% Check network, batching, expert routing
    Time per output token (TPOT) P95 exceeds SLA by 20% Check batch size, memory bandwidth, scheduling stalls
    Expert load skew Hottest expert exceeds 1.5× the average Adjust routing, add replicas, or apply a balancing policy
    Network packet loss or retransmission Sustained rise in unexpected loss/retransmission Check RDMA, PFC, ECN, and link quality
    SSD I/O wait Read queue keeps climbing Check cold data offloading and log writes

    Monitoring is not just a dashboard; it should be wired into rate limiting, circuit breaking, scale-out, and rollback. For production, keep request-level tracing, but redact sensitive content.

    8. Rollout Path and Risk Control

    8.1 Pre-launch assessment

    Before launch, pin down concurrent user count, average input and output length, maximum context length, TTFT and TPOT targets, data sensitivity level, and multi-model coexistence requirements. Capacity planning must produce estimates for accelerator memory, host memory, KV cache, bandwidth, and storage — not just a hardware list.

    8.2 Canary release and rollback

    Model services should support canary release: internal traffic first, then a small slice of business traffic, then full production. Record the model version, quantization parameters, routing policy, and configuration changes with each release. If key metrics degrade, roll back to the last stable version quickly.

    8.3 Change risk control

    These changes must be made inside a change window with a rollback plan ready:

    • RDMA configuration changes, switch firmware upgrades, NIC driver upgrades
    • Memory pool parameters, KV cache limits, parallelism strategy changes
    • Cold data offload policy changes, to avoid SSD I/O amplification slowing online inference
    • Log level changes, to keep sensitive information out of ordinary logs

    8.4 Compliance and security

    Private deployment does not remove compliance risk by itself. Organizations should review model licenses, commercial-use restrictions, training data provenance, output compliance, and access control. The inference service should enforce authentication, transport encryption, call auditing, least privilege, and log redaction to prevent unauthorized access and data leakage.

    9. FAQ

    1. What is a four-node cluster suited for?
    Mid-sized private inference, especially long-context workloads, multi-model pilots, enterprise knowledge base Q&A, and internal coding assistance, where operational complexity must stay contained.

    2. What are the most common mistakes?
    Treating “512GB unified memory” as accelerator memory capacity; sizing only on activated parameters; ignoring lossless RDMA configuration; accepting unbounded long context; and skipping tail-latency and failure testing before launch.

    3. How do I know whether scaling out is worth it?
    Consider more nodes or a different quantization scheme only when accelerator memory and host memory stay high for extended periods, the queue backs up continuously, TTFT or TPOT repeatedly miss SLA, and tuning has not helped.

    10. Summary

    What makes a four-node distributed LLM inference cluster work is not raw hardware specification but a verifiable engineering loop: clear hardware definitions, executable capacity estimates, testable RDMA networks, observable inference scheduling, and reversible production operations. Design model size, context length, concurrency targets, network conditions, and risk boundaries together, and private LLM inference moves from proof of concept to stable production service.