pooled README

项目的 README,来自 github.com/Nehanth/pooled。合并为一个 markdown 文件:README.md。

pooled

Peer-to-peer LLM inference in the browser. Pool your devices to run big open models, for chat and coding agents.

Site · Start a room · Architecture · Benchmarks · Roadmap · Threat model · Contributing

license runtime

https://github.com/user-attachments/assets/5142d877-e4d5-4f6b-9b5e-0ef48dcb73f6

Demo, recorded September 27, 2026 (2:29, with voice and subtitles): Qwen 3.6 35B MoE across a Mac and an iPhone in browser tabs. The phone chats with it, then Code mode builds a Tetris game, fixes its own bug and restyles it. Download · the September 7 demo.

Pooled runs one open model across the devices in a room. Your laptop, a friend's desktop and a phone each hold some of the model's layers, and together they run a model none of them could run alone. A model bigger than a device's GPU memory keeps most of itself on the SSD and streams what each token needs into the GPU (Qwen3.8 Flash, 125B, experimental; SSD demo), and every device that joins holds more of it in memory, so it gets faster. You can chat with it, or switch to Code mode and let it build and fix a small app right in the tab. There is nothing to install and no account, and no server does any of the thinking.

How it works

Friends open one link. Each device (laptop, desktop, phone) holds some of the model's layers and runs them on its own GPU with our own WGSL kernels. For every token, a small hidden state (10 KB on the 27B, 4 KB on the MoE) passes from tab to tab over direct WebRTC connections, and the host turns the result into the next word.

host      embed the last token → hidden state
   ↓ a few KB over WebRTC
laptop    layers 0–21           ─┐
desktop   layers 22–42           ├─ each device runs its layers on its own GPU
phone     layers 43–63          ─┘
   ↓ back to the host
host      final norm → LM head → sample → next token (and draft the ones after it)

Models in the room today:

Model Size Notes
Qwen 3.8 27B Q4_0, needs ~17 GB across the room hybrid Gated DeltaNet + attention, built-in draft layer for speculative decoding; opens at the longest context the room holds at full speed, up to 64K (16K at ~17 GB, 64K at ~20 GB)
Qwen 3.6 35B MoE Q4_0, needs ~22.5 GB across the room 256 experts, 8 active per token, so it decodes several times faster than the 27B; opens at the longest context the room holds at full speed, up to 128K (32K at ~22.5 GB, 128K at ~23.5 GB)
Qwen3 1.7B Q8_0, needs ~5.6 GB across the room for 16K context, ~4 GB for 8K small and quick, for rooms of phones and light laptops; 16K context, 8K when the room is short of memory
Qwen3.8 Flash (experimental) Q4_0, 125B (6B active), ~99 GB on disk 512 experts, 10 active per token; keeps most of itself on disk, so it needs far less GPU memory than its size; 64K context. See below

Every device downloads only its own layers, from Hugging Face or from another device in the room that already has them, and keeps them cached for next time. If a device leaves, the room says so and the host deals its layers out again with one click. Speculative decoding, batched prefill and every kernel trick are checked by golden tests, so the speculative stream is the same as plain decoding.

Qwen3.8 Flash (experimental)

Qwen3.8 Flash is a 125B mixture-of-experts model that uses about 6B of its parameters per token. It is far bigger than the GPU memory of most computers, so Pooled keeps most of it on disk: each device stores its share of the model's experts on its SSD (in the browser's storage for a tab), keeps the experts it used recently in a GPU cache, and reads the rest from disk as a token needs them. A single computer can run it on its own this way.

Pooling makes it faster. Reading from disk is the slow part, and each device that joins holds part of the model in its own memory, so less of it has to come from disk. The room deals the model out again as devices join or leave.

Measured in October 2026: a Mac Studio running it alone in a Chrome tab decodes about 8 tokens/s. With a PC with an RTX 5070 joined (pooled join), the pair decodes about 10-12 tokens/s, depending on the network between them.

It is experimental:

Demo video: Qwen3.8 Flash in a Chrome tab on a Mac Studio, then an RTX 5070 PC joins (recorded October 13, 2026, 2:02, voice and subtitles; the room gets 1.4x faster when the PC joins).

