distributed-llama

b4rtazMIT活跃维护

把家里的多台设备连成集群来跑 LLM 推理,设备越多推理越快,用 C++ 实现分布式加速。

Distributed LLM inference. Connect home devices into a powerful cluster to accelerate LLM inference. More devices means faster inference.

v0.17.0发布于 2026-11-07 10:27 UTC3,132star260fork同步于 2026-11-10 11:42 UTC

怎么上手

由 README 提炼,执行前请确认
python launch.py llama3_2_1b_instruct_q40
硬件要求按 README 说明

README 未给出具体显存或内存门槛;CPU 需为 ARM 或 x86_64 AVX2,GPU 走实验性 Vulkan 支持(见 HOW_TO_RUN_GPU 文档),也支持树莓派。

支持 Apple Silicon多卡 / 张量并行
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

把家里多台设备组成集群,用张量并行加速大模型推理,设备越多越快

把家里的多台设备连成集群来跑 LLM 推理,设备越多推理越快,用 C++ 实现分布式加速。

核心能力

  • 用张量并行把神经网络切片分到各节点
  • 通过以太网做高速同步,root 节点分发权重
  • 支持 Linux、macOS、Windows,优化 ARM 与 x86_64 AVX2
  • 提供 inference、chat、worker、dllama-api 四种命令
  • 单条 python launch.py 命令自动下载模型并启动 root 节点

容易踩的坑

