This tiny model is intended for debugging. It is randomly initialized using the configuration adapted from Qwen/Qwen3.8-2.4T-A95B.

Structural comparison with Qwen/Qwen3.8-2.4T-A95B:

Feature Source Tiny
Input modalities Text Same
Vocabulary 248,320 Same; special-token IDs preserved
Backbone layers 92 8
Hidden size 8,192 16
Attention Q/KV heads; head dim 64/4; 256 32/2; 128
Attention cycle 3 linear + 1 full Same; two complete cycles
Linear-attention key/value heads 16/128 2/16
Linear-attention key/value head dim 128/128 Same
Routed experts / top-k 512 / 10 32 / 10
Shared experts 1 Same
Expert/shared intermediate size 2,048 / 2,048 256 / 256
MTP 1 full-attention layer; shared embeddings Same
Checkpoint format BF16 Same
File path Size
model.safetensors 25.9MB

Example usage:

  • SGLang

    • Runs with TP=2, the embedded NEXTN/MTP layer, and CUDA Graph.
    • Verified for text requests on two NVIDIA H20 GPUs; see Test environment for dependency versions.
model_id=yujiepan/qwen3.8-moe-tiny-random
sglang serve \
  --model-path $model_id \
  --tp-size 2 \
  --fp8-gemm-backend triton \
  --moe-runner-backend triton \
  --speculative-algorithm NEXTN \
  --speculative-num-steps 3 \
  --speculative-eagle-topk 1 \
  --speculative-num-draft-tokens 4 \
  --context-length 4096 \
  --max-total-tokens 4096 \
  --chunked-prefill-size 512 \
  --mem-fraction-static 0.4 \
  --cuda-graph-config '{"decode": {"bs": [1, 2, 4, 8]}}' \
  --disable-custom-all-reduce
  • Transformers
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "yujiepan/qwen3.8-moe-tiny-random"
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, device_map="cuda", attn_implementation="sdpa")
tokenizer = AutoTokenizer.from_pretrained(model_id)
inputs = tokenizer.apply_chat_template(
    [{"role": "user", "content": "Hello"}], tokenize=True,
    add_generation_prompt=True, return_dict=True, return_tensors="pt",
).to(model.device)
output = model.generate(**inputs, do_sample=False, max_new_tokens=10)
print(tokenizer.decode(output[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))

Codes to create this repo:

Click to expand
import json
from pathlib import Path

import torch
from huggingface_hub import hf_hub_download
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, GenerationConfig, set_seed
# Creation helpers: pip install git+https://github.com/yujiepan/tiny-random.git
from tiny_random.qwen_utils import add_qwen_mtp, save_random_qwen_checkpoint, compact_qwen_tokenizer, check_qwen_repo_size

source_model_id = "Qwen/Qwen3.8-2.4T-A95B"
save_folder = "/tmp/yujiepan/qwen38-moe-tiny-random"
source_revision = '207bd685a7e3696cfaff12ded7c6a7ea0f88c996'
set_seed(42)
folder = Path(save_folder)
folder.mkdir(parents=True, exist_ok=True)
raw = json.loads(Path(hf_hub_download(source_model_id, "config.json", revision=source_revision)).read_text())
raw.update(
    hidden_size=16, head_dim=128, num_hidden_layers=8,
    layer_types=(["linear_attention"] * 3 + ["full_attention"]) * 2,
    num_attention_heads=32, num_key_value_heads=2,
    linear_num_key_heads=2, linear_num_value_heads=16,
    linear_key_head_dim=128, linear_value_head_dim=128,
    num_experts=32, moe_intermediate_size=256, shared_expert_intermediate_size=256,
)
(folder / "config.json").write_text(json.dumps(raw, indent=2))
config = AutoConfig.from_pretrained(folder)
model = AutoModelForCausalLM.from_config(config, dtype=torch.bfloat16)
add_qwen_mtp(model, model.model)
save_random_qwen_checkpoint(model, folder)
AutoTokenizer.from_pretrained(source_model_id, revision=source_revision).save_pretrained(folder)
GenerationConfig.from_pretrained(source_model_id, revision=source_revision).save_pretrained(folder)
compact_qwen_tokenizer(folder)
check_qwen_repo_size(folder)

Printing the model:

Click to expand
Qwen3.8 MoE: 8 backbone layers + 1 MTP layer; hidden_size=16

Test environment:

  • accelerate: 1.15.0
  • flashinfer-python: 0.7.2
  • huggingface_hub: 1.33.0
  • kernels: 0.17.0
  • safetensors: 0.8.0
  • sglang: 0.5.23.dev384+g9ab74b851
  • tiny-random: 0.2.0
  • torch: 2.14.1
  • transformers: 5.19.0

Change log:

  • 2026-10-23: Initial version.
  • 2026-10-23: Reduced all repo files below 50 MB; GPU-validated TP=2, MTP and CUDA Graph.

This repo is generated by GPT-6.1-Sol

Downloads last month
-
Safetensors
Model size
12.9M params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for yujiepan/qwen3.8-moe-tiny-random

Finetuned
(7)
this model