Qwen3-30B-A3B LiteRT-LM Models

Qwen/Qwen3-30B-A3B, Qwen's mixture-of-experts model, written with the LiteRT Tensor API and packed with litert-lm-builder 0.19.0 into two LiteRT-LM files, decodes 101.49 tokens/s on an Apple M4 Max with WebGPU (measured 2026-11-11). That is the file with the 2,048-token KV cache; the 4,096-token one decodes 80.50 tokens/s. Both need a LiteRT-LM built from source with two open LiteRT pull requests; LiteRT-LM 0.19.1 does not run them. Speed still being tuned (updates follow).

Available Artifacts

File Quantization Context Size
qwen3_30b_a3b_mixed_int4_ekv2048.litertlm experts int4 blockwise (block 32, fp32 scales); attention q / k / v / o and lm_head int4 blockwise (block 32, fp16 scales); router, norms and token table fp32; KV cache tensors fp32 in the graph 2048 20.65 GB
qwen3_30b_a3b_mixed_int4_ekv4096.litertlm experts int4 blockwise (block 32, fp32 scales); attention q / k / v / o and lm_head int8 per channel; router, norms and token table fp32; KV cache tensors fp32 in the graph 4096 20.65 GB

The two files hold the same experts, router and token table; their attention and lm_head weights differ (int4 in the 2,048-token file, int8 in the 4,096-token file), and so does the graph of their attention. The KV cache holds 2,048 or 4,096 tokens. The 2,048-token file declares fp16 activations, the 4,096-token file fp32.

Updates

2026-11-12: in the 2,048-token file the attention q / k / v / o and lm_head weights are now int4 (blockwise, block 32, fp16 scales; they were int8 per channel), each layer's q, k and v projections are one fully connected op that feeds one odml.qkv_norm_rope, and each layer's attention core (its two matmuls, the mask and the softmax) is one odml.sdpa_transposed. Measured side by side on WebGPU, it decodes 16.8 % faster and prefills 15.4 % faster than the previous file. sha256: qwen3_30b_a3b_mixed_int4_ekv2048.litertlm 51b287de… → 2307254a…. The 4,096-token file is unchanged: with the same change it prefilled about 6 % slower on the CPU. Checked with the build below on an Apple M4 Max: on WebGPU it passes the 12 questions and the 3-turn conversation described under Accuracy (greedy). Made from the previous file by int4_attention.py and decode_rewrite.py. In MEASUREMENTS.md, the sections headed "the files of 2026-11-11" are about the 4,096-token file and the 2,048-token file before this update.

2026-11-11: both files now carry a graph rewritten for the GPU: RMSNorm, the q / k norm with RoPE, the KV-cache write and the attention matmuls are composite ops (odml.*), and the router applies its softmax to the top 8 logits only. The 2,048-token file now declares fp16 activations. On WebGPU, in the same runs, the 2,048-token file decodes 43.5 % faster and the 4,096-token file 56.0 % faster than the previous files. On the CPU, the 4,096-token file decodes and prefills at the previous file's speed. The weights, metadata and tokenizer are the previous files' bytes at the same offsets (20,650,316,480 B each). sha256: qwen3_30b_a3b_mixed_int4_ekv2048.litertlm a748069e… → 51b287de…, qwen3_30b_a3b_mixed_int4_ekv4096.litertlm d908241e… → 287eeb63…. Checked with the build below on an Apple M4 Max: 12 / 12 questions and the 3 turns, greedy, on WebGPU (both files) and on the CPU (the 4,096-token file). Made from the previous files by gpu_rewrite.py, and the 2,048-token file's fp16 declaration by set_activation_type_inplace.py. Numbers dated 2026-11-03 in MEASUREMENTS.md are the previous files'.

Conversion Notes

Qwen/Qwen3-30B-A3B is Qwen's mixture-of-experts model: 48 layers with 128 experts each, 8 of them used for each token, 30.5B parameters of which 3.3B are activated (source model card). By default its chat template turns thinking on, so each reply starts with a thought.

