KERN-Lab-0.5-624M
Experimental MoE fine-tune of Qwen3
2 min read
This model is an experimental adaptation of the Qwen3-0.6B-Base language model, replacing one of the feed-forward layers with a sparse Mixture of Experts (MoE) architecture. It keeps the original tokenizer and pre-training structure, splitting computation between shared and routed experts. Designed for text continuation, the model lacks instruction tuning or chat alignment, making it ideal for researchers exploring compact language model architectures.
Key features
- Based on Qwen3-0.6B-Base with one layer swapped for MoE (one shared and three routed experts, top-2).
- Total parameter count is around 624 million, with approximately 615 million active parameters used per token.
- Supports a context length of up to 32,768 tokens, inherited from the original model.
- Weights are saved in BF16 format with FP32 used for the router module.
What you can do
- Run local text generation and sentence continuation using a Python script via transformers.
- Deploy a local Gradio-based web interface for interactive prompt testing.
- Investigate behavior and bits-per-byte (BPB) compression metrics with partial MoE layer replacement in compact models.
Example
import torch
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer
path = "./model"
device = "cuda" if torch.cuda.is_available() else "cpu"
dtype = torch.bfloat16 if device == "cuda" and torch.cuda.is_bf16_supported() else torch.float32
config = AutoConfig.from_pretrained(path, trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained(path, config=config, local_files_only=True)
model = AutoModelForCausalLM.from_pretrained(
path, config=config, dtype=dtype, trust_remote_code=True, local_files_only=True
).to(device).eval()
inputs = tokenizer("The capital of France is", return_tensors="pt").to(device)
with torch.inference_mode():
generated = model.generate(**inputs, max_new_tokens=16, do_sample=False, use_cache=True)
print(tokenizer.decode(generated[0, inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
Read more
DetailsCompression benchmarks (BPB, lower is better) on test set B: original Qwen — 1.0918, dense control — 1.0907, KERN MoE (seed 42) — 1.0882.
Hardware requirements: A lightweight model with a total of around 624M parameters, runs on CPU or GPU with BF16/FP32 support.
Limitations: The model is not trained for instruction following or dialogue, and outputs may contain errors.
License: Apache-2.0.










Comments