浏览器里跑1-Bit LLM?WebGPU真香
1-Bit LLM in the Browser

别再被大模型的硬件门槛劝退了!webml-community 在 Hugging Face Spaces 上推出的 Bonsai 1-bit WebGPU 项目,竟然让 1-Bit LLM 直接在浏览器中流畅运行。这项技术利用 WebGPU 的强大算力,将模型量化到极致,无需安装任何本地软件,打开网页就能体验 AI 对话。这不仅展示了浏览器端 AI 的巨大潜力,更意味着未来每个人都能在自己的设备上轻松部署轻量级大模型,彻底打破算力垄断。
HN 评论区
48- stfurkan
我目前正在开发一个开源引擎 [1],专门用于此目的。如果有人想试试或有任何建议,我很乐意倾听 :)
1. https://github.com/stfurkan/bitgpu
2. https://aidekin.com --> 这是我目前使用 bitgpu 引擎的一个项目
- lelanthran
不过 1-bit 的精度其实不高。看看我得到的结果:
我:
> 描述巴氏杀菌的过程
回复:
> 巴氏杀菌是 a,which a,the which which is,the and process,the the past,the and the,and and and past,and past,and and and and the,the and past,process is the is is is is,and the,past,and and future,process,and and and and and and and the,past,process,process,the the,the the,is and the,the the,and and and,and process,and and the,past,and and and past,and the,the,and the past,the the,process,process,and past,the past,past,the and,the past,and and and and and and and and and the,and and and and and and and,the the,the the,the or and and,the the,the and the,which the,and the,the the,past,and n the process,and and and and,past,and,and and,the past,and,the the,past,and the,the the,the is the,past,and and and and and,and and and past,the and the,the the,the the,are and past,and which the,the and n,n the,the n past,past,n the,and n,the the process,which past,the the,the n,the the,the is past,the the,is,past,the the,past,and past,process,the the,the the,the and and the,and which past,the
(基本上就是像这样一直重复下去)
- Lwerewolf
我很确定这可能是一个重复的帖子。不管怎样,我用三种不同方式尝试了 1bit bonsai 27b gguf 模型——他们的 llama.cpp 分支(prism 吗?)在两台机器上(1255u/16g,m5 max/128g)以及网页端(在 1255u 上)。用 llama.cpp 时它能跑起来,但在网页端它只是反复输出同样的内容。提示词是“你觉得这段代码有什么不对:<C 代码,在 if 语句中将复合字面量作为指针传递给函数>”,结果字面意义上就是“Yes, let'ssomestruct_struct_tsomestruct<a bit of similar garbage>structstructstruct<forever>”。
本地运行时,它肯定不是完整的 3.6 27b 模型,但考虑到上下文仅占用约 6G,这相当令人印象深刻,我也很看好这对更大模型意味着什么。不过在 1255u 上的速度简直惨不忍睹(~1TPS 或更低)——当然,这是纯 CPU 运行。
- om8
这个项目需要 WebGPU——我大约一年前在 CPU 上做过类似的。
我的演示使用了 2-bit 量化,可以在任何内存足够的设备上运行 llama3 模型。
- estebarb
我试了最小的那个,也是唯一可用的那个,结果报错:
```
Could not load.
Error: failed to call OrtRun(). ERROR_CODE: 1, ERROR_MESSAGE: Non-zero status code returned while running GroupQueryAttention node.
Name:'/model/layers.0/attn/GroupQueryAttention' Status Message: Failed to create a WebGPU compute pipeline: A valid external Instance reference no longer exists.
```