File size: 18,938 Bytes
94e8f42 cb1f885 94e8f42 cb1f885 94e8f42 2208113 94e8f42 3fb123d 94e8f42 f2b63f0 94e8f42 cb1f885 94e8f42 cb1f885 94e8f42 cb1f885 94e8f42 cb1f885 94e8f42 cb1f885 94e8f42 cb1f885 94e8f42 cb1f885 94e8f42 cb1f885 94e8f42 cb1f885 94e8f42 cb1f885 94e8f42 cb1f885 94e8f42 1204545 94e8f42 cb1f885 94e8f42 b173635 94e8f42 | 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 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | ---
license: mit
datasets:
- ZeroAgency/ru-big-russian-dataset
language:
- ru
- en
tags:
- mistral
- chat
- conversational
- transformers
inference:
parameters:
temperature: 0
pipeline_tag: text-generation
base_model:
- mistralai/Mistral-Small-3.1-24B-Instruct-2503
library_name: transformers
---
# Model Card for Zero-Mistral-24B
**Zero-Mistral-24B** is an improved TEXT-only version of [mistralai/Mistral-Small-3.1-24B-Instruct-2503](https://huggingface.co/mistralai/Mistral-Small-3.1-24B-Instruct-2503),
primarily adapted for Russian and English languages. The original Mistral model contains vision features which were removed from this model.
The training involved SFT stage primarily on [Big Russian Dataset](https://huggingface.co/datasets/ZeroAgency/ru-big-russian-dataset) dataset
and proprietary dataset from [Shkolkovo.online](https://shkolkovo.online/?utm_source=hf).
The model has good math skills and some reasoning abilities.
The modele saves original mistral long context capabilities up to 128k tokens.
## Model Details

### Model Description
- **Developed by:** [ZeroAgency.ru](https://zeroagency.ru/?utm_source=hf)
- **Funded by:** [ZeroAgency.ru](https://zeroagency.ru/?utm_source=hf) and [Shkolkovo.online](https://shkolkovo.online/?utm_source=hf)
- **Shared by:** [Alexander Kozhevnikov](https://t.me/ak_segfault) (developer)
- **Model type:** LLM
- **Language(s) (NLP):** Russian, English
- **License:** MIT
- **Finetuned from model:** [mistralai/Mistral-Small-3.1-24B-Instruct-2503](https://huggingface.co/mistralai/Mistral-Small-3.1-24B-Instruct-2503)
### 📚 Model versions
- [Merged 16-bit](https://huggingface.co/ZeroAgency/Zero-Mistral-24B) - original 16bit merged version for transformers.
- [GGUF](https://huggingface.co/ZeroAgency/Zero-Mistral-24B-gguf) - different GGUF versions: BF16, F16, Q8_0, Q6_K, Q4_K_M, IQ4_XS, etc.
## 📊 Benchmarks for main 16-bit merged version
### MERA
**MERA score**: `0.623`
| Task | Result | Metric |
|--------------|----------------------|--------------------|
| LCS | 0.194 | Accuracy |
| RCB | 0.607 / 0.592 | Avg. F1 / Accuracy |
| USE | 0.452 | Grade Norm |
| RWSD | 0.55 | Accuracy |
| PARus | 0.942 | Accuracy |
| ruTiE | 0.868 | Accuracy |
| MultiQ | 0.781 / 0.629 | F1-score/EM |
| CheGeKa | 0.397 / 0.322 | F1 / EM |
| ruModAr | 0.971 | EM |
| MaMuRAMu | 0.832 | Accuracy |
| ruMultiAr | 0.354 | EM |
| ruCodeEval | 0 / 0 / 0 | pass@k `¯\_(ツ)_/¯`|
| MathLogicQA | 0.613 | Accuracy |
| ruWorldTree | 0.987 / 0.987 | Avg. F1 / Accuracy |
| ruOpenBookQA | 0.913 / 0.913 | Avg. F1 / Accuracy |
Оценка по открытым задачам:
| Задача | Результат | Метрика |
|--------------|---------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| BPS | 0.981 | Accuracy |
| ruMMLU | 0.778 | Accuracy |
| SimpleAr | 0.997 | EM |
| ruHumanEval | 0.006 / 0.006 / 0.006 | pass@k `¯\_(ツ)_/¯` |
| ruHHH | 0.916 | Accuracy |
| ruHateSpeech | 0.834 | Accuracy |
| ruDetox | 0.341 / 0.843 / 0.624 / 0.66 | Общая средняя оценка (J) / Оценка сохранения смысла (SIM) / Оценка натуральности (FL) / Точность переноса стиля (STA) |
| ruEthics | [[0.386, 0.399, 0.41, 0.333, 0.327], [0.421, 0.427, 0.452, 0.375, 0.363], [0.653, 0.65, 0.697, 0.596, 0.573]] | 5 MCC |
## Usage
The model can be used with the following frameworks;
- [`vllm`](https://github.com/vllm-project/vllm): See [here](#vllm)
- [`transformers`](https://github.com/huggingface/transformers): See [here](#transformers)
- [`llama.cpp`](https://github.com/ggml-org/llama.cpp): See [here](#llama-server)
### Recommended system prompts
```python
prompts = {
"generic": "Ты виртуальный ассистент. Ты отвечаешь на вопросы людей, помогаешь им и поддерживаешь. Ты создан, чтобы быть полезным, безобидным и честным. Ты отвечаешь на том языке, на котором был задан вопрос или попросил пользователь.",
"think": """Ты виртуальный ассистент. Ты отвечаешь на вопросы людей, помогаешь им и поддерживаешь. Ты создан, чтобы быть полезным, безобидным и честным. Ты отвечаешь на том языке, на котором был задан вопрос или попросил пользователь.
Answer in the following format:
<think>Reasoning: ...</think>
...""",
"task": "Ты виртуальный ассистент. Ты отвечаешь на вопросы людей, помогаешь им и поддерживаешь. Ты создан, чтобы быть полезным, безобидным и честным. Ты отвечаешь на том языке, на котором был задан вопрос или попросил пользователь. Реши задачу по инструкции ниже. Не извиняйся, не строй диалог.",
"task_think": """Ты виртуальный ассистент. Ты отвечаешь на вопросы людей, помогаешь им и поддерживаешь. Ты создан, чтобы быть полезным, безобидным и честным. Ты отвечаешь на том языке, на котором был задан вопрос или попросил пользователь. Реши задачу по инструкции ниже. Не извиняйся, не строй диалог.
Answer in the following format:
<think>Reasoning: ...</think>
...""",
"english_generic": """You are Mistral Small 3, a Large Language Model (LLM) created by Mistral AI, a French startup headquartered in Paris.
Your knowledge base was last updated on 2023-10-01. The current date is 2025-01-30.
When you're not sure about some information, you say that you don't have the information and don't make up anything.
If the user's question is not clear, ambiguous, or does not provide enough context for you to accurately answer the question, you do not try to answer it right away and you rather ask the user to clarify their request (e.g. \"What are some good restaurants around me?\" => \"Where are you?\" or \"When is the next flight to Tokyo\" => \"Where do you travel from?\")
""",
"english_think": """You are Mistral Small 3, a Large Language Model (LLM) created by Mistral AI, a French startup headquartered in Paris.
Your knowledge base was last updated on 2023-10-01. The current date is 2025-01-30.
When you're not sure about some information, you say that you don't have the information and don't make up anything.
If the user's question is not clear, ambiguous, or does not provide enough context for you to accurately answer the question, you do not try to answer it right away and you rather ask the user to clarify their request (e.g. \"What are some good restaurants around me?\" => \"Where are you?\" or \"When is the next flight to Tokyo\" => \"Where do you travel from?\")
Answer in the following format:
<think>Reasoning: ...</think>
""",
}
```
### vLLM
We recommend using this model with the [vLLM library](https://github.com/vllm-project/vllm)
to implement production-ready inference pipelines.
**Note 1**: We recommond using a relatively low temperature, such as `temperature=0.15`.
**Note 2**: Make sure to add a system prompt to the model to best tailer it for your needs. If you want to use the model as a general assistant, we recommend the following
system prompt:
```
system_prompt = """You are Mistral Small 3, a Large Language Model (LLM) created by Mistral AI, a French startup headquartered in Paris.
Your knowledge base was last updated on 2023-10-01. The current date is 2025-01-30.
When you're not sure about some information, you say that you don't have the information and don't make up anything.
If the user's question is not clear, ambiguous, or does not provide enough context for you to accurately answer the question, you do not try to answer it right away and you rather ask the user to clarify their request (e.g. \"What are some good restaurants around me?\" => \"Where are you?\" or \"When is the next flight to Tokyo\" => \"Where do you travel from?\")
```
**Note 3**: flash_attn or flashinfer-python preferred for better performance.
**_Installation_**
Make sure you install [`vLLM >= 0.8.4`](https://github.com/vllm-project/vllm/releases/tag/v0.8.4):
```
pip install --upgrade vllm
```
Also make sure you have [`mistral_common >= 1.5.4`](https://github.com/mistralai/mistral-common/releases/tag/v1.5.4) installed:
```
pip install --upgrade mistral_common
```
You can also make use of a ready-to-go [docker image](https://github.com/vllm-project/vllm/blob/main/Dockerfile) or on the [docker hub](https://hub.docker.com/r/vllm/vllm-openai/tags).
#### Server
We recommand that you use ZeroAgency/Zero-Mistral-24B in a server/client setting.
1. Spin up a server:
```
vllm serveZeroAgency/Zero-Mistral-24B --enable-prefix-caching --dtype bfloat16 --max-model-len 32768 --tool-call-parser mistral --enable-auto-tool-choice
```
**Note:** Running Zero-Mistral-24B on GPU requires ~55 GB of GPU RAM in bf16 or fp16.
2. To ping the client you can use a simple Python snippet.
```py
import requests
import json
from datetime import datetime, timedelta
url = "http://<your-server>:8000/v1/chat/completions"
headers = {"Content-Type": "application/json", "Authorization": "Bearer token"}
model = "ZeroAgency/Zero-Mistral-24B"
messages = [
{
"role": "system",
"content": """Ты виртуальный ассистент. Ты отвечаешь на вопросы людей, помогаешь им и поддерживаешь. Ты создан, чтобы быть полезным, безобидным и честным. Ты отвечаешь на том языке, на котором был задан вопрос или попросил пользователь. Реши задачу по инструкции ниже. Не извиняйся, не строй диалог.
Answer in the following format:
<think>Reasoning: ...</think>
..."""
},
{ # Task from https://3.shkolkovo.online/catalog/2552/93150
"role": "user",
"content": """Первый рабочий за час делает на 9 деталей больше, чем второй, и выполняет заказ, состоящий из 216 деталей, на 4 часа быстрее, чем второй рабочий, выполняющий такой же заказ. Сколько деталей в час делает первый рабочий?"""
},
]
data = {"model": model, "messages": messages}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json()["choices"][0]["message"]["content"])
#<think> Пусть x — количество деталей, которые делает второй рабочий за час. Тогда первый рабочий делает x + 9 деталей за час. Составим таблицу: Первый рабочий Второй рабочий Количество деталей в час x + 9 x Количество часов 216 : (x + 9) 216 : x Разность количества часов 4 216 : (x + 9) − 216 : x = 4 216x − 216(x + 9) = 4x(x + 9) 216x − 216x − 1944 = 4x^2 + 36x 1944 = 4x^2 + 36x 4x^2 + 36x − 1944 = 0 D = 36^2 + 4 · 4 · 1944 = 1296 + 31104 = 32400 = 180^2 x1 = −36 + 180 : 8 = 144 : 8 = 18 x2 = −36 − 180 : 8 < 0 — не подходит по смыслу задачи. Тогда первый рабочий делает 18 + 9 = 27 деталей в час. </think>
#27
```
#### Offline
```py
from vllm import LLM
from vllm.sampling_params import SamplingParams
from datetime import datetime, timedelta
# note that running this model on GPU requires over 60 GB of GPU RAM
llm = LLM(model="ZeroAgency/Zero-Mistral-24B", tokenizer_mode="mistral", tensor_parallel_size=8)
SYSTEM_PROMPT = """Ты виртуальный ассистент. Ты отвечаешь на вопросы людей, помогаешь им и поддерживаешь. Ты создан, чтобы быть полезным, безобидным и честным. Ты отвечаешь на том языке, на котором был задан вопрос или попросил пользователь.
Answer in the following format:
<think>Reasoning: ...</think>
..."""
user_prompt = """Что больше 9.9 или 9.11?"""
messages = [
{
"role": "system",
"content": SYSTEM_PROMPT
},
{
"role": "user",
"content": user_prompt
},
]
sampling_params = SamplingParams(max_tokens=512, temperature=0.0, top_p=1, top_k=-1)
outputs = llm.chat(messages, sampling_params=sampling_params)
print(outputs[0].outputs[0].text)
#<think> Задача: Сравните 9.9 и 9.11 для определения того, какой из них больше Подход: Десятичное сравнение с выравниванием десятичных точек Сложность: Низкий к среднему Я должен тщательно выровнять десятичные точки и сравнить цифры по месту. 1. Выровнять десятичные точки: 9.90 9.11 2. Сравните целые числа: оба имеют 9, поэтому они равны 3. Сравните десятые места: 9.90 имеет 9, 9.11 имеет 1 9 > 1, поэтому 9.90 больше 4. Сравните сотые места: 9.90 имеет 0, 9.11 имеет 1 0 < 1, но это не имеет значения, поскольку десятое место уже определило большее число<reflection>Я правильно выровнял десятичные точки и сравнил цифры по месту. Я заметил, что десятое место (9 против 1) определило, что 9.9 больше, чем 9.11. Сотые места не были необходимы для этого сравнения.</reflection> <self_improvement>В будущих сравнениях я буду уделять первоочередное внимание самым левым цифрам, где есть разница, чтобы оптимизировать процесс сравнения.</self_improvement> </think> 9.9 больше, чем 9.11. Когда вы сравниваете десятичные числа, вы начинаете с целых чисел, затем переходите к десятым местам, сотым местам и так далее. В этом случае 9.9 имеет 9 в десятом месте, в то время как 9.11 имеет 1 в десятом месте. Поскольку 9 > 1, 9.9 больше, чем 9.11.
```
### Transformers
If you want to use Hugging Face transformers to generate text, you can do something like this.
```py
from transformers import pipeline
import torch
messages = [
{"role": "user", "content": "Что больше 9.9 или 9.11?"},
]
chatbot = pipeline("text-generation", model="ZeroAgency/Zero-Mistral-24B", max_new_tokens=256, torch_dtype=torch.bfloat16)
response = chatbot(messages, temperature=0.1)
print(response[0]['generated_text'][1]['content'])
# 9.9 больше, чем 9.11.
```
### llama-server
You can run llama-server - OpenAI compatible server for serving [GGUF version](https://huggingface.co/ZeroAgency/Zero-Mistral-24B-gguf) of model.
Example of running with docker container:
```
docker run --gpus all -v `pwd`:/mnt -p8000:8000 ghcr.io/ggml-org/llama.cpp:server-cuda -fa --port 8000 --host 0.0.0.0 --temp 0.0 --jinja -ngl 100 --api-key DUMMY-API-KEY -m /mnt/Zero-Mistral-24B-Q4_K_M_L.gguf
```
## Environmental Impact
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
- **Hardware Type:** 8x H200
- **Hours used:** 29.5
- **Cloud Provider:** Runpod
- **Compute Region:** US-DE
- **Carbon Emitted:** `¯\_(ツ)_/¯`
|