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
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,3 +1,152 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
language:
|
| 3 |
+
- ru
|
| 4 |
+
- en
|
| 5 |
license: apache-2.0
|
| 6 |
+
tags:
|
| 7 |
+
- math
|
| 8 |
+
- reasoning
|
| 9 |
+
- linear-attention
|
| 10 |
+
- sub-1b
|
| 11 |
+
- qwen3.5
|
| 12 |
+
- cot
|
| 13 |
+
- olympiad
|
| 14 |
+
- sft
|
| 15 |
+
- simpo
|
| 16 |
+
pipeline_tag: text-generation
|
| 17 |
+
library_name: transformers
|
| 18 |
+
metrics:
|
| 19 |
+
- accuracy
|
| 20 |
+
model-index:
|
| 21 |
+
- name: RusNanoMath-800M
|
| 22 |
+
results:
|
| 23 |
+
- task:
|
| 24 |
+
type: text-generation
|
| 25 |
+
name: Text Generation
|
| 26 |
+
dataset:
|
| 27 |
+
name: MATH-500
|
| 28 |
+
type: HuggingFaceH4/MATH-500
|
| 29 |
+
metrics:
|
| 30 |
+
- type: accuracy
|
| 31 |
+
value: 36.20
|
| 32 |
+
name: MATH-500 Accuracy
|
| 33 |
+
- type: accuracy
|
| 34 |
+
value: 52.42
|
| 35 |
+
name: MATH-500 Algebra Accuracy
|
| 36 |
+
- task:
|
| 37 |
+
type: text-generation
|
| 38 |
+
name: Text Generation
|
| 39 |
+
dataset:
|
| 40 |
+
name: GSM8K
|
| 41 |
+
type: openai/gsm8k
|
| 42 |
+
metrics:
|
| 43 |
+
- type: accuracy
|
| 44 |
+
value: 52.00
|
| 45 |
+
name: GSM8K Accuracy
|
| 46 |
---
|
| 47 |
+
|
| 48 |
+
# RusNanoMath-800M
|
| 49 |
+
|
| 50 |
+
[English](#english-overview) | [Русский](#обзор-на-русском)
|
| 51 |
+
|
| 52 |
+
---
|
| 53 |
+
|
| 54 |
+
<a id="english-overview"></a>
|
| 55 |
+
## English Overview
|
| 56 |
+
|
| 57 |
+
**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.
|
| 58 |
+
|
| 59 |
+
### Benchmark Visual Leaderboards
|
| 60 |
+
|
| 61 |
+
#### 1. MATH-500 Overall Leaderboard
|
| 62 |
+

|
| 63 |
+
|
| 64 |
+
#### 2. Dedicated Algebra Breakdown (MATH-500: Algebra)
|
| 65 |
+

|
| 66 |
+
|
| 67 |
+
#### 3. GSM8K Leaderboard
|
| 68 |
+

|
| 69 |
+
|
| 70 |
+
---
|
| 71 |
+
|
| 72 |
+
### Highlights
|
| 73 |
+
|
| 74 |
+
- **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%).
|
| 75 |
+
- **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%).
|
| 76 |
+
- **Grade School Arithmetic (GSM8K)**: Achieves **52.0%**, handling multi-step reasoning chains and arithmetic problems.
|
| 77 |
+
|
| 78 |
+
---
|
| 79 |
+
|
| 80 |
+
### Quickstart & Inference
|
| 81 |
+
|
| 82 |
+
```python
|
| 83 |
+
import torch
|
| 84 |
+
from transformers import AutoModelForImageTextToText, AutoTokenizer
|
| 85 |
+
|
| 86 |
+
MODEL_ID = "itismax0/RusNanoML-800M"
|
| 87 |
+
|
| 88 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
|
| 89 |
+
model = AutoModelForImageTextToText.from_pretrained(
|
| 90 |
+
MODEL_ID,
|
| 91 |
+
torch_dtype=torch.bfloat16,
|
| 92 |
+
device_map="auto"
|
| 93 |
+
)
|
| 94 |
+
model.eval()
|
| 95 |
+
|
| 96 |
+
messages = [
|
| 97 |
+
{
|
| 98 |
+
"role": "user",
|
| 99 |
+
"content": "Найдите все действительные корни уравнения x^4 - 5x^2 + 4 = 0. Ответ запишите в \\boxed{}."
|
| 100 |
+
}
|
| 101 |
+
]
|
| 102 |
+
|
| 103 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 104 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 105 |
+
|
| 106 |
+
with torch.no_grad():
|
| 107 |
+
outputs = model.generate(
|
| 108 |
+
**inputs,
|
| 109 |
+
max_new_tokens=1024,
|
| 110 |
+
do_sample=False,
|
| 111 |
+
pad_token_id=tokenizer.eos_token_id
|
| 112 |
+
)
|
| 113 |
+
|
| 114 |
+
response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
|
| 115 |
+
print(response)
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
---
|
| 119 |
+
|
| 120 |
+
<a id="обзор-на-русском"></a>
|
| 121 |
+
## Обзор на русском
|
| 122 |
+
|
| 123 |
+
**RusNanoMath-800M** — открытая двуязычная (русский и английский) модель на 800 млн параметров для решения математических и логических задач. Архитектура построена на базе Qwen3.5 с гибридным линейным вниманием (Gated Delta Rule), что обеспечивает константную сложность памяти состояния O(1) при генерации. Обучение включает этапы целевого SFT на цепочках рассуждений (CoT) и выравнивание методом предпочтений SimPO (Simple Preference Optimization).
|
| 124 |
+
|
| 125 |
+
### Графики сравнения с открытыми моделями
|
| 126 |
+
|
| 127 |
+
#### 1. Общий зачёт: MATH-500
|
| 128 |
+

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

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

|
| 135 |
+
|
| 136 |
+
---
|
| 137 |
+
|
| 138 |
+
### Основные показатели
|
| 139 |
+
|
| 140 |
+
- **Алгебра (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%).
|
| 141 |
+
- **Общий зачёт 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%).
|
| 142 |
+
- **GSM8K**: На тесте многошаговой арифметики модель показывает **52.0%** (260 решённых задач из 500).
|
| 143 |
+
|
| 144 |
+
---
|
| 145 |
+
|
| 146 |
+
### Архитектура и параметры
|
| 147 |
+
|
| 148 |
+
- Параметры: 800 млн (0.8B)
|
| 149 |
+
- Внимание: Гибридное линейное внимание (Gated Delta Rule) со сложностью памяти состояния O(1)
|
| 150 |
+
- Требования к видеопамяти: около 1.6 ГБ в формате BF16 (работает на потребительских GPU с 4 ГБ VRAM)
|
| 151 |
+
- Контекст: до 32 768 токенов
|
| 152 |
+
- Лицензия: Apache 2.0
|