让家用设备集群高效运行70B大模型,实现低延迟与隐私保护。
Prima.cpp: Fast 30-70B LLM Inference on Heterogeneous and Low-Resource Home Clusters
- 采用流水线环形并行技术,重叠磁盘读写与计算通信。
- 70B模型在家庭集群上达674毫秒/词元,内存压力低于6%。
- 支持跨系统、低资源环境,适合本地化部署的开发者。
本地推理具备隐私保护、离线使用和即时响应优势,但消费级硬件限制了大语言模型(LLMs)的吞吐量和性能。为突破此瓶颈,我们提出prima.cpp,一个分布式本地推理系统,可在混合CPU/GPU、内存/显存不足、硬盘慢、Wi-Fi网络差且操作系统异构的家庭集群上运行30-70B LLM。引入流水线环形并行(PRP)技术,实现磁盘I/O与计算、通信的重叠,并解决基于mmap的卸载中的预取-释放冲突问题。进一步提出Halda调度器,综合考虑设备内存/显存约束,协同优化各设备的CPU/GPU负载与设备选择。在四台消费级家庭设备上,70B模型实现674毫秒/词元的TPOT,内存压力<6%;32B模型配合推测解码可达26词元/秒。相比llama.cpp、exo和dllama,prima.cpp实现5-17倍更低的TPOT,支持8B至70B细粒度模型规模,兼容更多操作系统与量化方式,全程无内存溢出(OOM-free),且具备Wi-Fi容错、隐私保护与硬件无关性。代码已开源:https://github.com/OpenCPIL/prima.cpp。
原文摘要 · Abstract (English)
On-device inference offers privacy, offline use, and instant response, but consumer hardware restricts large language models (LLMs) to low throughput and capability. To overcome this challenge, we present prima.cpp, a distributed on-device inference system that runs 30-70B LLMs on consumer home clusters with mixed CPUs/GPUs, insufficient RAM/VRAM, slow disks, Wi-Fi links, and heterogeneous OSs. We introduce pipelined-ring parallelism (PRP) to overlap disk I/O with compute and communication, and address the prefetch-release conflict in mmap-based offloading. We further propose Halda, a heterogeneity-aware scheduler that co-optimizes per-device CPU/GPU workloads and device selection under RAM/VRAM constraints. On four consumer home devices, a 70B model reaches 674 ms/token TPOT with <6% memory pressure, and a 32B model with speculative decoding achieves 26 tokens/s. Compared with llama.cpp, exo, and dllama, our proposed prima.cpp achieves 5-17 times lower TPOT, supports fine-grained model sizes from 8B to 70B, ensures broader cross-OS and quantization compatibility, and remains OOM-free, while also being Wi-Fi tolerant, privacy-preserving, and hardware-independent. The code is available at https://github.com/OpenCPIL/prima.cpp.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。