October 29, 2026

Spark-X2.6-1.7B

Running in your browser

XHToken's 1.7B model, using its official 4-bit weights, running on the GPU in Chrome and Edge. In testing the earlier ONNX build scored the same as the official INT4 release and generated about 105 tokens per second on a desktop GPU, from a 1.2 GB download.

Historical note: the charts and speed numbers below were measured with the previous ONNX Runtime build. The current app uses a custom WGSL decoder, a 32K context window, and automatic context compaction; it measured about 35 tokens per second on an Intel Iris Xe in this workspace. See docs/RUNTIME.md for the current runtime contract.

The chat app answering a coding question with thinking on
The chat app answering a coding question with thinking on. Everything runs on the local GPU.

Spark-X2.6-1.7B is the smaller model of XHToken's Spark-X2.6 series, aimed at on-device agents: tool use, coding and long context, with a thinking budget that can be set to high, low or off. This build runs the official INT4 codes through a hand-written WGSL decoder with a 32K context window. The model runs inside a browser tab, and what you type stays on your machine.

How Spark-X2.6-1.7B compares

XHToken reports these results for Spark-X2.6-1.7B against open models of similar size, all with thinking on, with their Spark-X2.6-4B as a reference. Across 30 benchmarks it averages 49.6, ahead of MiniCPM5-2B (46.9) and well ahead of Qwen3.5-2B (22.0) and Gemma4-E2B (22.5). It leads on agent and coding work such as web browsing, MCP tool use and software engineering; MiniCPM5-2B is ahead on competition math, BFCL-V4, AA-LCR and GPQA.

How Spark-X2.6-1.7B compares

Reported by XHToken for the original Spark-X2.6-1.7B, thinking on at high effort; Spark-X2.6-4B is their reference. Source: the Spark-X2.6-1.7B model card on Hugging Face.

All 30 benchmarks

Spark-X2.6-1.7B benchmark results

As reported by XHToken, thinking on at high effort. * Taken by XHToken from that model's published card or paper. A dash means not reported. Gaokao 2026 is scored out of 150. Spark-X2.6-4B is included as a reference and not ranked.

The browser build scores the same

A different runtime and 4-bit weights can change a model's answers, so the browser build was tested against the original model in transformers: same prompts, same chat template, greedy decoding, thinking off. Every browser number comes from the actual web page, run in headless Chrome.

The browser build scores the same as the official model

Spark-X2.6-1.7B, q4f16 build in Chrome. GSM8K: all 1,319 test problems. BFCL v3: the first 200 simple function-calling cases. Needle in a haystack: 12 prompts from 1k to 16k tokens.

The browser build matches the official INT4 checkpoint on all three. On GSM8K the two disagree on 38 and 38 problems in the two directions (McNemar p = 1.00); on BFCL on 4 and 4 cases (p = 1.00). At the level of individual tokens, the build adds a mean KL divergence of 0.00085 on top of the INT4 quantization, and 30 minutes of back-to-back generation produced no errors and no slowdown.

The 4-bit weights themselves cost this model more than they cost the 4B: the official INT4 checkpoint scores 24 points lower on BFCL function calling and 3 points lower on GSM8K than the original bf16 model, mostly because it answers in text more often where the original calls a tool. The browser build reproduces the INT4 checkpoint, including that.

Validation against the original model

A check passes when the browser build is not measurably worse than the official INT4 weights in transformers.

Speed

In the earlier ONNX build on a desktop GPU, the model generated about 105 tokens per second and started answering a short prompt in 49 ms. Generation kept that pace as the conversation grew: 107 tokens per second at 16,000 tokens of context. Long prompts took longer to read before the first token: 618 ms for 2,300 tokens and 5.9 s for 16,000.

1.2x to 1.5x the decode speed of the 4B build

Decode speed in tokens per second by length of the prompt, this build next to the Spark-X2.6-4B build, measured the same way on the same machine.

Decode speed

tokens per second

Time to first token

seconds

Measured in Chrome on Windows with an NVIDIA RTX 3090 Ti, one request at a time. Speed depends on the GPU.

Get started

The model is a folder of static files and the loader is a few JavaScript modules, with no build step and no server code.

  1. Chat in the browser

    Open the chat in desktop Chrome or Edge. The model downloads once (1.20 GB) and loads from the browser cache afterwards.

  2. Run it locally

    Serve the static Space files locally. The app loads the model from Hugging Face unless a local bundle exists in spark/runtime.

    git clone https://huggingface.co/spaces/leventkoldas/Spark-X2.6-1.7B-WebGPU-Runtime
    cd Spark-X2.6-1.7B-WebGPU-Runtime
    python3 -m http.server 8000
  3. Use it in your own app

    Copy lib/ and the import map from index.html. generate streams text and accepts temperature, maxNewTokens, effort, tools and an abort signal.

    import { loadSpark } from "./lib/runtime/index.js";
    
    const spark = await loadSpark({
      base: "https://huggingface.co/leventkoldas/Spark-X2.6-1.7B-WebGPU-Runtime/resolve/main",
    });
    
    const messages = [{ role: "user", content: "Hello!" }];
    for await (const text of spark.generate(messages, { thinking: false })) {
      output.textContent += text;
    }
  4. Reference ONNX build

    The earlier ONNX export remains available in mohdmahmodi/Spark-X2.6-1.7B-ONNX-WebGPU and loads with Transformers.js for comparison. The runtime above is faster at long context, since it keeps the KV cache in one preallocated buffer.

    import { pipeline } from "@huggingface/transformers";
    
    const generator = await pipeline("text-generation", "mohdmahmodi/Spark-X2.6-1.7B-ONNX-WebGPU", { device: "webgpu", dtype: "q4f16" });
    const out = await generator([{ role: "user", content: "Hello!" }], {
      max_new_tokens: 256, tokenizer_encode_kwargs: { enable_thinking: false },
    });
    console.log(out[0].generated_text.at(-1).content);

How it is built

The runtime keeps XHToken's INT4 codes byte-for-byte: most projections are 4-bit with group-32 scales and zero points, while out_proj and lm_head are 8-bit symmetric. tools/pack_weights.py copies those payloads into a 256-byte-aligned bundle and writes runtime/manifest.json, which is the only source of tensor offsets. Decode runs f16 activations and f16 KV through WGSL kernels; RMSNorm statistics, weight dequantization and softmax accumulate in f32. The ONNX graph is an offline packing input and validation reference only.

A prompt is pre-filled in 256-token GEMM chunks. Full-attention layers keep a 32,768-position KV cache, sliding layers use a 1,024-position ring, and a follow-up message reuses the longest matching prefix of the previous prompt. Each token is one state write, one command submit and a 2 KB readback of the top-256 candidates; greedy decoding reads back 4 bytes. The source repository holds the earlier ONNX export, its validation report, and the chat app history.

Limitations