Qwen3-0.9B-A0.8B-small
This is a small version of Qwen/Qwen3-30B-A3B created for testing and development. It keeps every hyperparameter of the base model identical (hidden sizes, head counts, MoE topology, vocabulary, untied embeddings) and only reduces the number of decoder layers and the number of experts per MoE layer.
Model Details
- Base Model: Qwen/Qwen3-30B-A3B
- Architecture: Qwen3MoeForCausalLM (
qwen3_moe) - Total Parameters: 0.89B
- Activated Parameters: 0.85B (topk 8 of 10 routed experts per layer)
Configuration Changes
Only the allowed change classes were applied; everything else is identical to the base:
| Parameter | Base | Small |
|---|---|---|
num_hidden_layers | 48 | 4 |
num_local_experts | 128 | 10 |
All layers are MoE (decoder_sparse_step 1, mlp_only_layers []) with full attention, as in the base. 10 experts = topk (8) + 2 so that routing is actually exercised (8 = topk would make every expert always active). num_experts_per_tok (topk 8) is unchanged. All other values are kept from the base, including hidden_size 2048, moe_intermediate_size 768, 32 attention heads / 4 KV heads (head_dim 128, q/k norms), vocab_size 151936, untied embeddings, rope_theta 1e6.
Checkpoint Structure
Single-file bf16 model.safetensors (159 tensors) using the original base checkpoint layout: per-expert tensors model.layers.N.mlp.experts.{i}.{gate,up,down}_proj.weight (as in the base's sharded checkpoint), plus standard attention/norm/embedding/lm_head names. Tensor-name patterns match the base model.safetensors.index.json exactly, modulo layer and expert counts (validated programmatically: 15/15 normalized patterns, 0 missing, 0 extra; every small layer has the exact base per-layer key pattern set). The checkpoint loads through AutoModelForCausalLM.from_pretrained with the same weight-conversion path as the base repo, and all conversions round-trip bit-exactly.
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("inference-optimization/Qwen3-0.9B-A0.8B-small", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("inference-optimization/Qwen3-0.9B-A0.8B-small")
input_ids = tokenizer("According to all known laws", return_tensors="pt").input_ids.to(model.device)
output = model.generate(input_ids, max_new_tokens=20)
print(tokenizer.decode(output[0]))
Creation Process
This model was created using the llm-compressor create-tiny-model skill:
- Loaded the base
AutoConfigand applied only the allowed changes (4 layers, 10 experts). - Built the model with
skip_weights_download, re-initialized weights (init_weights()+ NaN fixup), cast to bf16, and saved. - Converted the saved checkpoint from transformers stacked-expert layout (
mlp.experts.gate_up_proj/down_proj) to the base per-expert layout (reversing theqwen2_moeweight-conversion mapping). - Fine-tuned on the skill's copypasta dataset in bf16 until target perplexity was reached (lr 5e-5, ~350 steps, early-stopped).
- Re-converted the fine-tuned checkpoint to the base layout and validated structure + round-trip against the base index.
Validation
- Perplexity on the skill's validation text: 1.001 (target <= 10)
- Greedy generation from "According to all known laws": produces the trained copypasta continuation correctly.
Notes
- The base model has untied embeddings (
tie_word_embeddings: false, separatelm_head.weightin the checkpoint), so the embedding matrices alone account for 2 x 0.31B parameters. This makes the total 0.89B rather than the ~0.6B a tied-embedding variant would give. - The tokenizer's
pad_tokenwas set to<|im_end|>(matchingeos_token) for training convenience. - No
quantization_configin the base; nothing stripped. bf16 throughout.