需要 Python 3 和 C++ 编译器,launch.py 会额外下载模型和 tokenizer;节点数只能是 1、2、4 等 2^n 个,且不超过模型的 KV head 数;仅支持 q40 模型配 q80 buffer-float-type 或 f32 配 f32 两种量化组合

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.17.0
  1. v0.17.00.17.0最新正式版2026-11-07 · 2026-11-07 10:27 UTC

    Added support for Qwen3.5 models.

  2. v0.16.50.16.52026-02-02 · 2026-02-02 12:06 UTC
    查看更新说明

    This version adds experimental tool call support to the dllama-api, currently only for non-streaming requests (stream: false). Tested with qwen3_8b_q40.

  3. v0.16.40.16.42026-01-17 · 2026-01-17 23:46 UTC
    查看更新说明

    Added the --host 0.0.0.0 argument to allow overriding the default binding host https://github.com/b4rtaz/distributed-llama/issues/231.

  4. v0.16.30.16.32025-10-26 · 2025-10-26 11:05 UTC
    查看更新说明

    This version improves the reliability of dllama-api. The API now runs as a persistent service designed for continuous operation. If any worker crashes, the API automatically attempts to reconnect to the failed node and reinitialize the cluster. The goal is to ensure that the API remains operational within moments after any node failure.

  5. v0.16.20.16.22025-09-20 · 2025-09-20 13:58 UTC
    查看更新说明

    Fixed Vulkan support on Raspberry Pi 5. Distributed Llama now runs with Vulkan, though it is slower than CPU-only execution https://github.com/b4rtaz/distributed-llama/issues/259.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Distributed Llama

    Distributed Llama

    GitHub Actions Workflow Status License: MIT Discord

    Connect home devices into a powerful cluster to accelerate LLM inference. More devices mean faster performance, leveraging tensor parallelism and high-speed synchronization over Ethernet.

    Supports Linux, macOS, and Windows. Optimized for ARM and x86_64 AVX2 CPUs.

    How to Run

    News

    🔥 Setup Root Node by Single Command

    Python 3 and C++ compiler required. The command will download the model and the tokenizer.

    ModelSizeCommand
    Llama 3.1 8B Instruct Q406.32 GBpython launch.py llama3_1_8b_instruct_q40
    Llama 3.1 405B Instruct Q40238 GBpython launch.py llama3_1_405b_instruct_q40.
    Llama 3.2 1B Instruct Q401.7 GBpython launch.py llama3_2_1b_instruct_q40
    Llama 3.2 3B Instruct Q403.4 GBpython launch.py llama3_2_3b_instruct_q40
    Llama 3.3 70B Instruct Q4040 GBpython launch.py llama3_3_70b_instruct_q40
    DeepSeek R1 Distill Llama 8B Q406.32 GBpython launch.py deepseek_r1_distill_llama_8b_q40
    Qwen 3 0.6B Q400.9 GBpython launch.py qwen3_0.6b_q40
    Qwen 3 1.7B Q402.2 GBpython launch.py qwen3_1.7b_q40
    Qwen 3 8B Q406.7 GBpython launch.py qwen3_8b_q40
    Qwen 3 14B Q4010.9 GBpython launch.py qwen3_14b_q40
    Qwen 3 30B A3B Q4017.0 GBpython launch.py qwen3_30b_a3b_q40
    Qwen 3.5 9B Q408.0 GBpython launch.py qwen3_5_9b_q40

    🛠️ Convert Model Manually

    🚧 Known Limitations

    • You can run Distributed Llama only on 1, 2, 4... 2^n nodes.
    • The maximum number of nodes is equal to the number of KV heads in the model #70.
    • Only the following quantizations are supported #183:
      • q40 model with q80 buffer-float-type
      • f32 model with f32 buffer-float-type

    👷 Architecture

    [🔀 SWITCH OR ROUTER]
          | | | |
          | | | |_______ 🔸 device1 (ROOT)     10.0.0.1
          | | |_________ 🔹 device2 (WORKER 1) 10.0.0.2:9999
          | |___________ 🔹 device3 (WORKER 2) 10.0.0.3:9999
          |_____________ 🔹 device4 (WORKER 3) 10.0.0.4:9999
                            ...
    

    The project is split up into two parts:

    • 🔸 Root node - it's responsible for loading the model and weights and forward them to workers. Also, it synchronizes the state of the neural network. The root node is also a worker, it processes own slice of the neural network.
    • 🔹 Worker node - it processes own slice of the neural network. It doesn't require any configuration related to the model.

    You always need the root node and you can add 2^n - 1 worker nodes to speed up the inference. The RAM usage of the neural network is split up across all nodes. The root node requires a bit more RAM than worker nodes.

    🎹 Commands

    • dllama inference - run the inference with a simple benchmark,
    • dllama chat - run the CLI chat,
    • dllama worker - run the worker node,
    • dllama-api - run the API server.

    Inference, Chat, API

    ArgumentDescriptionExample
    --model <path>Path to model.dllama_model_meta-llama-3-8b_q40.m
    --tokenizer <path>Tokenizer to model.dllama_tokenizer_llama3.t
    --buffer-float-type <type>Float precision of synchronization.q80
    --workers <workers>Addresses of workers (ip:port), separated by space.10.0.0.1:9999 10.0.0.2:9999
    --max-seq-len <n>The maximum sequence length, it helps to reduce the RAM usage.4096

    Inference, Chat, Worker, API

    ArgumentDescriptionExample
    --nthreads <n>Amount of threads. Don't set a higher value than number of CPU cores.4

    Worker, API

    ArgumentDescriptionExample
    --host <addr>Binding address.127.0.0.1
    --port <port>Binding port.9999

    Inference

    ArgumentDescriptionExample
    --prompt <prompt>Initial prompt."Hello World"
    --steps <steps>Number of tokens to generate.256

    📊 Measurements

    Please check the discussions section, where many measurements were published on different configurations.

    ✋ Contribution

    Feel free to contribute to this project. For small changes, simply create a new merge request. For larger changes, please create an issue to discuss your plans. Please follow these guidelines when contributing:

    • Make only minimal changes and avoid modifying files that are not necessary.
    • Ensure the code is compatible across all supported systems and CPUs.
    • This repository is maintained in English.

    💡 License

    This project is released under the MIT license.

    📖 Citation

    @misc{dllama,
      author = {Bartłomiej Tadych},
      title = {Distributed Llama},
      year = {2024},
      publisher = {GitHub},
      journal = {GitHub repository},
      howpublished = {\url{https://github.com/b4rtaz/distributed-llama}},
      commit = {7eb77ca93ec0d502e28d36b6fb20039b449cbea4}
    }