prima.cpp is a distributed inference engine that runs large LLMs (30-70B) across heterogeneous everyday devices like laptops, desktops, and phones, achieving low memory pressure and substantial speedups over llama.cpp.

Stars

64

7-day growth

No data

Forks

9

Open issues

1

License

MIT

Last updated

2026-06-30

AI repository intelligence
FR-AI / ANALYSIS

Why it is worth attention

It enables running 70B-level models on a home cluster of cheap, heterogeneous devices with memory usage below 10%, achieving up to 15x speed improvement over llama.cpp through piped-ring parallelism, heterogeneity-aware workload distribution, and automatic device selection.

Who it is for

  • Home users with multiple devices (laptops, phones, desktops) who want to run large LLMs locally
  • Researchers and hobbyists exploring distributed LLM inference on low-resource hardware
  • Developers building privacy-preserving AI assistants or agents at home
  • Students and educators studying distributed systems and model parallelism

Use cases

  • Running Llama 3-70B or DeepSeek R1-70B on a household network of old laptops and phones
  • Building a private local AI assistant (Home Siri) without uploading data to the cloud
  • Experimenting with speculative decoding and dynamic batching on heterogeneous clusters
  • Creating a cost-effective inference setup for educational or prototyping purposes

Strengths

  • Low memory pressure (<10%) via mmap and OS page cache management, allowing large models alongside other apps
  • Up to 15x faster inference than llama.cpp on home clusters, as shown by latency comparisons for 70B models
  • Support for diverse, heterogeneous devices (macOS, Linux, Android) with automatic device selection and workload distribution
  • Advanced features like piped-ring parallelism with prefetching, speculative decoding (up to 80% speedup), and dynamic batching for concurrent requests

Considerations

  • No Windows or AMD GPU support yet; only CUDA GPUs are supported
  • Requires a local network and manual setup of multiple devices (IP addresses, ports) with dependencies like HiGHS and zmq
  • Performance heavily depends on device specs and network conditions; very slow on severely underpowered devices (which are automatically removed)

README quick start

prima.cpp: Fast 30-70B LLM Inference on Heterogeneous and Everyday Home Devices

prima.cpp is a distributed implementation of llama.cpp that lets you run 70B-level LLMs on your everyday devices—💻 laptops, 🖥️ desktops, 📱 phones, and tablets (GPU or no GPU, it’s all good). With it, you can run QwQ-32B, Qwen 2.5-72B, Llama 3-70B, or DeepSeek R1 70B right from your local home cluster!

Worried about OOM or your device stucking? Never again! prima.cpp keeps its memory pressure below 10%, you can run very large models while enjoying Tiktok (if you don't mind the inference speed).

🚀 Performance

How about speed? Built upon llama.cpp, but it’s 15x faster! 🚀 On my poor devices, QwQ-32B generates 11 tokens per second, and Llama 3-70B generates 1.5 tokens per second. That's about the same speed as audiobook apps, from slow to fast speaking. We plan to power a Home Siri soon, then we can have private chats without privacy concerns.

prima.cpp vs llama.cpp on QwQ 32B:

https://github.com/user-attachments/assets/9fa3e57f-3f6b-49f3-800e-df9d758a60c6

prima.cpp vs llama.cpp on DeepSeek R1 70B:

https://github.com/user-attachments/assets/9549290e-a56f-46e1-9549-74250c1e0f7e

And, if your devices are more powerful, you could unlock even more possibilities, like running LLM agents right in your home! If you do, we’d love to hear about it, just share your cluster setup and token throughput with us!

Table 1: Home cluster configurations.

D1D2D3D4
DeviceMac M1LaptopDesktopMate40Pro
OSMacOS (UMA)LinuxLinuxLinux (on HarmonyOS)
CPUApple M1Intel i9Intel i9Kirin 9000
CPU Cores88168
RAM (available)2.4 GiB4.1 GiB9.7 GiB1.9 GiB
Disk Read Speed0.72 GB/s2.98 GB/s3.17 GB/s1.37 GB/s
GPU TypeApple Metal30702080TI-
VRAM (available)-8 GiB11 GiB-

Device D4 runs inside a Termux-simulate

Description

[Official] prima.cpp: Fast 30-70B LLM inference on heterogeneous and everyday home devices

Related repositories

Similar projects matched by category, topics, and programming language.

alecjacobson
Featured
alecjacobson GitHub avatar

alpha-wrap

A CGAL-free, MIT-licensed reimplementation of the Alpha Wrapping algorithm that takes a defective triangle soup and produces a watertight, manifold, outward-oriented mesh with controllable level of detail and tightness.

C++
5
hypervising
Featured
hypervising GitHub avatar

gta-enhanced-audio-queue-poc

A proof-of-concept tool that patches a synchronous three-slot audio queue in GTA V Enhanced, boosting frame rates from ~260 to ~499 FPS by removing coarse wait delays.

Design & Creative
3
ammaarreshi
ammaarreshi GitHub avatar

Generals-Mac-iOS-iPad

This repository ports Command & Conquer Generals: Zero Hour to run natively on Apple Silicon Macs, iPhones, and iPads without emulation, adding touch controls and modern rendering.

C++
1,523