Qwen3-0.6B-diffusion-mdlm-ONNX (fused fp16, for the browser)
ONNX export of dllm-hub/Qwen3-0.6B-diffusion-mdlm-v0.1
(Tiny-A2D: Qwen3-0.6B adapted to masked text diffusion) packaged to run client-side in a
web browser on WebGPU via onnxruntime-web. To our
knowledge this is the first text-diffusion LM whose denoising loop runs in-browser (image
diffusion in-browser is common; text diffusion has been server-side until now).
Generation is a JS denoising loop — start fully masked, run a full forward over the canvas, lock the
highest-confidence tokens, repeat — implemented in kohra
(kohra.js), a small transformers.js-style module.
Use it
Grab the loader (kohra.js, one file — it's in this repo, or in the
kohra project at kohra.js) and import it locally;
the model + tokenizer load from this HF repo:
import { pipeline } from './kohra.js';
const generate = await pipeline('text-diffusion', {
model: 'https://huggingface.co/naklitechie/Qwen3-0.6B-diffusion-mdlm-ONNX/resolve/main/onnx/model_fp16_fused.onnx',
tokenizer: 'naklitechie/Qwen3-0.6B-diffusion-mdlm-ONNX',
});
const { text, tokensPerSecond } = await generate('Lily runs 12 km/h for 4 hours. How far in 8 hours?');
console.log(text, `(${tokensPerSecond.toFixed(1)} tok/s)`);
Requires a WebGPU browser (Chrome/Edge 121+) served over https or localhost. ~1.4 GB download (fp16, cached by the browser after first load); ~9.8 tok/s on an M-series Mac at 128 denoise steps.
Files
onnx/model_fp16_fused.onnx(+.onnx.data) — fp16 weights with RMSNorm fused toSimplifiedLayerNormalization. The fusion is required: a decomposedPow(x,2)RMSNorm overflows native fp16 on WebGPU and silently produces all-zero logits; the fused contrib op reduces in fp32. Recipe + forensics: the kohra repo'sreference/MDLM-algorithm.md.onnx/model_q4f16_rtn_sym.onnx(+.onnx.data) — 4-bit (RTN, symmetric) q4f16, ~680 MB. Coherent on WebGPU with stable onnxruntime-web 1.30.0, the versionkohra.jsloads; passgraphOptimizationLevel: 'all'. The RTN packing is what ORT-web's WebGPUMatMulNBitskernel expects; the default quantizer's packing yields wrong logits on WebGPU.- Tokenizer files (Qwen3 ChatML).
Notes
- No KV cache — bidirectional attention, one full forward per denoise step. Cost is steps × forward, not tokens; parallel block denoising is what plays to WebGPU.
- A block-diffusion sibling with stronger reasoning is at
naklitechie/Qwen3-0.6B-diffusion-bd3lm-ONNX.
Attribution & license
Derivative of dllm-hub/Qwen3-0.6B-diffusion-mdlm-v0.1 (built on Qwen/Qwen3-0.6B, Apache-2.0;
MDLM adaptation by dLLM). See the source repos for exact terms.