Run this model with HF Jobs
Run rwb-ai/BerryLM-OS on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/rwb-ai/BerryLM-OS. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/rwb-ai/BerryLM-OS on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/rwb-ai/BerryLM-OS. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/rwb-ai/BerryLM-OS. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use rwb-ai/BerryLM-OS with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use rwb-ai/BerryLM-OS with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="rwb-ai/BerryLM-OS", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("rwb-ai/BerryLM-OS", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use rwb-ai/BerryLM-OS with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "rwb-ai/BerryLM-OS" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rwb-ai/BerryLM-OS", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/rwb-ai/BerryLM-OS
- SGLang
How to use rwb-ai/BerryLM-OS with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "rwb-ai/BerryLM-OS" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rwb-ai/BerryLM-OS", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "rwb-ai/BerryLM-OS" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rwb-ai/BerryLM-OS", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use rwb-ai/BerryLM-OS with Docker Model Runner:
docker model run hf.co/rwb-ai/BerryLM-OS
BerryLM-OS
Hybrid MoE language model for Russian and English with a thinking mode: 40 decoder layers (three linear-attention layers, then one full-attention layer, repeated), sparse MoE FFN with 128 routed experts (top-8) plus a shared expert, Gated Block AttnRes depth mixing and KDA forget gates on the linear-attention layers. ~3.2B active / ~18.3B total parameters (bf16, 36.6 GB of weights), 180 224-token byte-level BPE vocabulary, 256k context.
Architecture
The stack is on the left, one layer on the right. Every layer first mixes in the residual streams committed at earlier block boundaries (AttnRes, a block is 8 layers), then runs its token mixer (KDA linear attention in three layers out of four, full attention in the fourth) and a sparse MoE feed-forward.
Quick start (transformers)
python -m pip install "transformers==5.16.1" accelerate torch
Fused kernels are optional: pip install flash-linear-attention adds the Triton kernels of the linear-attention layers;
without it the torch reference path runs (correct, slower on long prompts). causal-conv1d is picked up too when installed;
it compiles from source unless a prebuilt wheel matches your torch.
from transformers import AutoModelForCausalLM, AutoTokenizer
m = "rwb-ai/BerryLM-OS"
tok = AutoTokenizer.from_pretrained(m, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(m, dtype="auto", device_map="auto", trust_remote_code=True)
msgs = [{"role": "user", "content": "Объясни, что такое линейное внимание, в трёх предложениях."}]
inputs = tok.apply_chat_template(msgs, add_generation_prompt=True, return_dict=True, return_tensors="pt", enable_thinking=True).to(model.device)
out = model.generate(**inputs, max_new_tokens=2048, do_sample=True, temperature=0.8, top_p=0.95, top_k=20)
print(tok.decode(out[0, inputs["input_ids"].shape[1]:]))
Thinking is on by default: the reply starts with the reasoning and </think> separates it from the answer. Pass
enable_thinking=False to the chat template for direct answers.
Sampling
| mode | temperature | top_p | top_k |
|---|---|---|---|
thinking (default, shipped in generation_config.json) |
0.8 (0.6–0.8) | 0.95 | 20 |
direct answers (enable_thinking=False) |
0.7 | 0.8 | 20 |
Serving
vLLM (until vllm-project/vllm#57384 is merged):
git clone https://github.com/vllm-project/vllm.git && cd vllm
git fetch origin pull/57384/head
git checkout -b berrylm 7060026c613db283d70efc250f05ab6bbced9317
VLLM_USE_PRECOMPILED=1 VLLM_PRECOMPILED_WHEEL_COMMIT=cb6458c5ce61632524c0447d49790725c1e1d9a2 pip install -e .
vllm serve rwb-ai/BerryLM-OS --reasoning-parser berrylm --tool-call-parser berrylm --enable-auto-tool-choice
SGLang (until sgl-project/sglang#55435 is merged):
git clone https://github.com/sgl-project/sglang.git && cd sglang
git fetch origin pull/55435/head
git checkout -b berrylm ebedc568181c5290660b3295666382556976ff05
pip install -e "python"
python -m sglang.launch_server --model-path rwb-ai/BerryLM-OS --port 8000 \
--reasoning-parser berrylm --tool-call-parser berrylm
Installing SGLang from source builds its Rust extensions: have a Rust toolchain installed, or set
SGLANG_BUILD_RUST_EXTS=none for the install.
Both servers read the sampling defaults from generation_config.json, split the reasoning into the
reasoning / reasoning_content field of the OpenAI-compatible response and parse tool calls (if you render prompts
yourself with apply_chat_template, pass the arguments of earlier tool calls as a mapping, not as a JSON string).
Thinking is switched per request; both commands above serve on port 8000:
curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{
"model": "rwb-ai/BerryLM-OS",
"messages": [{"role": "user", "content": "Сколько будет 17 * 23?"}],
"max_tokens": 4096,
"chat_template_kwargs": {"enable_thinking": false}
}'
Hardware
bf16 weights take 34 GiB; the KV cache of the full-attention layers costs about 20 KB per token (5 GiB for the whole
256k context) and the linear-attention state 60 MiB per running sequence. vLLM reserves one state block per
--max-num-seqs slot (1024 by default). On an 80 GB card the commands above work as written; on a smaller one pass a
lower --max-num-seqs and, if the full context does not fit, a lower --max-model-len (vLLM) / --context-length
(SGLang). Measured: under a 46 GiB memory cap (a 48 GB card) vllm serve ... --max-model-len 32768 --max-num-seqs 64
starts and serves.
Other formats
- BerryLM-OS-FP8: block-wise FP8 weights for vLLM and SGLang, 17.8 GiB instead of 34 GiB, within two points of these weights on the thinking benchmarks below.
- BerryLM-OS-GGUF: Q6_K and Q4_K_M for llama.cpp. They need llama.cpp with BerryLM support, proposed in ggml-org/llama.cpp#30234 and not merged yet.
Evaluation
Pareto plot for averaged scores (all benchmarks)
Unweighted mean of 25 scores:
- No-think (12): MMLU-ProX, AA-LCR, WMT24++ en→ru, LIBRA, RULER 32k, RULER 64k, RULER 128k, GSM8K, MATH-500, MGSM ru, WikiWebFacts, HardMultiQA.
- Think (13): GPQA, AIME 2026, HMMT Feb 2025, DOOM, IFEval, Multi-IF, BFCL v4, RU Arena-Hard, IFBench, MERA v2, HumanEval, MBPP, BigCodeBench.
LFM2.5-2.6B is averaged over 23 scores (no AA-LCR and RULER 128k) and gpt-oss-20b over 24 (no RULER 128k). LFM2.5-2.6B has no no-think mode, so all its scores here and in the table below were measured in think mode.
Pareto plot for averaged scores (Russian benchmarks subset)
Equal-weight mean of the nine Russian benchmark scores: DOOM, RU Arena-Hard, MMLU-ProX ru, WMT24++ en→ru, LIBRA, MGSM ru, WikiWebFacts, HardMultiQA, MERA v2.
| Benchmark | Mode | BerryLM-OS | LFM2.5 2.6B* |
Qwen3.5 4B |
Qwen3.5 9B |
Nemotron 3.5 30B-A3B |
gpt-oss 20b |
Qwen3.5 35B-A3B |
Qwen3.6 35B-A3B |
Gemma 4 26B-A4B |
|---|---|---|---|---|---|---|---|---|---|---|
| General knowledge and reasoning | ||||||||||
| MMLU-ProX en+ru pass@1 | no-think | 79.2 | 64.2 | 73.7 | 78.1 | 74.2 | 69.9 | 83.0 | 83.1 | 81.5 |
| GPQA pass@1 | think | 79.0 | 56.6 | 77.0 | 81.9 | 75.4 | 71.5 | 83.5 | 79.0 | 79.7 |
| DOOM1 pass@1 | think | 75.0 | 45.5 | 71.0 | 73.8 | 63.8 | 62.4 | 78.3 | 72.3 | 77.2 |
| Math | ||||||||||
| AIME 2026 pass@1 | think | 90.0 | 65.2 | 82.5 | 87.7 | 87.5 | 84.8 | 90.2 | 90.8 | 86.5 |
| HMMT Feb 2025 pass@1 | think | 80.8 | 47.9 | 71.3 | 81.7 | 85.4 | 71.3 | 84.2 | 89.2 | 79.2 |
| GSM8K 8-shot CoT, exact match | no-think | 96.2 | 89.2 | 91.6 | 95.3 | 89.7 | 77.2 | 96.4 | 96.3 | 96.5 |
| MATH-500 4-shot, pass@32 | no-think | 98.4 | 98.0 | 97.2 | 98.8 | 85.6 | 95.6 | 99.4 | 99.2 | 98.6 |
| MGSM ru symbolic match | no-think | 94.0 | 82.0 | 87.2 | 88.8 | 80.4 | 71.6 | 92.0 | 92.8 | 91.6 |
| Code and agentic | ||||||||||
| HumanEval pass@1 | think | 97.3 | 84.5 | 84.9 | 91.6 | 95.1 | 84.3 | 96.6 | 97.4 | 99.0 |
| MBPP pass@1 | think | 92.3 | 77.1 | 69.3 | 80.5 | 87.6 | 89.0 | 85.6 | 92.7 | 96.8 |
| BigCodeBench-Hard pass@1 | think | 48.2 | 31.5 | 32.9 | 39.8 | 49.7 | 46.2 | 45.4 | 50.6 | 48.5 |
| BFCL v42 overall | think | 66.2 | 58.6 | 54.0 | 62.7 | 57.5 | 32.9 | 66.3 | 63.3 | 60.7 |
| Instruction following | ||||||||||
| IFEval prompt-level strict | think | 93.6 | 93.0 | 88.3 | 89.6 | 91.8 | 88.5 | 90.8 | 88.8 | 94.8 |
| Multi-IF en+ru mean of 3 turns | think | 85.6 | 82.0 | 79.6 | 84.2 | 83.2 | 81.8 | 85.8 | 86.1 | 88.8 |
| IFBench strict / loose mean | think | 73.3 | 57.9 | 54.4 | 61.3 | 70.8 | 66.5 | 65.9 | 58.3 | 77.3 |
| Russian | ||||||||||
| RU Arena-Hard3 win rate | think | 49.2 | 5.9 | 8.4 | 18.1 | 16.7 | 44.2 | 38.1 | 66.6 | 69.2 |
| WMT24++ en→ru4 COMET | no-think | 85.4 | 75.2 | 81.4 | 84.0 | 75.8 | 79.0 | 86.0 | 85.7 | 86.5 |
| WikiWebFacts5 judged accuracy | no-think | 53.9 | 38.1 | 37.4 | 48.2 | 42.4 | 46.6 | 62.9 | 60.9 | 60.2 |
| HardMultiQA5 judged accuracy | no-think | 39.0 | 21.8 | 22.5 | 35.0 | 29.5 | 34.6 | 45.3 | 42.6 | 44.4 |
| MERA v26 overall | think | 40.7 | 12.0 | 9.3 | 18.6 | 23.9 | 27.4 | 33.0 | 39.1 | 45.2 |
| Long context | ||||||||||
| AA-LCR7 pass@1 | no-think | 44.0 | — | 36.8 | 36.5 | 13.5 | 31.5 | 57.0 | 58.5 | 39.3 |
| LIBRA mean of 21 sets | no-think | 63.9 | 42.6 | 59.2 | 60.0 | 52.6 | 54.9 | 61.5 | 61.2 | 62.3 |
| RULER 32k accuracy | no-think | 96.7 | 67.3 | 95.9 | 96.5 | 97.1 | 74.5 | 96.5 | 96.9 | 96.5 |
| RULER 64k accuracy | no-think | 95.9 | 45.6 | 95.2 | 96.1 | 96.8 | 68.0 | 96.1 | 96.7 | 95.0 |
| RULER 128k accuracy | no-think | 95.1 | — | 94.8 | 95.6 | 96.5 | — | 95.9 | 96.3 | 91.9 |
1 DOOM: mean of the math and physics subsets.
2 BFCL v4: overall score without the web-search category.
3 RU Arena-Hard (474 prompts): GLM-4.7-FP8 compares each answer with the fixed DeepSeek-V3.2 baseline answers, in both orders; the score is the win rate against that baseline (the baseline itself would score 50).
4 WMT24++: scored by the XCOMET-XXL metric model, not an LLM judge.
5 WikiWebFacts (1365 questions) and HardMultiQA (670): no comparison model; Qwen3.5-122B-A10B grades each answer against the reference answer as −1, 0 or 1, and the score is the share of answers graded 1.
6 MERA v2: LFM2.5-2.6B, Qwen3.5-4B, Qwen3.5-9B, Qwen3.5-35B-A3B and Qwen3.6-35B-A3B are taken from the official leaderboard; Nemotron 3.5 30B-A3B, gpt-oss-20b, Gemma 4 26B-A4B and BerryLM-OS were run with the official MERA v2 code and scored by the MERA scoring system (the leaderboard has Gemma 4 26B-A4B only in non-reasoning mode).
7 AA-LCR: judged by GLM-4.7-FP8, which checks the answer against the reference.
* LFM2.5-2.6B has no no-think mode: all its scores were measured in think mode.
The other benchmarks are scored without a model, by answer matching or unit tests. Bold: best in the row; —: not measured.
Authors
Danil Smorchkov, Anton Tikhonov, Yulia Ivanova, Matvey Saprykin, Anton Egorov, Yuriy Sofronov, Adel Khalilov, Andrey Yakuboy, Igor Bogdanov, Maria Korshunova, Mikhail Aleshin, Alexander Kostylev, Damir Chanyshev.
License
Released under the Apache License 2.0.
- Downloads last month
- 9

docker model run hf.co/rwb-ai/BerryLM-OS