LiteRT-LM 0.19.1, the latest release on 2026-11-11, does not run these files. Each layer's experts are one moe custom op with SiLU, and the moe kernels of LiteRT-LM 0.19.1 accept only GELU: from PyPI, on the CPU it stops with moe node #23 unsupported activation='silu' (#36 in the 4,096-token file), and on the GPU with moe only supports activation='gelu_tanh' (or its legacy spelling 'gelu'). SiLU in the moe op is in two LiteRT pull requests, open on that day: #11192 (the GPU kernel) and #11188 (the XNNPACK kernel, CPU). The 2,048-token file's GPU path also needs the kernel of the attention composite odml.sdpa_transposed, which LiteRT-LM's GPU accelerators carry in 0.19.0 or newer. The build that ran every number on this page is under Build the runtime; it has the two pull requests and that kernel.

Written tensor by tensor with the LiteRT Tensor API (LiteRT dcb657e8 with a small patch in the conversion scripts) from the bf16 checkpoint, and packed with litert-lm-builder 0.19.0. Each layer's 128 experts are one moe custom op with activation='silu' (checked against Transformers through the logits), and each moe output has a second consumer ((x + moe) + moe * 0, numerically exact) so ML Drift does not fuse the residual add into the moe kernel; when it does fuse it, the kernel's shader does not compile. fp32 activations are declared in the 4,096-token file and fp16 activations in the 2,048-token file, which passed the same checks. In the 2,048-token file the attention and lm_head weights are int4 in blocks of 32 along the input, one fp16 scale per block chosen by a clip search and a least-squares fit; in the 4,096-token file they are int8 per channel. Scripts and checks: john-rocky/hf-to-litertlm: qwen3_30b_a3b_work; details: MEASUREMENTS.md.

Performance

File Backend Prefill (1,024 tokens) Decode (256 tokens) Peak footprint
ekv2048 GPU (WebGPU) 1,330.58 tokens/s 101.49 tokens/s 26 GB
ekv4096 GPU (WebGPU) 917.62 tokens/s 80.50 tokens/s 33 GB
ekv4096 CPU (XNNPACK) 59.06 tokens/s 4.79 tokens/s 5.74 GB

litert_lm_advanced_main built as below on an Apple M4 Max (128 GB, macOS 27.0), 2026-11-11: the median of 3 processes on each backend. The 2,048-token file and the previous 2,048-token file (86.91 tokens/s decode) were measured in one session, taking turns. The 4,096-token file's rows are from its update of 2026-11-11; in those sessions the file it replaced decoded 51.59 tokens/s on the GPU and 4.71 on the CPU, and prefilled 59.58 tokens/s on the CPU. The GPU footprints are rounded to whole GB, because top reports whole GiB above 10 GiB (24 and 31 GiB here). Flags, per-process values and how the footprint was read: MEASUREMENTS.md.

The 2,048-token file was not checked or timed on the CPU; on the CPU, use the 4,096-token file. No phone was tried: each file is 20.65 GB.

Accuracy

File Backend Same verdict as Transformers Ends with the stop token 3 turns
ekv2048 GPU (WebGPU) 12 / 12 12 / 12 pass
ekv4096 GPU (WebGPU) 12 / 12 12 / 12 pass
ekv4096 CPU (XNNPACK) 12 / 12 12 / 12 pass

12 questions and a 3-turn conversation, greedy (--sampler_top_k=1), thinking on, up to 2,048 tokens per answer, judged against Transformers with the bf16 weights (2026-11-10 and 11). Questions and details: MEASUREMENTS.md.

Build the runtime

LiteRT-LM dab2e708 with LiteRT dcb657e8 and ml-drift 76492bb9, with the two pull requests applied. --override_repository skips the patch commands that LiteRT-LM's WORKSPACE applies to the LiteRT and ml-drift archives, so apply_ws_patch_cmds.py (in the conversion scripts' directory) applies them by hand; it needs GNU sed installed as gsed. The block also needs Xcode, Git LFS set up with git lfs install, and Bazelisk, which installs as bazel and runs the Bazel 7.6.1 that LiteRT-LM's .bazelversion names (Homebrew: gnu-sed, git-lfs, bazelisk). Run it in an empty directory; if a line fails, empty the directory and start again from the first line:

