SalgrAI v3.1 Ultra
SalgrAI v3.1 Ultra is a compressed and knowledge-upgraded 0.96B successor to SalgrAI v3 Ultra Full (1.54B), built using the exact SalgrAI_v2.1_Pro pruning ratio (~1.60x parameter reduction) plus Russian Wikipedia / encyclopedic Q&A knowledge distillation and boundary alignment from salgrai-dialogts-2.txt.
Compared to the 1.54B SalgrAI v3 Ultra Full, SalgrAI v3.1 Ultra cuts total parameters from 1,543,714,304 down to 964,310,528 (62.5%, 1.60x smaller — matching SalgrAI_v2.1_Pro's 310.2M / 494.0M = 62.8%, 1.59x compression ratio), reduces disk footprint (model.safetensors: 1.93 GB vs 3.09 GB; Q8_0: 1.03 GB vs 1.65 GB; Q4_K_M: 607 MB vs 986 MB), and improves SBKCB V1.0 overall from 97/150 to 108/150 (bf16) / 110/150 (Q8_0 GGUF), driven by a +13 to +15 point jump in Knowledge (57/90 bf16, 59/90 GGUF vs 44/90).
Please read the Limitations section. Although encyclopedic Q&A and Python execution trade off differently at 0.96B (
15/25on our independent Python suite vs24/25on the 1.54B full model), factual hallucinations on unseen trivia still occur and external moderation is advised for public deployment.
Model summary
| Base lineage | SalgrAI v3 Ultra Full ← Qwen/Qwen2.5-Coder-1.5B-Instruct (Apache-2.0) |
| Compression blueprint | SalgrAI_v2.1_Pro (vocabulary pruning + structural SwiGLU MLP pruning + multi-stage distillation & SFT) |
| Architecture | Pruned Qwen2 decoder-only: 28 layers, hidden 1,536, 12 attention heads (2 KV heads, GQA), FFN 5,376 (down from 8,960), context 32,768 |
| Parameters | 964,310,528 = 693,633,024 MLP + 270,677,504 Attention/Norms/Embeddings (75,776 tokens × 1,536, tied embeddings) |
| Compression ratio | 62.5% of 1,543,714,304 (1.60x smaller) |
| Vocabulary | 75,776 tokens (exact SalgrAI_v2.1_Pro Russian/English/Code subset: 75,754 BPE + 22 special tokens; bos/pad=75754, eos=75756) |
| Language | Russian (primary), English (coding and chat preserved) |
| Format | ChatML with built-in SalgrAI default system prompt (chat_template.jinja, tokenizer_config.json) |
| Developed by | Salgr |
| License | Apache-2.0 (see LICENSE and NOTICE) |
Files
| File | Size | What it is |
|---|---|---|
model.safetensors | 1.93 GB | weights, bfloat16 (loads with transformers) |
SalgrAI-v3.1-Ultra-F16.gguf | 1.93 GB | GGUF, float16, for llama.cpp |
SalgrAI-v3.1-Ultra-Q8_0.gguf | 1.03 GB | GGUF, 8-bit (Q8_0): recommended for local CPU/GPU (110/150 SBKCB) |
SalgrAI-v3.1-Ultra-Q4_K_M.gguf | 607 MB | GGUF, 4-bit (Q4_K_M): ultra-compact (109/150 SBKCB) |
config.json, generation_config.json | model config (intermediate_size: 5376, vocab_size: 75776) and recommended sampling (temperature: 0.5, top_k: 40, top_p: 0.9, repetition_penalty: 1.1) | |
tokenizer.json, tokenizer_config.json, chat_template.jinja | pruned 75,776-token Qwen2 tokenizer and SalgrAI ChatML template | |
chat_example.py | minimal terminal chat script keeping dialog history | |
eval/ | raw evaluation JSON reports (sbkcb.json, coding.json, dialogts2_roles.json, sbkcb_gguf_*.json) | |
SHA256SUMS.txt, .gitattributes, LICENSE, NOTICE | checksums, Git LFS rules, Apache-2.0 license and derivative notice |
Quick start
Transformers
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "." # or Hugging Face repo id
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16)
messages = [{"role": "user", "content": "привет! кто ты?"}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt", return_dict=True)
out = model.generate(**inputs)
print(tok.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
llama.cpp (GGUF)
llama-server -m SalgrAI-v3.1-Ultra-Q8_0.gguf -c 2048 --port 8080
curl http://127.0.0.1:8080/v1/chat/completions -H "Content-Type: application/json" \
-d '{"messages": [{"role": "user", "content": "привет"}], "max_tokens": 200, "temperature": 0.5, "top_k": 40, "top_p": 0.9, "repeat_penalty": 1.1}'
Compression & training pipeline
- Teacher LoRA SFT (
1.54B):SalgrAI v3 Ultra Fullfine-tuned (r=24,lora_alpha=48,lr=6.0e-5, 124 steps, merged) on rewrittensalgrai-dialogs-2026-11-25_2026-12-01.jsonl, curatedsalgrai-dialogts-2.txtboundary/refusal dialogs, role-separation multi-turn conversations, Python/HTML tasks, and Russian knowledge Q&A (100/150SBKCB,23/25Python). - Vocabulary pruning (
151,936 -> 75,776): exact token ID remapping matchingSalgrAI_v2.1_Pro(1.54B -> 1.43B, retaining23/25Python with zero coding degradation). - Balanced activation-guided MLP pruning (
8,960 -> 5,376): SwiGLU neuron importance (act_rms * ||W_down||_2) calibrated on 240 balanced sequences across Russian Wikipedia, teacher-verified Python functions, math/code-tracing, and Russian dialogs (964,310,528params,1.60xsmaller). - Two-stage distillation:
- Stage 1 (Layer-wise MLP recovery, 450 steps): Attention and Embeddings frozen; all 28 student MLP blocks match teacher MLP outputs (
cos=0.9816,layer_loss=0.0372, bringing Python from pruned init straight to10/25). - Stage 2 (End-to-end KL + hidden-state distillation, 700 steps): logit KL (
T=2.0) + CE + 4-layer hidden-state alignment across 4 balanced 25% buckets (Wikipedia prose, teacher Python/HTML code, math/tracing, dialogs/knowledge) yieldingval_kl=0.2037,val_ce=0.6548,16/25Python,81/150SBKCB.
- Stage 1 (Layer-wise MLP recovery, 450 steps): Attention and Embeddings frozen; all 28 student MLP blocks match teacher MLP outputs (
- SFT & KL-anchored Knowledge Upgrade:
- Combined
3,500core Russian Wikipedia (20231101.ru) encyclopedic lead articles (wiki_core_ru.jsonl) and506broad Russian school-curriculum Q&A pairs (encyclopedia_qa_ru.jsonl, 0 verbatim benchmark prompt overlap) alongside Python coding, chat, andsalgrai-dialogts-2.txtboundary replay (train_knowledge_boost.py, 420 steps with0.20KL anchor on code/chat ->53/90Knowledge,104/150total; followed by 65+45 KL-anchored boundary/chat polish steps ->57/90Knowledgebf16/59/90GGUF,10/10dialogts-2 stress,24/24role separation).
- Combined
Evaluation
All SBKCB V1.0 runs use temperature 0, repetition penalty 1.1, max_new_tokens=200. bf16 runs use sbkcb/run_hf.py; GGUF runs use /usr/local/lib/ollama/llama-server /v1/chat/completions.
SBKCB V1.0 (150 items: 90 Knowledge, 20 Coding, 40 Conversation)
| Model | Params | Total /150 | % | Knowledge /90 | Code /20 | Conv /40 | Easy /46 | Medium /85 | Hard /19 |
|---|---|---|---|---|---|---|---|---|---|
| SalgrAI v3.1 Ultra (Q8_0 GGUF) | 0.96B | 110 | 73.3% | 59 | 16 | 35 | 39 | 62 | 9 |
| SalgrAI v3.1 Ultra (F16 GGUF) | 0.96B | 109 | 72.7% | 59 | 16 | 34 | 39 | 60 | 10 |
| SalgrAI v3.1 Ultra (Q4_K_M GGUF) | 0.96B | 109 | 72.7% | 59 | 17 | 33 | 40 | 60 | 9 |
| SalgrAI v3.1 Ultra (bf16) | 0.96B | 108 | 72.0% | 57 | 17 | 34 | 39 | 60 | 9 |
SalgrAI v3.1 Teacher (checkpoint-124, bf16) | 1.54B | 100 | 66.7% | 45 | 20 | 35 | 37 | 57 | 6 |
| SalgrAI v3 Ultra Full (bf16) | 1.54B | 97 | 64.7% | 44 | 20 | 33 | 36 | 55 | 6 |
| SalgrAI v3 Ultra Full (Q8_0 GGUF) | 1.54B | 94 | 62.7% | 42 | 20 | 32 | 35 | 54 | 5 |
| Qwen2.5-Coder-1.5B-Instruct (base, bf16) | 1.54B | 80 | 53.3% | 40 | 14 | 26 | 30 | 46 | 4 |
| SalgrAI_v2.1_Pro (compressed) | 310M | 59 | 39.3% | 12 | 16 | 31 | — | — | — |
Independent coding, dialogts-2 stress & role separation (bf16)
| Suite | SalgrAI v3.1 Ultra (0.96B) | Notes |
|---|---|---|
eval_coding.py (25 unit-tested Python tasks) | 15 / 25 (60.0%) | RU: 8/15, EN: 7/10 (vs 24/25 on 1.54B Full, 8/25 on 865M trial) |
salgrai-dialogts-2.txt stress (10 turns) | 10 / 10 (100%) | Clean profanity de-escalation, boundary explanation, firm RAT / стиллер refusals, 18+ roleplay resistance |
| Multi-turn role separation & context memory | 24 / 24 (100%) | Keeps user name/city/hobby/number separate from SalgrAI identity across all 6 multi-turn scenarios |
Unedited SBKCB examples (temperature 0, bf16):
| Prompt | Reply |
|---|---|
| как называется естественный спутник Земли? | Луна. |
| чему равен квадрат числа 9? | 81. |
| сколько будет половина от 90? | 45. |
| в какой стране находится город Рейкьявик? | В Северной Америке (Южная Америка). (wrong, Iceland) |
| кто написал сказку «Золотой ключик, или Приключения Буратино»? | Александр Островский. (wrong, Alexey Tolstoy) |
| Что выведет код на Python: print(len('привет')) | 5\n\nВ слове 'привет' ровно 5 букв. (wrong, 6) |
| эй, привет-привет! как оно? | привет) всё хорошо, спасибо! как сам? |
| расскажи немного о себе | меня зовут SalgrAI, компактная языковая модель от Salgr для общения и программирования. |
Limitations & benchmark note
- Compression trade-off on multi-line Python algorithms: pruning 40% of the MLP (
8,960 -> 5,376) preserves natural Russian conversation (34–35/40) and factual Q&A (57–59/90) remarkably well, while algorithmic edge-case accuracy on unseen 25-task Python functions drops from24/25(1.54B) to15/25(0.96B). For Python-heavy workloads, use the1.54BSalgrAI v3 Ultra Full. - Knowledge training note: while zero exact
SBKCB V1.0prompt strings were included in training (0exact matches verified programmatically), the expandedencyclopedia_qa_ru.jsonland unfilteredwiki_core_ru.jsonlintentionally cover general Russian school-curriculum geography, history, science, grammar, literature, and everyday logic topics broadly to raise Knowledge above50/90from theQwen2.5-Coderbase. Unseen trivia and rare capitals can still hallucinate. - Safety: boundary and refusal behavior was strengthened on
salgrai-dialogts-2.txtpatterns, but small models are not adversarially aligned for public high-risk deployment without external filtering.