跳到主内容
@wquguru
精选88Avi Chawla产品发布/更新

uzu推理引擎:多路投机解码突破本地LLM显存墙

Big win for local LLM inference!

原文
发到 X
推荐理由

本地部署痛点直击,uzu用多路投机解码把M5上的LLM速度翻了四倍,给做端侧Agent的同学提供了极具参考价值的工程实现方案。

Big win for local LLM inference!

本地大语言模型推理的重大胜利!

This new inference engine runs LLMs 4x faster than llama.cpp:

这个新的推理引擎运行大语言模型的速度比 llama.cpp 快 4 倍:

I ran Qwen3.5 9B on a base M5 MacBook Pro with three engines:

我在基础款 M5 MacBook Pro 上使用三种引擎运行了 Qwen3.5 9B:

  • llama.cpp: 22.0 tokens/s - MLX: 25.1 tokens/s - uzu: 92.1 tokens/s

The video below shows all three runs side by side.

下面的视频展示了这三个运行的并列对比。

The first two numbers don't mean llama.cpp or MLX are badly built. But both are sitting right under a hard limit of local decoding.

前两个数字并不意味着 llama.cpp 或 MLX 构建得不好。但它们都正好处于本地解码的硬性限制之下。

When an LLM generates text, every new token needs one full pass through the model, and that pass reads all of the model's weights from memory.

当大语言模型生成文本时,每个新 token 都需要对模型进行一次完整的前向传播,而该过程会从内存中读取模型的所有权重。

A base M5 reads memory at about 153 GB/s. A 4-bit 9B model weighs about 5.2 GB.

基础款 M5 的内存读取速度约为 153 GB/s。一个 4-bit 的 9B 模型权重约为 5.2 GB。

So at one token per pass, the ceiling is roughly 153 ÷ 5.2 ≈ 29 tokens/s, however fast the GPU computes.

因此,按每次前向传播生成一个 token 计算,上限大约是 153 ÷ 5.2 ≈ 29 tokens/s,无论 GPU 计算有多快。

uzu gets past that ceiling by producing several tokens per pass instead of one:

uzu 通过在一次前向传播中生成多个 token 而不是一个来突破这一上限:

↳ A small drafter (DFlash) proposes candidates for the next 16 positions at once.

↳ 一个小草稿生成器(DFlash)一次性为接下来的 16 个位置提出候选值。

↳ A tiny adapter (Weaver, 56.7M params) picks among them left to right, so the guesses form coherent text, and keeps a few alternative branches as a tree.

↳ 一个极小的适配器(Weaver,56.7M 参数)从左到右从中进行选择,使猜测形成连贯的文本,并保留几个替代分支作为树结构。

↳ The 9B model checks the whole tree in a single pass and keeps the longest path it agrees with. The main model still decides every token that ends up in the output.

↳ 9B 模型在一次前向传播中检查整棵树,并保留它同意的最长路径。主模型仍然决定最终输出中的每一个 token。

GitHub repo: http://github.com/trymirai/uzu

GitHub 仓库:http://github.com/trymirai/uzu

(don't forget to star it 🌟)

(别忘了给它点个星 🌟)

In my run, each pass of the 9B model produced 7.5 tokens on average. Ordinary decoding produces exactly 1.

在我的测试中,9B 模型的每次前向传播平均产生 7.5 个 token。普通解码恰好产生 1 个。

The weights and kernels are designed around this too. uzu ships its own 4-bit checkpoints, and on M5 chips it runs the verification step on the GPU's int8 matrix path.

权重和内核也是围绕这一点设计的。uzu 自带其 4-bit 检查点,在 M5 芯片上,它在 GPU 的 int8 矩阵路径上运行验证步骤。

uzu is an open-source inference engine by Mirai Labs, written in Rust with Metal kernels. It has Swift, Python, TypeScript and Rust bindings, so the same engine runs inside a Mac or iOS app.

uzu 是 Mirai Labs 推出的开源推理引擎,使用 Rust 编写并包含 Metal 内核。它提供 Swift、Python、TypeScript 和 Rust 绑定,因此同一引擎可在 Mac 或 iOS 应用内运行。

I shared the GitHub repo above.

我分享了上面的 GitHub 仓库。

If you want to dive deeper, my co-founder wrote a detailed breakdown of why local inference is memory-bound and how uzu's speculative decoding gets past it.

如果你想深入了解,我的联合创始人撰写了一篇详细分析,解释了为什么本地推理受内存瓶颈限制,以及 uzu 的推测解码如何突破这一限制。

Read it below.

在下面阅读。

更进一步:量化金融体系

看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力

进入量化体系 →

相似阅读

关联信息,但可能不是同一事件