arXiv:2605.20706cs.DCcs.AI2026-05被引 3

让大模型在浏览器里高效运行,内存占用更低,跨设备性能更稳。

Llamas on the Web: Memory-Efficient, Performance-Portable, and Multi-Precision LLM Inference with WebGPU

论文配图:Llamas on the Web: Memory-Efficient, Performance-Portable, and Multi-Precision LLM Inference with WebGPU
图 1 · 摘自论文原文
  • 基于WebGPU的静态内存规划与高效加载,减少内存开销。
  • 支持多种量化格式,跨16台设备测试,内存降低29%-33%,推理速度提升45%-69%。
  • 适合关注隐私、跨平台部署和低资源运行的开发者使用。

在浏览器中运行语言模型为构建高效、私密且可移植的AI应用提供了独特机会,但需应对内存受限和硬件异构的挑战。为此,我们提出Llamas on the Web(LlamaWeb),作为llama.cpp的WebGPU后端,支持多种模型权重格式,实现内存高效、性能可移植的LLM推理。通过静态内存规划与高效加载显著降低内存开销,利用可调谐内核库应对跨设备差异,并引入模板化GPU内核支持多种量化格式,实现广泛模型兼容与新格式扩展性。我们在8个厂商的16台设备上评估了10个语言模型及4种权重格式。相比现有浏览器框架,LlamaWeb在多种设备、浏览器和操作系统组合下内存占用减少29%-33%;性能对比显示,其解码吞吐量提升45%-69%。与其它llama.cpp后端相比,在部分设备上表现甚至超越厂商专用后端。

原文摘要 · Abstract (English)

Running language models in the browser presents a unique opportunity to build efficient, private, and portable AI applications, but requires contending with constrained memory availability and heterogeneous hardware targets. To realize this opportunity, we present Llamas on the Web (LlamaWeb), a WebGPU backend for llama$.$cpp that enables memory-efficient and performance-portable LLM inference across a wide range of model weight formats in the browser. Our design significantly reduces memory overhead through static memory planning and efficient model loading, addresses cross-device variability through a tunable kernel library, and introduces templated GPU kernels that support performant implementations of numerous quantization formats, enabling broad model support and extensibility to new formats. We evaluate LlamaWeb on 16 devices from 8 vendors, collecting data from 10 language models and four model weight formats. We compare LlamaWeb against existing browser-based LLM frameworks and find that LlamaWeb requires 29-33% less memory across several combinations of device, browser, and operating system. We also evaluate LlamaWeb's performance against these frameworks and find that it increases decode throughput by 45-69% across four GPUs from separate vendors. In addition, we compare LlamaWeb's performance against other llama$.$cpp backends, where it is competitive with and even beats vendor-specific backend performance on some devices.

浏览器推理WebGPU内存优化量化支持

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。