Pick it in the room's model picker. To lend a computer from the command line: npx @pooled/cli join <ROOM CODE> (cli/README.md).

Details: docs/architecture.md, docs/kernels.md, docs/protocol.md, docs/models.md.

Code mode

Switch the room to Code and ask for something, like "build a tetris game". The room's model runs a small agent loop: it writes the files, serves them on a virtual localhost (:5173) in a sandboxed preview, reads its own console errors, and fixes them. Everyone in the room sees the files and can run the same preview on their own screen. The files live in the host's browser, or in a folder on disk the host picks, and edits to a real folder wait for the host's approval.

Design: docs/design/harness-app.md. What the agent can and cannot touch: SECURITY.md.

Use Pooled from your tools

A room can serve its model to anything that speaks the OpenAI Chat Completions, OpenAI Responses or Anthropic Messages API, tool calling included: coding agents (Codex CLI, Claude Code, opencode), Continue, Open WebUI, LiteLLM, the openai and anthropic SDKs, curl. In a room, the black Serve API button in the header opens the Serve API page with the command for that room; run it on your own computer (Node 22 or newer, no GPU needed there):

npx @pooled/cli serve "https://pooled.run/r/4TKG9P#k=…"   # the room's invite link, or its code
# pooled serve · room 4TKG9P · Qwen3.6 35B MoE · Q4 · 32768 tokens of context
#   OpenAI     http://127.0.0.1:8080/v1         (OPENAI_BASE_URL, any API key: chat/completions, responses)
#   Anthropic  http://127.0.0.1:8080            (ANTHROPIC_BASE_URL: messages)

curl http://127.0.0.1:8080/v1/chat/completions -H 'content-type: application/json' \
  -d '{"model": "pooled", "messages": [{"role": "user", "content": "Hi"}], "stream": true}'

The bridge joins the room as an API client with no layers, so requests run on the room's GPUs, one at a time in the room's queue, and show in the chat under the room's visibility setting. It listens on 127.0.0.1 only; POOLED_TOKEN makes it require a key. Prompts go to the room's host and, unless the host limits who sees answers, to everyone in the room: see who sees your prompts. Tool calls (streamed, parallel, every tool_choice form), tool results, JSON mode and JSON schemas, reasoning and Responses' previous_response_id work on all three APIs; every call and structured answer is grammar-constrained to its schema, so calls always parse, even from the 1.7B. The room's host must run a Pooled with tool calling (older hosts answer tools with a 400 asking to reload). Images become a note (the models read text only); the legacy /v1/completions is not served. Setup for each tool, including the context settings Codex, Claude Code and opencode need: cli/README.md. Design: docs/design/serve.md.

Rooms at work

Work networks often block the direct (UDP) connections rooms use. When the site has a relay set up, rooms fall back to it by themselves, over TCP or TLS on port 443. Links still go direct when they can, and model weights never go through the relay. Setup for the site's owner (a Cloudflare TURN key or your own coturn, set in the Vercel environment): docs/rooms-at-work.md.

Run it locally

git clone https://github.com/Nehanth/pooled && cd pooled
npx -y serve -l 8080 .        # then open http://localhost:8080/room

serve reads serve.json for the /room and /r/:code rewrites. Production uses the same two rewrites in vercel.json, so keep the two files in step.

Tests

npm test                                   # unit tests, no GPU (Deno)
npm run e2e:code                           # Code mode end to end, no GPU: two tabs, a real room, a scripted model
node tests/e2e/preview_browser.mjs         # the Code mode preview sandbox, no GPU
node tests/e2e/room_synth.mjs              # the real engine and room on a tiny synthetic model, no GPU
npm run test:gpu                           # golden tests on Qwen3 0.6B (needs a WebGPU GPU and Deno 2)
npm run test:q38                           # 27B suites, including speculative == plain

The no-GPU tests run headless Chromium with WebGPU on SwiftShader. They need npm install (Playwright and the peer server). GPU tests read model files from models/; see docs/models.md and CONTRIBUTING.md.

Architecture

