eqx-zoo 0.3 adds the first mixture-of-experts architecture.
Highlights
- **Qwen3-MoE.** `CausalLM.from_pretrained` loads `Qwen3MoeForCausalLM` checkpoints, the architecture of Qwen3-30B-A3B. Each token is routed to its top-k experts, and experts are computed together with grouped matrix multiplications (`jax.lax.ragged_dot`), so compute scales with the active experts rather than all of them.
- **Verified on a trained model.** [MiniMind-3 MoE](https://huggingface.co/jingyaogong/minimind-3-moe) passes the full parity suite: layer by layer, logits, greedy generation, KV cache, bf16, padding and batching. A tiny random-weight Qwen3-MoE covers top-2 routing, mixed MoE/dense layers and an untied head.
- **Mixed layers.** Models can combine MoE and dense layers, following `decoder_sparse_step` and `mlp_only_layers` as in the reference implementation.
- **Both config formats.** The expert count is read from `num_experts` (transformers 4.x) or `num_local_experts` (5.x).
API changes
- **New:** `eqx_zoo.layers.SparseMoE`. `Config` gains `num_experts`, `num_experts_per_tok`, `moe_intermediate_size`, `norm_topk_prob` and `moe_layers`, with defaults meaning a dense model. `DecoderLayer` takes a `moe` flag.
Project
- `CONTRIBUTING.md` describes setup, conventions, how to add a model, and the release process.
- `CITATION.cff` enables GitHub's "Cite this repository".
- Dependabot keeps the CI actions up to date.
Known issues
- `generate_batch` processes prompts for MoE models one after another, because `jax.lax.ragged_dot` cannot yet be vmapped (23). Results are exact.
- JIT-compiled bf16 is less accurate than eager bf16 (11).
- The bf16 tests don't cover long-context softmax precision (12).
Install
pip install --upgrade eqx-zoo