← 回到 Reading LOCAL AI
Daily Dose of DS
Karpathy’s Trick for Faster Local LLMs Finally Has Proper Tooling
Uzu 是一款開源的 local LLM inference engine,專為 Apple Silicon 硬體上的 batch-size-one 工作負載所設計。在基礎 M5 晶片上,它擺脫了 memory bandwidth 將速度限制在每秒約 29 tokens 的瓶頸,使用 4-bit Qwen3.5 9B 模型實現了每秒 92 到 117 tokens。它透過協同設計的 pipeline 達成此目標,該 pipeline 整合了結合 Random Hadamard Transforms 的 int8 quantization、DFlash-Weaver speculative tree drafting,以及針對 stateful Gated DeltaNet 層的 rollback-free verification。
閱讀原文 ↗Karpathy 讓 local LLMs 更快速的技巧,終於有了合適的 tooling
Uzu 是一款開源的 local LLM inference engine,專為 Apple Silicon 硬體上的 batch-size-one 工作負載所設計。在基礎 M5 晶片上,它擺脫了 memory bandwidth 將速度限制在每秒約 29 tokens 的瓶頸,使用 4-bit Qwen3.5 9B 模型實現了每秒 92 到 117 tokens。它透過協同設計的 pipeline 達成此目標,該 pipeline 整合了結合 Random Hadamard Transforms 的 int8 quantization、DFlash-Weaver speculative tree drafting,以及針對 stateful Gated DeltaNet 層的 rollback-free verification。
- 在 batch size 為 1 的情況下,local LLM 的 generation 速度基本上受限於 memory bandwidth;在基礎 M5(153 GB/s 頻寬)上,5.2 GB 的 4-bit 9B 模型在 single-token decoding 下的理論上限約為 ~29 tokens/second。
- Uzu 將 4-bit weight quantization 與 on-the-fly int8 activation quantization 相結合,並採用 block-diagonal Random Hadamard Transform 來減輕 outlier 誤差,精確匹配 Apple GPU 的 32-thread SIMD 寬度。
- Uzu 中的 speculative drafting 使用 DFlash 與 Weaver 生成具有 16 到 32 個 token budget 的連貫候選 token trees,充分利用 M5 Neural Accelerators 上的閒置運算能力。
- 為了在 Qwen3.5 中處理 recurrent Gated DeltaNet layers,且不造成效能下降的 state restorations,Uzu 透過 recurrence-free Metal kernels 採用了 rollback-free tree verification。
- 在 M5 MacBook Pro 上的 benchmark 中,Uzu 能生成 92–117 tokens/s(每次 forward pass 接受約 7.5–8.4 個 tokens),表現優於 llama.cpp(22 tokens/s)與 MLX(25 tokens/s)。