engine/            the WebGPU engine (ES modules; engine.js re-exports the public API)
  dense.js         DenseEngine: dense models (Qwen3, SmolLM)
  qwen35.js        Qwen35Engine: hybrid Gated DeltaNet + attention, MoE, batched paths, speculation
  wgsl/            kernels: base, coop (GEMV family), qwen35 (DeltaNet), gemm (prefill), moe
  gguf.js · tokenizer.js · sampling.js · quant.js · autotune.js · selftest.js · safetensors.js
room.js            the room: signaling, links, layer split, downloads, the generation loop
room/              transport and wire, conversation, models, plan, lookup drafts, preflight, QR, room card, Code pane
harness/           Code mode: agent loop, tools, workspace, preview server and sandbox, sessions
p2p.html           the room's markup and styles (served at /room and /r/<code>)
index.html, site/  the landing page
tests/             unit/ (no GPU) · e2e/ (SwiftShader) · GPU golden tests · run.sh
benchmarks/        tok/s harnesses and the kernel-family profiler
docs/              architecture, kernels, protocol, models, bench log, design, research, archive
roadmap/           one file per planned item

More in docs/architecture.md.

Performance

All numbers use greedy decoding, and the output matches plain one-device decoding. Full history, with commits and caveats, is in docs/bench-log.md.

From disk: Qwen3.8 Flash (experimental)

A Mac Studio running Flash in a Chrome tab, lending 20 GB of GPU memory and reading the rest of the experts from its SSD, then an RTX 5070 PC joining the room with pooled join (10 GB of GPU memory, most of its experts parked in RAM). Both on WiFi, October 13-14, 2026. Answers match llama.cpp's greedy output on the golden prompts, exactly or at near ties within the test's rule.

Setup Decode 8K-token prompt read 32K-token prompt read
Mac Studio alone ~8 tok/s 45.7 s
Mac Studio + RTX 5070 PC 10-12 tok/s (9.4 median on one WiFi night) 35.9 s 82 s

Details: docs/long-context-and-sessions.md, docs/bench-log.md. Demo: SSD demo video.

One device

NVIDIA GB10 (DGX Spark), Chrome, 2026-09-26, coding prompts, speculative decoding with the model's own draft layer.

Model Decode plain Decode speculative llama.cpp CUDA (b10840), same GGUF, same machine
Qwen 3.6 35B MoE 40–46 tok/s 65–84 tok/s 85.5 tok/s decode, 2520 tok/s prefill
Qwen 3.8 27B 10.1–10.8 tok/s 20–27 tok/s 13.8 tok/s decode

