Deploying Large Language Models on a 4-Node GPU Cluster: Architecture and Best Practices
A practical guide to deploying large Mixture-of-Experts models on a 4-node on-premises GPU cluster, covering unified memory planning, switched-star networking with RDMA, parallelism strategies, stress testing methods, and common troubleshooting tips.
Introduction
Enterprises deploying large language models increasingly face constraints around data compliance, internal network isolation, and response latency. Running models in your own data center or private environment keeps data within your internal boundary and lets you schedule compute flexibly according to business workloads. However, large Mixture-of-Experts (MoE) models often exceed the memory capacity of a single server, making it difficult for a single-machine setup to meet throughput, latency, and concurrency requirements at the same time.
Multi-node distributed inference has therefore become a common choice for private deployment. It partitions model weights across multiple compute nodes, which coordinate over high-speed networking to complete each inference request. The effectiveness of such a solution depends on design at four levels: compute nodes and memory planning, inter-node interconnect, model loading and parallelism strategy, and the operations and stress-testing system. This article walks through these areas in order and provides a reusable evaluation framework.
1. Deployment Architecture Design
1.1 Compute Node Selection
Compute nodes are the fundamental building blocks of the cluster. Three categories of resources should be considered when selecting them:
- Compute capability: Focus on effective performance at low precision (such as FP8 or FP4) rather than peak floating-point numbers. LLM inference bottlenecks often occur in memory access rather than computation.
- Memory capacity and bandwidth: Model weights, KV cache, and intermediate activations all consume VRAM or unified memory. Insufficient capacity prevents the model from loading at all; insufficient bandwidth slows down every decoding step.
- Local storage: Weight files typically reach hundreds of gigabytes, and loading speed directly affects service cold-start time. High-speed local NVMe storage shortens loading time and makes it convenient to cache some offline data.
Take a 4-node cluster as an example: if each node provides roughly 128 GB of unified memory, the cluster totals about 512 GB of available memory. The capacity actually usable for model weights must account for the operating system, runtime, and cache overhead—typically only 70–80% of the total can be used.
1.2 Unified Memory and Tiered Storage
A unified memory architecture lets the CPU and GPU share the same physical memory, reducing the overhead of copying data between the two types of memory. On top of this, a tiered storage strategy can be adopted:
- Hot data in memory: Frequently accessed weight shards and the KV cache of active sessions stay in memory to keep the inference path low-latency.
- Warm data on local SSD: Less frequently accessed lookup tables, vocabulary extensions, and some indexes can be offloaded to NVMe storage and loaded on demand via prefetching.
- Cold data on shared storage: Model versions, logs, and evaluation datasets reside in shared storage, scheduled centrally by the management platform.
The key to tiering lies in prefetch and eviction policies. If prefetching is not timely, inference threads get blocked on disk I/O; if eviction is too aggressive, the same batch of requests repeatedly reads the same data. Before going live, replay tests with real request distributions to tune cache size and the prefetch window.
1.3 Switched-Star Networking and RDMA
Multi-node inference generates heavy communication traffic. Tensor parallelism requires collective communication at every layer, so inter-node bandwidth and latency directly determine throughput. Two common networking topologies exist:
- Point-to-point direct connection: Nodes interconnect pairwise. The topology is complex, and cabling costs grow quickly when scaling.
- Switched-star topology: All nodes connect to the same high-speed switch, so any two nodes are only one hop apart.
This article adopts the second approach. The switch port rate should match the NIC rate. For example, if each node NIC tops out at 200 Gbps per port, a switch with 400 G-class ports can support concurrent communication across multiple nodes.
To further reduce communication latency, enable RDMA (Remote Direct Memory Access). RDMA allows the NIC to directly read and write remote memory, bypassing the kernel’s data copy path, which lowers CPU usage and communication latency. In Ethernet environments, RDMA over Ethernet can be used, provided the switch has lossless networking features enabled, including flow control and congestion management.
2. Model Deployment Workflow
2.1 Weights and Precision Selection
The defining characteristic of MoE models is a very large total parameter count, with only a subset of experts activated per inference. Key considerations during deployment:
- Precision format: Officially released mixed-precision weights reduce memory footprint while preserving output quality. Confirm the precision details provided by the model publisher before deployment, and avoid arbitrary quantization that may introduce accuracy loss.
- Weight sharding: Expert layers are usually sharded across nodes along the expert dimension. Note that the sharding of attention layers and shared layers must be consistent with the parallelism strategy.
- Context length: Long contexts significantly increase KV cache usage. Set the maximum context window based on the longest actual input and output lengths in your business, rather than directly using the theoretical maximum.
2.2 Inference Engine and Parallelism Strategy
Mainstream open-source inference engines generally support tensor parallelism, pipeline parallelism, and expert parallelism. In multi-node scenarios, a typical combination is:
- Tensor parallelism within a node, taking full advantage of high-speed intra-node interconnect;
- Pipeline parallelism or expert parallelism across nodes, reducing the frequency of cross-node communication;
- Continuous batching at the scheduling layer to improve GPU utilization.
An illustrative deployment configuration is shown below (field names are for explanatory purposes; refer to the actual engine documentation):
cluster:nodes: 4network: switched-star # switched-star topologytransport: rdma # high-speed inter-node transportserving:tensor_parallel_size: 4 # parallelism size of a single model replicamax_model_len: 131072 # set based on the longest business input/outputmax_num_seqs: 64 # maximum concurrent sequencesgpu_memory_utilization: 0.85 # reserve headroom for the runtimeweights:path: /data/models/moe-model # weights stored on local NVMedtype: mixed-fp8-fp4
After configuration, start the service with a single request first, confirm the model has loaded and the communication links are healthy, and only then gradually increase concurrency.
2.3 Unified Management and Service Exposure
Operating a multi-node cluster is far more complex than a single machine. A unified management platform should handle the following:
- Model version management, recording each version’s weight hash, configuration, and test results;
- Service orchestration, launching inference processes uniformly and handling automatic restarts after node failures;
- Gateway access, exposing an API compatible with mainstream calling formats, with authentication, rate limiting, and auditing;
- Monitoring and alerting, collecting metrics such as GPU utilization, memory, network bandwidth, and request latency.
The interface layer should use a standard HTTP service with API keys or stricter authentication. Internal and external callers should use different credentials to simplify tracking and revocation.
3. Performance Evaluation Methodology
The purpose of performance testing is to answer three questions: Can this cluster support the target business concurrency? Does per-request response meet user experience requirements? Is resource utilization reasonable?
3.1 Scenario Breakdown
Different workloads place very different demands on the model, so test each scenario separately:
- Everyday Q&A: Short input and short output; focus on time-to-first-token and single-request experience.
- Document processing: Long input; focus on prefill-stage throughput and stability under long contexts.
- Complex reasoning tasks: Long output; focus on decoding speed and resource usage during extended runs.
- Coding and agent tasks: Multi-turn calls with long tool-return content; focus on latency changes as context accumulates and error rates under concurrency.
3.2 Key Metrics
- Time to First Token (TTFT): The time from sending a request to receiving the first output token; directly affects perceived responsiveness.
- Token generation speed (TPOT or throughput): Tokens generated per second; determines how long long answers take to complete.
- Concurrency and queuing: Success rate and queueing time at the target concurrency level.
- Resource metrics: Peak memory usage, inter-node communication bandwidth, CPU and storage I/O utilization.
Test reports should include percentiles (such as P50, P95, P99), because averages hide tail latency.
3.3 Stress Testing Method
Follow these steps:
- Build the test set from real or desensitized business requests so input length distribution matches production;
- Start at low concurrency and increase step by step, recording metrics at each level;
- Collect data only after the service has run stably for at least several hours, to observe the effects of cache warm-up and memory fragmentation;
- Deliberately disconnect one node’s network to verify degradation and recovery behavior.
An illustrative stress-test skeleton, using the standard library to compute latency percentiles:
import statisticsimport timedef measure(send_request, prompts, concurrency=8):latencies = []for prompt in prompts:start = time.perf_counter()send_request(prompt) # call the local inference servicelatencies.append(time.perf_counter() - start)latencies.sort()p50 = statistics.median(latencies)p95 = latencies[int(len(latencies) * 0.95) - 1]return {"p50_s": round(p50, 3), "p95_s": round(p95, 3)}
Actual stress testing should use a concurrency-capable load-testing tool; the code above only illustrates the statistical methodology.
4. Common Issues and Optimization Approaches
4.1 Excessively Long Loading Times
Weight files are large, and the first load can take tens of minutes. Optimizations include: placing weights on local high-speed storage, reading shards in parallel, pre-distributing weights across nodes, and maintaining a fast recovery path for service restarts.
4.2 Inter-Node Communication Becomes a Bottleneck
If tensor parallelism communication overhead is too high, reduce the parallelism degree and switch to pipeline parallelism; also check the switch’s flow control configuration to avoid retransmissions caused by packet loss. Communication metrics should be monitored alongside compute metrics.
4.3 Insufficient Memory Under Long Contexts
The most direct fix is to set the maximum context length to actual business needs and cap the maximum number of concurrent sequences. For long-document scenarios, split documents first and process them in segments to reduce per-request context size.
4.4 Performance Degradation Over Extended Runs
During sustained operation, cache fragmentation and memory allocation patterns cause gradual performance decline. Set up periodic health checks and rolling restarts, and use monitoring curves to determine an appropriate restart cadence.
5. Selection and Rollout Recommendations
Before committing to multi-node private deployment, answer these questions:
- What are the peak and average concurrency levels of your business?
- Do data compliance requirements mandate full on-premises processing, or can some content be processed in a controlled environment?
- Does the team have the operational capability for distributed inference, including network tuning, troubleshooting, and version management?
- How does total cost of ownership compare to single-machine or cloud-hosted solutions? Include hardware depreciation, power, facilities, and labor.
If business concurrency is low and data boundary requirements are not strict, a single-machine or cloud-hosted solution is usually simpler. If concurrency is high, data must stay internal, and the team can maintain a cluster, then a multi-node solution with switched-star networking and unified memory is worth evaluating.
For rollout, proceed in three steps: validate with small-scale traffic first, then size capacity based on stress-test data, and finally establish long-term monitoring and version iteration processes. Keep a rollback path at every step to ensure a smooth business transition.
