rlx-qwen3
Alibaba Qwen3 dense causal-LM family (0.6B / 1.7B / 4B / 8B / 14B / 32B) for RLX — GQA + QK-norm + SwiGLU MLP + RoPE. Ships a compiled prefill graph, a bucketed KV-cache decode loop, and an optional MTP speculative-decode head. Weight keys mirror HF's Qwen3ForCausalLM, so safetensors checkpoints load with no remapping; GGUF works too via the rlx_core::weight_loader adapter.
Quick start
The CLI takes token ids (there is no built-in tokenizer yet):
# or directly:
Key flags (see --help / src/cli.rs): --device cpu|metal|mlx|cuda|rocm|gpu|vulkan, --config config.json, --format safetensors|gguf, --max-seq, --precision f32|f16-lm, --packed, --use-mtp, --temperature, --top-p, --prefer-quant.
Large GGUFs (≥ 256 MB) auto-enable packed weights — K-quant tensors stay packed in the arena and each matmul emits Op::DequantMatMul, cutting host memory ~6× so 14B+ models fit on commodity hardware.
Public API
use ;
use Device;
let mut runner = builder
.weights // safetensors or gguf (autodetected)
.device
.max_seq
.precision
.build?;
let prompt_ids: & = &;
let out = runner.generate?;
# Ok
Lower-level entry points are also public:
Qwen3Config— HFconfig.json/ GGUF-metadata deserialiser.build_qwen3_graph_sized— emit the prefill IR graph for a concrete(batch, seq).build_qwen3_decode_graph_sized— the incremental KV-cache decode graph.Qwen3Generator— streaming prefill + cached decode driver.Qwen3Speculator— MTP-head draft/verify speculative decoding.- [
SampleOpts] /sample_token— temperature / top-p sampling.
Dimensions are baked into each compiled graph, so consumers keep a shape→graph cache and recompile on a new (batch, seq) bucket.
Backends
Prefill and KV-cache decode run on every standard RLX backend when the matching rlx-runtime feature is enabled: metal, mlx, cuda, rocm, gpu (wgpu), vulkan, coreml. Build with all-backends (or apple-silicon / nvidia-gpu / amd-gpu / portable-gpu) for a single binary that accepts every --device value. validate_device reports what the current build supports.
Examples
pipeline_bench / pipeline_multiproc exercise the block-pipelined (BlockSpec) prefill/decode stages.
How it fits
- rlx-qwen35 — Qwen3.5 / 3.6 hybrid trunk, reuses
rlx_qwen3::sampling. - rlx-omnicoder — OmniCoder wrapper over [
Qwen3Runner] with arch validation.