五台机器跑一个模型:llama.cpp RPC 分布式入门
一台机器装不下模型的时候,不用急着买新硬件:五台机器可以拼成一台用。llama.cpp 的 RPC 分布式就是干这个的。 思路 一台主节点 + 四台从节点,模型按层分片存在各台的内存里,主节点统一调度、汇总结果。对使用者来说,还是一个服务地址、一个模型。 网络是关键 节点之间要频繁传数据,网络最好是 10GbE;千兆网也能跑,但节点间传输会成为瓶颈(经验判断)。先确认交换机和网卡,再谈分布式。 电费先算清 5 台满载约 3–4kW。按 3.5kW 算,24 小时 × 30 天 ≈ 2,520 度电(估算),乘上当地电价就是一个月的电费。分布式是按需开的,不跑大模型的时候不用五台全开。 什么时候需要 需要:70B 以上、单台内存装不下的模型。 不需要:8B / 14B / 32B,单台或双卡就够了,分布式反而更慢。 部署步骤 每台机器装好 llama.cpp;从节点启动 rpc-server;主节点用 llama-server 加 --rpc 参数,填上各从节点的地址,加载模型;先拿小模型验证通路,再上大模型。 下一步:等内存条数确认、主力节点到 256GB 后,本站会实测一次五节点跑 235B MoE,把真实速度贴出来。 Five Machines, One Model: Getting Started with llama.cpp RPC When one machine cannot hold a model, there is no need to buy new hardware first: five machines can work as one. That is what llama.cpp RPC distributed serving is for. The idea One main node plus four worker nodes. The model is split by layer across each node's memory, and the main node schedules the work and collects the results. To the user it is still one service address and one model....