Text Generation
Transformers
Safetensors
GGUF
Russian
English
qwen3_5
image-text-to-text
math
reasoning
linear-attention
sub-1b
qwen3.5
cot
olympiad
sft
simpo
conversational
Eval Results (legacy)
Instructions to use RusMiniLM/RusNanoMath-800M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RusMiniLM/RusNanoMath-800M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RusMiniLM/RusNanoMath-800M") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("RusMiniLM/RusNanoMath-800M") model = AutoModelForMultimodalLM.from_pretrained("RusMiniLM/RusNanoMath-800M", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use RusMiniLM/RusNanoMath-800M with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf RusMiniLM/RusNanoMath-800M:F16 # Run inference directly in the terminal: llama cli -hf RusMiniLM/RusNanoMath-800M:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf RusMiniLM/RusNanoMath-800M:F16 # Run inference directly in the terminal: llama cli -hf RusMiniLM/RusNanoMath-800M:F16
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf RusMiniLM/RusNanoMath-800M:F16 # Run inference directly in the terminal: ./build/bin/llama cli -hf RusMiniLM/RusNanoMath-800M:F16
Use Docker
docker model run hf.co/RusMiniLM/RusNanoMath-800M:F16
- Llama new
- LM Studio
- Jan
- vLLM
How to use RusMiniLM/RusNanoMath-800M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RusMiniLM/RusNanoMath-800M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RusMiniLM/RusNanoMath-800M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/RusMiniLM/RusNanoMath-800M:F16
- SGLang
How to use RusMiniLM/RusNanoMath-800M 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 "RusMiniLM/RusNanoMath-800M" \ --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": "RusMiniLM/RusNanoMath-800M", "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 "RusMiniLM/RusNanoMath-800M" \ --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": "RusMiniLM/RusNanoMath-800M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use RusMiniLM/RusNanoMath-800M with Ollama:
ollama run hf.co/RusMiniLM/RusNanoMath-800M:F16
- Unsloth Desktop
- Docker Model Runner
How to use RusMiniLM/RusNanoMath-800M with Docker Model Runner:
docker model run hf.co/RusMiniLM/RusNanoMath-800M:F16
- Lemonade
How to use RusMiniLM/RusNanoMath-800M with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull RusMiniLM/RusNanoMath-800M:F16
Run and chat with the model
lemonade run user.RusNanoMath-800M-F16
List all available models
lemonade list
- Atomic Chat
File size: 6,846 Bytes
b355f93 8224179 b355f93 8224179 b355f93 8224179 e9ec967 8224179 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | ---
language:
- ru
- en
license: apache-2.0
tags:
- math
- reasoning
- linear-attention
- sub-1b
- qwen3.5
- cot
- olympiad
- sft
- simpo
pipeline_tag: text-generation
library_name: transformers
metrics:
- accuracy
model-index:
- name: RusNanoMath-800M
results:
- task:
type: text-generation
name: Text Generation
dataset:
name: MATH-500
type: HuggingFaceH4/MATH-500
metrics:
- type: accuracy
value: 36.20
name: MATH-500 Accuracy
- type: accuracy
value: 52.42
name: MATH-500 Algebra Accuracy
- task:
type: text-generation
name: Text Generation
dataset:
name: GSM8K
type: openai/gsm8k
metrics:
- type: accuracy
value: 52.00
name: GSM8K Accuracy
---
# RusNanoMath-800M
[English](#english-overview) | [Русский](#обзор-на-русском)
---
<a id="english-overview"></a>
## English Overview
**RusNanoMath-800M** is an open-weights **800M parameter bilingual (Russian / English) mathematical reasoning model**. Built on a hybrid Linear Attention architecture (Qwen3.5 with Gated Delta Rule layers) and aligned via targeted multi-stage SFT and SimPO (Simple Preference Optimization), it demonstrates very strong reasoning performance across competitive mathematics benchmarks, particularly in symbolic algebra.
### Benchmark Visual Leaderboards
#### 1. MATH-500 Overall Leaderboard

#### 2. Dedicated Algebra Breakdown (MATH-500: Algebra)

#### 3. GSM8K Leaderboard

---
### Highlights
- **Symbolic Algebra (MATH-500 Algebra)**: In the 124 algebra competition problems, RusNanoMath-800M achieves **52.4%**, closely approaching Llama-3.1-8B (53.8%) and surpassing models with 1.5B–3B parameters (Qwen2.5-1.5B at 49.5%, Llama-3.2-3B at 48.0%, Gemma-2-2B at 41.2%).
- **General Competition Math (MATH-500 Overall)**: Across all 500 problems, RusNanoMath-800M reaches **36.2%**, outperforming sub-1B to 2B models (Gemma-2-2B at 35.0%, SmolLM2-1.7B at 21.5%, Llama-3.2-1B at 14.0%).
- **Grade School Arithmetic (GSM8K)**: Achieves **52.0%**, handling multi-step reasoning chains and arithmetic problems.
---
### Quickstart & Inference
```python
import torch
from transformers import AutoModelForImageTextToText, AutoTokenizer
MODEL_ID = "itismax0/RusNanoML-800M"
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForImageTextToText.from_pretrained(
MODEL_ID,
torch_dtype=torch.bfloat16,
device_map="auto"
)
model.eval()
messages = [
{
"role": "user",
"content": "Найдите все действительные корни уравнения x^4 - 5x^2 + 4 = 0. Ответ запишите в \\boxed{}."
}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=1024,
do_sample=False,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
print(response)
```
### Run with llama.cpp / Ollama (GGUF, full precision)
A full-precision **F16 GGUF** (`RusNanoML-800M-F16.gguf`) is included in this repo — no quantization loss.
```bash
# llama.cpp
llama-cli -hf itismax0/RusNanoML-800M:RusNanoML-800M-F16.gguf --temp 0 -p "Найдите все действительные корни уравнения x^4 - 5x^2 + 4 = 0."
```
**Ollama** (import the GGUF locally):
```bash
echo "FROM RusNanoML-800M-F16.gguf
PARAMETER temperature 0
TEMPLATE \"{{ .Prompt }}\"" > Modelfile
ollama create rusnanoml-800m -f Modelfile
ollama run rusnanoml-800m "Найдите все действительные корни уравнения x^4 - 5x^2 + 4 = 0."
```
> Note: the model uses the Qwen3.5 hybrid linear-attention architecture. llama.cpp builds from `master` (>= b12413) support it; older builds will refuse to load the file.
---
<a id="обзор-на-русском"></a>
## Обзор на русском
**RusNanoMath-800M** — открытая двуязычная (русский и английский) модель на 800 млн параметров для решения математических и логических задач. Архитектура построена на базе Qwen3.5 с гибридным линейным вниманием (Gated Delta Rule), что обеспечивает константную сложность памяти состояния O(1) при генерации. Обучение включает этапы целевого SFT на цепочках рассуждений (CoT) и выравнивание методом предпочтений SimPO (Simple Preference Optimization).
### Графики сравнения с открытыми моделями
#### 1. Общий зачёт: MATH-500

#### 2. Раздел алгебры: MATH-500 (Algebra)

#### 3. Арифметика и текстовые задачи: GSM8K

---
### Основные показатели
- **Алгебра (MATH-500 Algebra)**: В блоке из 124 задач по алгебре RusNanoMath-800M показывает **52.4%** (65 решённых задач из 124). Модель вплотную приближается к показателям Llama-3.1-8B (53.8%) и превосходит модели большего размера: Qwen2.5-1.5B (49.5%), Llama-3.2-3B (48.0%) и Gemma-2-2B (41.2%).
- **Общий зачёт MATH-500**: По всему набору из 500 олимпиадных задач модель набирает **36.2%** (181 решённая задача), опережая Gemma-2-2B (35.0%), Mistral-7B-Instruct (28.4%), SmolLM2-1.7B (21.5%) и Llama-3.2-1B (14.0%).
- **GSM8K**: На тесте многошаговой арифметики модель показывает **52.0%** (260 решённых задач из 500).
---
### Архитектура и параметры
- Параметры: 800 млн (0.8B)
- Внимание: Гибридное линейное внимание (Gated Delta Rule) со сложностью памяти состояния O(1)
- Требования к видеопамяти: около 1.6 ГБ в формате BF16 (работает на потребительских GPU с 4 ГБ VRAM)
- Контекст: до 32 768 токенов
- Лицензия: Apache 2.0
|