Since this table (main as of 2026-10-02, same GB10, see docs/bench-log.md): MoE prompt processing is about 2x faster (Deno, 2048 tokens: 402 -> 861 tok/s, #314) and MoE plain decode in Chrome on a chat prompt is 63.9 tok/s at 1K context, 59.6 at 8K and 50.1 at 32K (#315). DP4a prefill is now the default on NVIDIA for both the dense models and the MoE. The rows above are kept as measured on their date; the prompts differ, so don't compare them directly with the newer numbers.

Native llama.cpp is still ahead on plain decode (in this table about 2x on the MoE and 1.3x on the 27B; on the MoE's 2026-10-02 numbers, 63.9 against 85.2 tok/s, about 1.3x). Speculative decoding closes most of that on code, where 70–85% of drafts are accepted. Prefill is the biggest gap (MoE prefill is now ~861 tok/s against llama.cpp's ~2,400): in this table the first token of a 172-token prompt takes about 1.0 s on the MoE and 2.5 s on the 27B, against roughly 0.07 s and 0.5 s native. Faster prefill is the top item on the roadmap.

Across devices, with emulated network latency

Same GB10, 2026-09-27. Each device is its own headless Chromium with real WebRTC over loopback, and every frame of model data a device sends is held back by the stated one-way delay (a timer in the page, not a real network). A 172-token itinerary prompt (japan), 128-token answers, mean of two. Decode tok/s, plain / speculative:

Model Devices 0 ms 5 ms 20 ms 50 ms Time to first token
35B MoE 1 32.5 / 44.2 1.04 s
35B MoE 2 27.9 / 32.7 21.1 / 27.9 12.9 / 20.6 7.2 / 13.5 1.10 s (1.13 s at 50 ms)
35B MoE 3 24.8 / 33.3 17.7 / 26.9 9.9 / 17.5 5.2 / 10.8 1.14 s
27B 1 9.2 / 14.6 2.57 s
27B 2 8.6 / 11.9 7.8 / 10.9 6.3 / 9.3 4.6 / 7.6 2.52 s (2.53 s at 50 ms)
27B 3 8.4 / 11.0 7.3 / 10.2 5.5 / 8.6 3.7 / 6.6 2.53 s (2.55 s at 50 ms)

Caveats: loopback has no bandwidth limit, loss or jitter, and only model-data frames are delayed. All devices share one GPU, so their compute never overlaps, which makes the 0 ms rows pessimistic compared with separate machines. Harness: tests/e2e/room_latency.mjs.

How it compares

Other projects split models across machines or run models in a browser tab. Each published speed below is for a different model on different hardware, so read it as what each project can do, not as a ranking. Of the projects that pool several devices, Pooled is the only one where every device just opens a URL, and none of the others ships a coding agent that runs in the browser.

Project Runs in Pools several devices Install per device Published speed (source, hardware) Coding agent built in
Pooled browser tab (WebGPU) yes, layers split across laptops, desktops and phones over WebRTC none, open a URL 35B MoE: 40–46 tok/s plain, 65–84 speculative on one GB10 (2026-09-26, coding prompts; 64 plain at 1K context on 2026-10-02); 13 / 21 on two devices at 20 ms emulated latency (Performance) yes, Code mode runs in the tab
exo native (MLX); macOS app, Linux CPU only for now yes, with RDMA over Thunderbolt 5 on Macs macOS app (DMG or brew install --cask exo) or build from source 31.9 tok/s Qwen3 235B and 32.5 tok/s DeepSeek V3.1 671B, both on 4x M3 Ultra Mac Studio (Jeff Geerling) no
llama.cpp RPC native yes, remote ggml devices build with -DGGML_RPC=ON on every host; the docs call it fragile and insecure, never for open networks Qwen3 235B: 20.4 tok/s on 1 node, 15.2 tok/s on 4 nodes, 4x M3 Ultra (Jeff Geerling) no
distributed-llama native (CPU, experimental Vulkan) yes, tensor parallel, power-of-2 node counts C++ build plus Python launcher Llama 3.2 3B Q40: 5.95 tok/s on 1 Pi 5, 13.68 tok/s on 4 Pi 5 (#165); Qwen3 30B A3B: 13.04 tok/s on 4 Pi 5 (#255) no
Petals native Python, public or private swarm yes, layers served by volunteers pip package, PyTorch up to 6 tok/s for Llama 2 70B and up to 4 tok/s for Falcon 180B (README); last commit 2024-08-25 no
Mesh LLM native (Rust, llama.cpp) plus a web console yes, layer splits for dense models, expert sharding for MoE, over QUIC install script, Homebrew or distro package none in the README no own agent; launches outside agents against the mesh
WebLLM browser tab (WebGPU) no, whole model in one tab none for users; npm or CDN for developers 41.1 tok/s Llama 3.1 8B vs 57.7 native MLC-LLM on an M3 Max (paper) no
Transformers.js browser or Node (ONNX Runtime, WASM or WebGPU) no none for users; npm or CDN for developers WebGPU up to 100x faster than WASM (v3 post) no

The engine underneath Pooled is our own WGSL, not WebLLM, MLC or llama.cpp. The model weights and tokenizer come from Qwen, hosting from Hugging Face, and signaling from PeerJS.

Research Pooled builds on

Browsers

Chrome on macOS is the tested host. Safari on an iPhone joins a room and holds a few layers. Safari on a Mac reloads the tab under memory pressure when it holds most of the 27B, so do not host from it. Firefox and Linux Chromium need WebGPU turned on and we have not tested them. Devices without WebGPU join as ask-only guests.

Privacy

A room is a shared conversation: everyone in it sees the questions and answers, on purpose. No server sees them. The devices running layers work on hidden states, which are not private against a determined peer, so run rooms with people you would share a document link with. See SECURITY.md.

Roadmap

What's next, by area and priority (P0 now, P1 next, P2 later): roadmap/README.md. Each item will link its GitHub issue once it is filed.

Contributing

See CONTRIBUTING.md and GOVERNANCE.md. Benchmark reports from hardware we don't have are especially welcome (there's an issue template). Contributors are listed in AUTHORS.

Citation

@software{pooled2026,
  author = {Narendrula, Nehanth},
  title  = {Pooled: peer-to-peer LLM inference in the browser},
  year   = {2026},
  url    = {https://github.com/Nehanth/pooled}
}

Acknowledgements

Model weights and the GGUF format come from the Qwen team and llama.cpp / ggml, whose speculative-decoding graph for Qwen 3.5/3.8 was the reference for ours. Prior work that shaped this: Petals, exo, WebLLM, LlamaWeb, and the Gated DeltaNet and PipeInfer papers.

License

MIT.

pooled (Nehanth/pooled)

正在搜索数据库…

这是什么?SwarmLLM 把多台在浏览器标签页中打开的设备的 WebGPU 算力汇集起来,以运行任何单台设备都无法独自容纳的大型开源模型:它把模型拆分成层切片,并通过 WebRTC 在设备之间传递小型激活向量。
我需要安装什么吗,还是直接在浏览器里就能运行?这是一个基于浏览器的网页应用:打开 swarmllm.ai/room 即可,无需安装、无需账号,由一个定制的 WebGPU 引擎(约 50 个 WGSL 内核)在标签页内完成实际推理。
我怎么汇集我的设备并开始聊天?打开 swarmllm.ai/room,创建一个房间,把房间码分享给你的其他设备,选择一个模型,然后开始;每台设备只下载分配给自己的层,并缓存起来供下次使用。
想改造引擎本身需要什么?要在本地运行或修改引擎,你需要 Deno 2.x 和一块支持 WebGPU 的 GPU;模型文件按照 docs/models.md 的说明放在 models/ 文件夹下。
它在所有浏览器里的表现都一样吗?macOS 上的 Chrome 是唯一经过完整测试的主机。iPhone 上的 Safari 可以加入并承载小切片,但 Mac 上的 Safari 在承载大切片时会因内存压力重新加载标签页,所以别用 Safari 当主机。Firefox 和 Linux 上的 Chromium 需要手动启用 WebGPU,作者也未对它们进行测试。
当我的对话分散在别人的设备上时,还能保持私密吗?任何服务器都看不到聊天内容,但它并非完全私密:按设计,房间里的每个人都能看到共享的问答;而且任何负责计算某一层的节点都会接触原始的模型中间激活值,这些数据对蓄意窥探的节点同样没有防护。
我实际能用它运行哪些模型?GGUF Q40 格式的 Qwen 3.8 27B 是旗舰模型(混合 Gated-DeltaNet 加注意力机制,带 MTP 投机采样),此外还有用于黄金测试的较小的 Qwen3 0.6B/1.7B/4B,以及作为轻量演示的 SmolLM2 135M。
和原生运行 llama.cpp 相比它有多快?在 NVIDIA GB10 上,SwarmLLM 的 WebGPU 引擎普通模式达到 9.0 tok/s,开启投机解码后达到 16.1 tok/s,在相同的 GGUF 文件和 GPU 上实际上比原生 llama.cpp 的 8.0 tok/s 更快,因为它能更充分地占满内存带宽。
它和 exo 或 Petals 有什么不同?那些方案仍然需要在每个节点上安装 Python 包或客户端/服务端;SwarmLLM 除了一款支持 WebGPU 的浏览器之外什么都不用安装,而且房间既可以覆盖同一 Wi-Fi 下的设备,也可以通过 WebRTC 跨越互联网。
为什么设备之间较慢的网络连接不会毁掉性能?预填充阶段每次网络往返批量处理 16 个 token,解码阶段则把投机草稿串联起来,因此即使是较慢的连接,每一轮也能搬运多个 token,而不是只有一个。
作者
Nehanth
大小
186.8 MB
星标
658
时长
3个月
提交 · 90 天