docs/source/en/model_doc/mellum.md
This model was contributed to Hugging Face Transformers on 2026-05-28.
<div style="float: right;"> <div class="flex flex-wrap space-x-1"></div>
Mellum is a code-focused Mixture-of-Experts language model developed by JetBrains. It is derived from the Qwen3-MoE architecture with per-layer-type RoPE and interleaved sliding window attention. The model has 12B total parameters with 2.5B active parameters per token, using 64 routed experts with 8 activated per token across 28 layers.
The example below demonstrates how to generate text with [Pipeline] or the [AutoModelForCausalLM] class.
from transformers import pipeline
pipe = pipeline(
task="text-generation",
model="JetBrains/Mellum2-12B-A2.5B-Base",
)
pipe("def fibonacci(n):")
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("JetBrains/Mellum2-12B-A2.5B-Base")
model = AutoModelForCausalLM.from_pretrained(
"JetBrains/Mellum2-12B-A2.5B-Base",
device_map="auto",
)
input_ids = tokenizer("def fibonacci(n):", return_tensors="pt").to(model.device)
output = model.generate(**input_ids, max_new_tokens=50)
print(tokenizer.decode(output[0], skip_special_tokens=True))
[[autodoc]] MellumConfig
[[autodoc]] MellumModel - forward
[[autodoc]] MellumForCausalLM - forward