uzu推理引擎实现DFlash+Weaver加速本地LLM
Massive breakthrough for local LLM inference!
本地部署同学必看,uzu引擎把DFlash和Weaver结合解决了投机解码的瓶颈,Mac上提速近4倍,直接拿你的模型压测一下。
Massive breakthrough for local LLM inference!
本地大语言模型推理的重大突破!
A new inference engine runs LLMs 4x faster than llama.cpp:
一个新的推理引擎运行大语言模型的速度比 llama.cpp 快 4 倍:
I ran Qwen3.5 9B on my M5 MacBook Pro with the same prompt, three ways:
我在 M5 MacBook Pro 上使用相同的提示词,以三种方式运行了 Qwen3.5 9B:
- No speculative decoding: done in 42s - Regular speculative decoding: done in 30s - DFlash + Weaver: done in 11s
- 无推测解码:耗时 42 秒 - 常规推测解码:耗时 30 秒 - DFlash + Weaver:耗时 11 秒
The video below shows the live comparison side by side.
下面的视频展示了并列进行的实时对比。
Here's why it works:
以下是其工作原理:
Standard speculative decoding lets a cheap drafter guess the next few tokens, and the main model checks them all in one pass.
标准的推测解码允许一个廉价的草稿模型猜测接下来的几个 token,而主模型一次性检查所有这些 token。
But current drafters still guess one token at a time, which makes the drafting step itself a bottleneck, capping real-world speedups at ~1.5-2x.
但当前的草稿模型仍然一次只猜测一个 token,这使得草稿步骤本身成为瓶颈,将实际加速比限制在约 1.5-2 倍。
The fastest drafters, like DFlash, guess every position in parallel.
最快的草稿模型,如 DFlash,并行猜测每个位置。
But each guess is made on its own, so position 5 never sees what was picked at position 4. So due to one early mismatch, everything after it gets thrown away.
但每个猜测都是独立做出的,因此位置 5 看不到位置 4 上被选中的内容。所以由于早期的一个不匹配,之后的所有内容都会被丢弃。
Weaver, implemented in the uzu open-source inference engine, solves this.
Weaver(在 uzu 开源推理引擎中实现)解决了这个问题。
It's a tiny adapter (one Transformer layer) on top of DFlash that:
它是 DFlash 之上的一个小型适配器(一个 Transformer 层),它:
↳ picks among DFlash's top candidates left to right, so each pick depends on the last ↳ grows a tree of likely continuations instead of a single chain ↳ lets the main model verify the whole tree in one pass
↳ 从左到右在 DFlash 的顶级候选项中进行选择,因此每个选择都依赖于前一个 ↳ 构建可能延续的树状结构,而不是单一链 ↳ 让主模型在一次传递中验证整棵树
On my Mac, every pass of the model produced 7.5 tokens instead of 1.
在我的 Mac 上,模型的每次传递生成了 7.5 个 token,而不是 1 个。
On a B200 GPU, the paper reports 4x faster decoding across chat, math, and code.
在 B200 GPU 上,论文报告称聊天、数学和代码方面的解码速度提高了 4 倍。
Here's the GitHub repo: https://github.com/trymirai/uzu
这里是 GitHub 仓库:https://github.com/trymirai/uzu
(don't forget to star it 🌟)
(别忘了给它加星 🌟)
You can try this yourself in two commands:
你可以通过两个命令自己尝试:
𝗯𝗿𝗲𝘄 𝗶𝗻𝘀𝘁𝗮𝗹𝗹 𝗺𝗶𝗿𝗮𝗶
𝗺𝗶𝗿𝗮𝗶 --𝗺𝗼𝗱𝗲𝗹 𝘁𝗿𝘆𝗺𝗶𝗿𝗮𝗶/𝗤𝘄𝗲𝗻𝟯.𝟱-𝟵𝗕-𝗠 -𝗺 "𝗪𝗿𝗶𝘁𝗲 𝗮 𝗽𝘆𝘁𝗵𝗼𝗻 𝗳𝘂𝗻𝗰𝘁𝗶𝗼𝗻 𝘁𝗼 𝗺𝗲𝗿𝗴𝗲 𝘁𝘄𝗼 𝘀𝗼𝗿𝘁𝗲𝗱 𝗹𝗶𝘀𝘁𝘀"
To dive deeper, my co-founder has written a full breakdown of why local inference is memory-bound and how uzu by @trymirai gets past it, with fully reproducible code.
要深入了解,我的联合创始人写了一篇完整的分析,解释了为什么本地推理受内存限制,以及 @trymirai 的 uzu 如何克服这一限制,并提供了完全可复现的代码。
Read it below.
在下面阅读。
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力