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

Structural comparison with Qwen/Qwen3.8-27B:

Feature Source Tiny
Input modalities Text, image, video Same
Vocabulary 248,320 Same; special-token IDs preserved
Backbone layers 64 8
Hidden size 5,120 16
Attention Q/KV heads; head dim 24/4; 256 12/2; 128
Attention cycle 3 linear + 1 full Same; two complete cycles
Linear-attention key/value heads 16/48 2/6
Linear-attention key/value head dim 128/128 Same
MLP intermediate size 17,408 512
MTP 1 full-attention layer; shared embeddings Same
Vision layers / hidden size 27 / 1,152 2 / 64
Vision patch / temporal patch / merge 16 / 2 / 2 Same
Vision output size 5,120 16
Checkpoint format BF16 Same
File path Size
model.safetensors 18.2MB

Example usage:

  • SGLang

    • Runs with TP=2, the embedded NEXTN/MTP layer, and CUDA Graph.
    • Verified for text, image-plus-text and video-plus-text on two NVIDIA H20 GPUs; see Test environment for dependency versions.
model_id=yujiepan/qwen3.8-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 PIL import Image
from transformers import AutoProcessor, Qwen3_5ForConditionalGeneration

model_id = "yujiepan/qwen3.8-tiny-random"
model = Qwen3_5ForConditionalGeneration.from_pretrained(
    model_id, dtype=torch.bfloat16, device_map="cuda", attn_implementation="sdpa",
)
processor = AutoProcessor.from_pretrained(model_id)
messages = [{"role": "user", "content": [
    {"type": "image", "image": Image.new("RGB", (64, 64), (220, 30, 30))},
    {"type": "text", "text": "Describe this image."},
]}]
inputs = processor.apply_chat_template(
    messages, 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(processor.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, AutoModelForImageTextToText, AutoProcessor, 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-27B"
save_folder = "/tmp/yujiepan/qwen38-tiny-random"
source_revision = '1d4bf0f2ff6012fd82039f2fa52739d0dd7c60c0'
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["text_config"].update(
    hidden_size=16, head_dim=128, num_hidden_layers=8,
    layer_types=(["linear_attention"] * 3 + ["full_attention"]) * 2,
    num_attention_heads=12, num_key_value_heads=2,
    linear_num_key_heads=2, linear_num_value_heads=6,
    linear_key_head_dim=128, linear_value_head_dim=128,
    intermediate_size=512,
)
raw["text_config"]["rope_parameters"]["mrope_section"] = [6, 5, 5]
raw["vision_config"].update(depth=2, hidden_size=64, intermediate_size=128, num_heads=2, out_hidden_size=16)
(folder / "config.json").write_text(json.dumps(raw, indent=2))
config = AutoConfig.from_pretrained(folder)
model = AutoModelForImageTextToText.from_config(config, dtype=torch.bfloat16)
add_qwen_mtp(model, model.model.language_model)
save_random_qwen_checkpoint(model, folder)
AutoProcessor.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 VL: 8 backbone layers + 1 MTP layer; hidden_size=16

Test environment:

  • Pillow: 12.2.0
  • accelerate: 1.15.0
  • av: 19.0.2
  • flashinfer-python: 0.7.2
  • huggingface_hub: 1.33.0
  • kernels: 0.17.0
  • numpy: 2.3.5
  • safetensors: 0.8.0
  • sglang: 0.5.23.dev384+g9ab74b851
  • tiny-random: 0.2.0
  • torch: 2.14.1
  • torchcodec: 0.17.0
  • 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
31
Safetensors
Model size
9.1M 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-tiny-random

Base model

Qwen/Qwen3.8-27B
Finetuned
(697)
this model