git clone https://github.com/google-ai-edge/LiteRT-LM.git && cd LiteRT-LM
git checkout dab2e708dc5750549685692863039c5a954c3a35
git lfs pull --include "prebuilt/macos_arm64/*"
cd ..
git clone https://github.com/google-ai-edge/LiteRT.git && git -C LiteRT checkout dcb657e8a537b2dc944e53e14c7eb43bcd9ededa
git clone https://github.com/google-ai-edge/ml-drift.git && git -C ml-drift checkout 76492bb9412030ec93cc5b607df26ab5cf787490
curl -fLO https://raw.githubusercontent.com/john-rocky/hf-to-litertlm/84336e8d00a567464e834854bdc1987a5c6656ca/qwen3_30b_a3b_work/apply_ws_patch_cmds.py
python3 apply_ws_patch_cmds.py LiteRT-LM/WORKSPACE litert LiteRT
python3 apply_ws_patch_cmds.py LiteRT-LM/WORKSPACE ml_drift ml-drift
curl -fL https://github.com/google-ai-edge/LiteRT/commit/ebacd381a0d223a585ec66c1e880cffa640b29be.diff | git -C LiteRT apply
curl -fL https://github.com/google-ai-edge/LiteRT/commit/9860c14d7b63f6eaa85b9bfbe807afc971b85fe4.diff | git -C LiteRT apply
cd LiteRT-LM
bazel build --config=macos_arm64 -c opt --define=litert_runtime_link_mode=dynamic \
  --override_repository=litert=$PWD/../LiteRT --override_repository=ml_drift=$PWD/../ml-drift \
  //runtime/engine:litert_lm_advanced_main @litert//litert/c:litert_runtime_c_api_dylib \
  @litert//litert/runtime/accelerators/gpu:ml_drift_webgpu_accelerator_dylib

The two commits are the heads of LiteRT pull requests #11192 (ebacd381) and #11188 (9860c14d) on 2026-11-13, one commit each; the build behind this page's numbers applied the same two diffs. Copy bazel-bin/runtime/engine/litert_lm_advanced_main, bazel-bin/external/litert/litert/c/libLiteRt.dylib and bazel-bin/external/litert/litert/runtime/accelerators/gpu/libLiteRtWebGpuAccelerator.dylib into one directory with prebuilt/macos_arm64/libwebgpu_dawn.dylib and prebuilt/macos_arm64/libGemmaModelConstraintProvider.dylib (paths from LiteRT-LM, where the block ends); the CLI does not start without the last two, also on the CPU. Put the model file that the command under Run names (qwen3_30b_a3b_mixed_int4_ekv2048.litertlm, 20.65 GB, under Files and versions; no other file is needed) in the same directory and run the command there. On 2026-11-13 the block ran as written in an empty directory on an Apple M4 Max (Xcode 27.0, macOS 27.0): it took 25 minutes and 11 GB of disk and built the three files of the build behind this page's numbers byte for byte. With them, the command under Run printed its thought and then 17 + 25 = 42. and ended after 49 s.

Run

The command of the GPU checks above:

./litert_lm_advanced_main --backend=gpu --model_path=qwen3_30b_a3b_mixed_int4_ekv2048.litertlm \
  --max_output_tokens=2048 --min_log_severity=2 --sampler_top_k=1 --sampler_handles_input=false \
  --cache_dir=:nocache --input_prompt="What is 17 + 25? Answer briefly."

On the CPU, use --backend=cpu and drop --sampler_handles_input=false; the CPU checks above gave --cache_dir a directory in place of :nocache. The CLI prints the model's thought between [thought] and [/thought], then the answer.

License

Apache License 2.0, the license of Qwen/Qwen3-30B-A3B.

Citation

@misc{qwen3technicalreport,
      title={Qwen3 Technical Report},
      author={Qwen Team},
      year={2025},
      eprint={2505.09388},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2505.09388},
}
Downloads last month
634
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for litert-community/Qwen3-30B-A3B

Quantized
(156)
this model

Paper for litert-community/Qwen3-30B-A3B