Contributing
Adding a model
Which models the engine can run, and the steps to add one to the room.
Pooled ships no weights: browsers fetch tensors from Hugging Face with range requests, and tests read the same files from models/. A model the engine already understands needs a few lines in room/models.js. A new architecture is a bigger job.
What the engine runs today
Section titled “What the engine runs today”| Model | File | Engine | Notes |
|---|---|---|---|
| Qwen 3.8 27B | GGUF Q4_0, about 15 GB, with the nextn draft layer |
Qwen35Engine |
64 layers: 48 Gated DeltaNet and 16 attention. Speculative decoding with the built-in draft layer. |
| Qwen 3.6 35B MoE (A3B) | GGUF Q4_0 (bartowski) | Qwen35Engine (qwen35moe) |
256 experts, 8 active per token. Router, experts and shared expert run on the GPU. |
| Qwen3 4B, 1.7B, 0.6B | GGUF Q4_0 or Q8_0 | DenseEngine |
0.6B is the golden-test model. |
| SmolLM2 135M | safetensors f32 | DenseEngine |
The smallest demo. Quantized to Q8 at load. |
Models that share the hybrid layout of Qwen 3.5, 3.6 and 3.8, such as Qwen 3.5 2B or 9B, need only catalogue entries.
-
Check the tensors. Make sure the GGUF’s tensor names and shapes match one of the two engines.
engine/gguf.jsholds the maps from ggml tensor names to the engine’s internal names. -
Add the model to the room’s catalogue in
room/models.js:// the whole model's memory need across the room, in GBexport const NEED_GB = { /* … */ "my-model": 6.2 };export const MODELS = {/* … */"my-model": { label: "My Model · Q4", kind: "qwen35",gguf: "https://huggingface.co/<org>/<repo>/resolve/main/<file>.gguf" },};// optional: default and largest context, when it should differ from the engine's defaultexport const CTX = { /* … */ "my-model": { def: 16384, max: 32768 } };kindisgguffor the dense engine,qwen35for the hybrid engine (including MoE), orsafetensors. Dense models also needcfgandtokURLs forconfig.jsonandtokenizer.json. The numbers above are placeholders: measureNEED_GBfor your model. -
Decide whether the picker offers it.
PICKERlists the models people can choose. A picker model also needs aFILE_GBentry (the GGUF’s size on Hugging Face), so the picker can say how much each device will download. Every other model stays available to tests and to rooms opened with?dev=1. -
Make a golden and add a test. The CPU reference implementations in
tests/reference/are the source of truth that the WebGPU kernels must match:QWEN_DIR=../../models/mymodel node tests/reference/ref_qwen.mjs "The capital of France is" 8 --golden tests/golden/golden_mymodel.jsonref.cjscovers Llama-style safetensors models,ref_qwen.mjsdense Qwen3 GGUFs (QWEN_DIRpicks the folder, relative totests/reference/), andref_q38.mjsthe Qwen 3.8 hybrid.A golden holds the prompt’s token ids, per-layer hidden-state samples, the top logits and the generated tokens. Add a
tests/test_<model>.jsthat compares against it. See Testing. -
Measure it. Record decode and prefill tokens/s in
docs/bench-log.md, with the hardware and the commit. See Benchmarking. -
Update the docs. Add the model to
docs/models.md, and to Which models fit if it is in the picker.
Context length
Section titled “Context length”The context a room opens with comes from CTX in room/models.js, and ?ctx=N can ask for any length up to max:
| Model | Default (def) |
Ladder | Picker (options) |
Max |
|---|---|---|---|---|
| Qwen 3.8 27B | 16384 | 65536, 32768, 16384, 8192 | 8K, 16K, 32K, 64K | 65536 |
| Qwen 3.6 35B MoE | 32768 | 131072, 65536, 32768, 16384, 8192 | 8K, 32K, 64K, 128K | 131072 |
| Qwen3.8-Flash-Next | 65536 | 65536 … 2048 (FLASH_CTX_PROVEN) |
8K, 32K, 64K | 65536 |
| Qwen3 1.7B | 16384 (fallback: 8192) |
none | none | 16384 |
A ladder is the lengths a room may open the model at, longest first; put a length on it only once it is checked correct on that model (docs/long-context-and-sessions.md). room/ctxpick.js roomCtxPlan picks one: the longest step the room’s pledges hold, but past def only at full speed (the deal by memory keeps every expert on a GPU and uses no more devices than at def). A fallback is the context a room opens with when its pledges can’t hold the model at the default but can there. The room page (picker and Start), the room node (pooled host, pooled serve’s room, the OpenClaw plugin) and pooled host’s screen all call roomCtxPlan, and say so when they fall back. NEED_GB is the need at def, NEED_MIN_GB at the fallback or the ladder’s last step. An explicit ?ctx= or --ctx is tried alone and never lowered.
Without a CTX entry a model gets 8192 tokens on the hybrid engine and 2048 on the dense engine. The hybrid models keep a KV cache only on their full-attention layers, so long context is cheap in memory; the practical limit is prefill speed. See Long context and sessions.