Got a model that does not fit on one PC? llama.cpp can split it across several machines on your network. Its RPC backend lets a main host use the GPUs and RAM of other computers as if they were local devices.
A 70B model can run across a gaming PC, an old workstation and a Mac, with no cloud and no special cluster software.
This guide shows you how to set up distributed inference with llama.cpp RPC from scratch.
You will build with RPC enabled, start ggml-rpc-server on each worker, connect them from llama-server, control the split, speed up loading with the local cache, use RDMA, and keep the setup safe. It follows the official llama.cpp RPC docs as of December 2026.
- Build llama.cpp on every machine with
-DGGML_RPC=ONplus your GPU backend. - Workers: run
bin/ggml-rpc-server -H 0.0.0.0 -p 50052 -c. - Main host:
llama-server -m model.gguf -ngl 99 --rpc 192.168.1.10:50052,192.168.1.11:50052 - Split: automatic by free memory, or set with
--tensor-split. - Security: RPC is a proof of concept with no authentication. Use it only on a trusted private network.
What llama.cpp RPC Does
The RPC backend has two parts:
ggml-rpc-serverruns on each remote machine. It exposes that machine’s devices (each CUDA GPU, Metal, or the CPU if there is no accelerator) over TCP.- The RPC client is built into
llama-serverandllama-clion the main host. It treats every remote device as one more device next to your local GPUs.
By default, llama.cpp spreads model weights and the KV cache across all devices, local and remote, in proportion to each device’s free memory. The main host runs the API and orchestrates each step, while workers hold layers and compute their share.
Workers can mix backends. A main PC with CUDA can use a Mac’s Metal GPU and another PC’s CPU in the same run.
When RPC Is Worth It
RPC solves a memory problem, not a speed problem. Every token passes between machines, so network latency adds to each step.
| Situation | Use RPC? |
|---|---|
| The model does not fit on one machine at all | Yes, this is the main use case |
| The model fits but spills to slow system RAM | Maybe; test against MoE CPU offload first |
| The model fits fully in one GPU | No, it will be slower |
| You want more throughput for many users | No, run separate servers instead |
Not sure how much memory a model needs? See how much VRAM you need for AI. For a different take on pooling machines, compare with exo.
What You Need
- Two or more computers on the same local network. Wired gigabit is the minimum; 10GbE or Thunderbolt is much better.
- The same llama.cpp version on every machine. Mismatched versions can fail the handshake.
- A GGUF model file on the main host only. Workers receive tensors over the network.
- A firewall rule allowing the RPC port (50052 by default) between the machines.
Build llama.cpp With RPC
RPC is a build option. Add -DGGML_RPC=ON next to your usual backend flag on every machine. If you have not built llama.cpp before, follow how to install llama.cpp first.
- Clone the repo on each machine:
git clone https://github.com/ggml-org/llama.cpp && cd llama.cpp - Configure with RPC and your backend. For an NVIDIA worker:
mkdir build-rpc-cuda && cd build-rpc-cuda cmake .. -DGGML_CUDA=ON -DGGML_RPC=ON cmake --build . --config ReleaseFor a Mac, use
cmake .. -DGGML_RPC=ON(Metal is on by default). For a CPU-only worker, drop the CUDA flag. - Check the binaries. You should see
bin/ggml-rpc-server,bin/llama-serverandbin/llama-cli. - Repeat on the main host with its own backend flag plus
-DGGML_RPC=ON.
Start the RPC Workers
- Run the server on each worker:
bin/ggml-rpc-server -H 0.0.0.0 -p 50052 -c-H 0.0.0.0(or--host) listens on all interfaces so the main host can connect. Out of the box it listens only on127.0.0.1:50052, and it prints a warning whenever you bind to another address.-tsets CPU threads for a CPU-only worker.-cturns on the local tensor cache (explained below). - Read the startup output. It lists the devices it exposes and their free memory, for example:
Starting RPC server v3.0.0 endpoint : 0.0.0.0:50052 Devices: CUDA0: NVIDIA GeForce RTX 5090 (32109 MiB, 31588 MiB free) - Limit devices if needed. To expose only one GPU, use either
CUDA_VISIBLE_DEVICES=0 bin/ggml-rpc-server -p 50052orbin/ggml-rpc-server --device CUDA0 -p 50052. - Note each worker’s IP address (
ip addron Linux,ipconfigon Windows).
A machine with two GPUs can expose both from one server. You can also run several servers on different ports, one per GPU.
Connect From the Main Host
Pass every worker’s address to --rpc, comma separated:
bin/llama-server -m /models/llama-3.3-70b-q4_k_m.gguf \
-ngl 99 -c 8192 \
--rpc 192.168.1.10:50052,192.168.1.11:50052 \
--host 0.0.0.0 --port 8080
-ngl 99offloads all layers to devices, local and remote. Without GPU offload, the remote devices are not used for layers.- The startup log lists each remote device and its memory next to your local GPUs.
- The same
--rpcflag works withllama-clifor a quick terminal test, for examplellama-cli -hf ggml-org/gemma-3-1b-it-GGUF -ngl 99 --rpc 192.168.1.10:50052. - In Docker or Compose, set it as
LLAMA_ARG_RPC=192.168.1.10:50052,192.168.1.11:50052.
Once loaded, the server works like any other llama.cpp server: a web chat on the port, plus an OpenAI-compatible API. See the llama-server guide for the rest of the flags.
Use --list-devices on the main host with the same --rpc list to confirm every remote device is reachable before loading a big model.
Control How the Model Is Split
Automatic splitting uses free memory, which is usually right. Override it when one machine is much faster or you want headroom:
--tensor-split 3,1,1
The numbers are proportions across devices in the order llama.cpp lists them. Check the order in the startup log before setting it.
- Put more on the fastest GPU. Slower devices hold fewer layers.
- Keep the KV cache in mind. Long contexts need memory on every device. Lower
-cor quantize the cache with-ctk q8_0 -ctv q8_0. - Exclude a device with
--deviceon the main host, or by not exposing it on the worker.
Measure every change with llama-bench, which also accepts --rpc.
Speed Up Loading With the Local Cache
Without a cache, the main host sends every tensor over the network each time you load the model. For a 40 GB model that takes a while.
Start workers with -c and they store large tensors locally. On the next load, they read from disk instead of the network, which makes reloads much faster.
- The cache lives in
$HOME/.cache/llama.cpp/rpc. - Set the
LLAMA_CACHEenvironment variable to move it, for example to a fast NVMe drive. - Delete the folder to reclaim space when you stop using a model.
RDMA for Lower Latency
Newer builds can use RDMA instead of TCP. It is negotiated automatically during the handshake and falls back to TCP if either side cannot use it. You do not change any flags.
| Platform | Requirement |
|---|---|
| Linux | RoCEv2 NICs such as Mellanox ConnectX, with libibverbs at build time |
| macOS | Apple silicon Macs with Thunderbolt 5, macOS 26.2 or later, RDMA enabled once from Recovery with rdma_ctl enable |
RDMA is point to point. With Thunderbolt, use the peer’s Thunderbolt IP address in --rpc; a connection over Wi-Fi or Ethernet stays on TCP. To force TCP for testing, set GGML_RPC_NO_RDMA=1 on either side.
Keep It Safe
The llama.cpp docs are blunt: RPC is a proof of concept, fragile and insecure. Never run ggml-rpc-server on an open network.
- There is no authentication. Anyone who can reach the port can use it.
- Bind workers to a private LAN address instead of
0.0.0.0if they have several networks. - Block port 50052 at your router and in the OS firewall for everything except the main host’s IP.
- Do not port forward RPC to the internet. For remote machines, use a VPN such as WireGuard or Tailscale.
- Protect the main host’s API with
--api-keyif other people use it.
Troubleshooting
Connection refused from the main host
The worker is listening on localhost only. Restart it with -H 0.0.0.0 or its LAN IP, and open the port in the firewall.
Remote devices show up but carry no layers
Add -ngl 99 on the main host. Layer offload must be on for remote devices to hold weights.
Handshake or version mismatch errors
Build the same llama.cpp commit on every machine. The RPC protocol changes between versions.
Loading takes forever
Turn on the cache with -c on workers and use a faster link. The first load still sends everything once.
Tokens per second are very low
Network latency is the limit. Use wired 10GbE or Thunderbolt, put fewer layers on remote devices, or choose a smaller quant that fits on fewer machines.
I need more detail in the logs
Set GGML_RPC_DEBUG to 1, 2 or 3 on the worker or client. On the client, also pass -lv 5, for example GGML_RPC_DEBUG=2 llama-cli ... --rpc 192.168.1.10:50052 -lv 5.
FAQ
Can llama.cpp run one model across multiple computers?
Yes. Build with -DGGML_RPC=ON, run ggml-rpc-server on each worker and pass their addresses to --rpc on the main host.
What port does ggml-rpc-server use?
Port 50052 by default. Change it with -p.
Do the workers need the model file?
No. Only the main host needs the GGUF. Workers receive tensors over the network and can cache them locally with -c.
Can I mix NVIDIA, AMD and Mac machines?
Yes. Each worker uses its own backend, such as CUDA, Metal or CPU, and the main host treats them all as devices.
Is llama.cpp RPC faster than one GPU?
No. It lets you run bigger models, but network hops add latency. If a model fits on one machine, keep it there.
Is RPC secure enough for the internet?
No. It has no authentication. Keep it on a trusted LAN or behind a VPN.



