Instructions to use salgr/SalgrAI-v2-Full with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use salgr/SalgrAI-v2-Full with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="salgr/SalgrAI-v2-Full") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("salgr/SalgrAI-v2-Full") model = AutoModelForCausalLM.from_pretrained("salgr/SalgrAI-v2-Full", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use salgr/SalgrAI-v2-Full 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 salgr/SalgrAI-v2-Full:F16 # Run inference directly in the terminal: llama cli -hf salgr/SalgrAI-v2-Full:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf salgr/SalgrAI-v2-Full:F16 # Run inference directly in the terminal: llama cli -hf salgr/SalgrAI-v2-Full: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 salgr/SalgrAI-v2-Full:F16 # Run inference directly in the terminal: ./build/bin/llama cli -hf salgr/SalgrAI-v2-Full:F16
Use Docker
docker model run hf.co/salgr/SalgrAI-v2-Full:F16
- Llama new
- LM Studio
- Jan
- vLLM
How to use salgr/SalgrAI-v2-Full with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "salgr/SalgrAI-v2-Full" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "salgr/SalgrAI-v2-Full", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/salgr/SalgrAI-v2-Full:F16
- SGLang
How to use salgr/SalgrAI-v2-Full 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 "salgr/SalgrAI-v2-Full" \ --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": "salgr/SalgrAI-v2-Full", "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 "salgr/SalgrAI-v2-Full" \ --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": "salgr/SalgrAI-v2-Full", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use salgr/SalgrAI-v2-Full with Ollama:
ollama run hf.co/salgr/SalgrAI-v2-Full:F16
- Unsloth Desktop
- Docker Model Runner
How to use salgr/SalgrAI-v2-Full with Docker Model Runner:
docker model run hf.co/salgr/SalgrAI-v2-Full:F16
- Lemonade
How to use salgr/SalgrAI-v2-Full with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull salgr/SalgrAI-v2-Full:F16
Run and chat with the model
lemonade run user.SalgrAI-v2-Full-F16
List all available models
lemonade list
- Atomic Chat
SalgrAI-v2-Full
A small Russian-language chat model: Gemma 3 270M-it fine-tuned by one person on a single RTX 3060 for short, casual, friend-like conversation ("lowercase Telegram Russian"). It is the bigger sibling of SalgrAI-v2-Lite (25M parameters, trained from scratch): same dialogs, much larger pretrained backbone. It is meant for experiments, demos and learning, not for serious use.
Please read the Limitations section. Gemma's vocabulary covers every language, so without the supplied vocabulary mask the model sometimes emits stray foreign characters (about a third of sampled replies in our test). It has weak factual knowledge and no safety or profanity filter of its own beyond what Gemma already had.
Model summary
| Base model | google/gemma-3-270m-it |
| Architecture | Gemma 3, decoder-only: 18 layers, hidden 640, 4 heads (1 KV head), FFN 2048, sliding-window + global attention, vocabulary 262,144 |
| Parameters | 268,098,176 (about 170M of them are the embedding table; the other ~100M were fine-tuned) |
| Context | 32K in the base model; fine-tuned on short dialogs (up to a few hundred tokens) |
| Language | Russian (the model still understands some English) |
| Format | Gemma chat template: <start_of_turn>user ... <end_of_turn><start_of_turn>model ... |
| Developed by | Salgr |
| License | Gemma Terms of Use (see License) |
Files
| File | What it is |
|---|---|
model.safetensors |
weights, bfloat16 (loads with transformers) |
pytorch_model.bin |
the same weights as a PyTorch state dict |
SalgrAI-v2-Full-F16.gguf |
GGUF, float16, for llama.cpp |
SalgrAI-v2-Full-Q8_0.gguf |
GGUF, 8-bit (Q8_0), 292 MB: about half the size, about 3 SBB points lower (see Evaluation) |
config.json, generation_config.json |
config and the recommended sampling settings |
tokenizer.json, tokenizer.model, tokenizer_config.json, special_tokens_map.json, added_tokens.json, chat_template.jinja |
the unchanged Gemma tokenizer and chat template |
vocab_mask.py, chat_example.py |
the vocabulary mask (see below) and a minimal chat script |
NOTICE |
the notice required by the Gemma Terms of Use |
The weight formats were checked against each other: transformers logits from model.safetensors and pytorch_model.bin match the original fine-tuned model exactly, and the F16 GGUF run in llama.cpp gives the same first token as the fp32 reference on 10 of 10 test prompts (mean log-probability difference 0.0005). Q8_0 agrees on the first token in 10 of 10 and on the whole greedy reply in 9 of 10 prompts.
Quick start
Transformers
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, LogitsProcessorList
from vocab_mask import RuAllowed # file in this repository: forbids tokens of other scripts
repo = "YOUR-USERNAME/SalgrAI-v2-Full"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16)
mask = LogitsProcessorList([RuAllowed(tok, model.config.vocab_size)])
messages = [{"role": "user", "content": "ะฟัะธะฒะตั"}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt", return_dict=True)
out = model.generate(**inputs, logits_processor=mask) # sampling settings come from generation_config.json
print(tok.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Use bfloat16 or float32. Do not run it in float16: Gemma 3 is numerically unstable in fp16 (in our test the greedy replies differed from the fp32 reference on 10 of 10 prompts, against 3 of 10 for bf16).
llama.cpp (GGUF)
llama-server -m SalgrAI-v2-Full-Q8_0.gguf -c 1024 --port 8080
curl http://127.0.0.1:8080/v1/chat/completions -d '{"messages": [{"role": "user", "content": "ะฟัะธะฒะตั"}], "max_tokens": 80, "temperature": 0.8, "top_k": 40, "top_p": 0.9, "repeat_penalty": 1.1}'
The chat template is embedded in the file. To forbid foreign scripts in llama.cpp, send a logit_bias list with false for every token that vocab_mask.build_allowed(...) marks as not allowed (about 103,000 tokens; the server accepts "logit_bias": [[token_id, false], ...]). Do not put <bos> in a raw /completion prompt: llama.cpp adds it itself.
The vocabulary mask
Gemma 3's vocabulary has 262,144 tokens in all scripts. After fine-tuning on Russian, the model still sometimes picks a token from another script (an Arabic question mark ุ instead of ?, Chinese characters, glued fragments). vocab_mask.py sets the logits of every token that is not Cyrillic, ASCII, common typographic punctuation or an emoji to minus infinity, which leaves about 159,000 of 262,144 tokens. On 300 held-out prompts with sampling (temperature 0.8) this reduced replies with stray foreign characters from 95 to 0, and the SBB score did not drop (82 vs 81 without it).
Training
Base. google/gemma-3-270m-it. Full fine-tuning in bf16 with the embedding table frozen (it doubles as the output layer; freezing keeps the huge vocabulary intact and fits in 12 GB). AdamW, learning rate 2e-5, weight decay 0.01, batch 16, 3 epochs, loss on assistant tokens only; the checkpoint with the best validation loss (epoch 2: loss 2.284, perplexity 9.8) is published. Training took about 7.5 minutes.
Data: 12,981 short dialogs (about 650K tokens).
- ~6,700 casual dialogs written by Claude Haiku (Anthropic) from a written specification, most of them the same dialogs used for SalgrAI-v2-Lite (the specification follows the eight SBB categories; short replies, a consistent assistant persona, no advice and no excuses such as "ะฝะต ะทะฝะฐั");
- ~4,900 more such dialogs from a second generation round (more greetings, small talk, emotions and support, "about yourself", thanks and reactions, jokes and games);
- ~1,400 simple knowledge dialogs generated by a script from small hand-made tables (capitals, authors, arithmetic, and similar). The 100 SBB prompts were removed from the training data when they appeared verbatim; near-paraphrases of short phrases such as "ะฟัะธะฒะตั" do occur. 300 dialogs were held out. The assistant persona says it is a small neural network of about 270 million parameters made by Salgr. The dialogs are not released with the model.
Evaluation
SBB V1.0 (SalgrAI Basic Benchmark) is the author's own small benchmark: 100 short Russian messages (80 casual-conversation prompts and 20 basic-knowledge questions), one reply each, no history, temperature 0. A reply passes if it contains what is expected, is not an excuse, has no profanity, does not loop and is mostly in Russian. The rules look at keywords, not meaning, so conversational scores are somewhat generous. Pass rate per category (local run, greedy, repetition penalty 1.1, up to 120 tokens):
| Category | Questions | LFM2.5 350M | Gemma 3 270M-it (base) | v2-Full | v2-Full Q8_0 |
|---|---|---|---|---|---|
| Greetings | 12 | 58% | 83% | 92% | 92% |
| How are you / mood | 10 | 40% | 50% | 80% | 70% |
| About itself | 10 | 60% | 70% | 100% | 100% |
| Everyday chat | 14 | 64% | 79% | 100% | 100% |
| Emotions and support | 10 | 20% | 40% | 90% | 70% |
| Simple requests and advice | 12 | 58% | 67% | 67% | 67% |
| Thanks, farewells, reactions | 12 | 33% | 42% | 92% | 92% |
| Basic knowledge | 20 | 10% | 35% | 50% | 55% |
| Total (of 100) | 100 | 41 | 57 | 81 | 79 |
For reference, on the same benchmark SalgrAI-v2-Lite (25M, from scratch) scores 60, v1.1 scores 39 and v1 scores 35 (from https://salgr.top/freeopus/sbb/). GGUF F16 scores 82 in llama.cpp.
How to read it, honestly.
- SBB is in-distribution for this model: its fine-tuning dialogs were written around the eight SBB categories (the 100 prompts themselves are not in the training data, but similar phrasings are). The two baselines were not tuned for this test, and the rules punish long and non-Russian replies, which disadvantages general-purpose models. So 81 vs 57 shows that targeted data works for short casual chat; it does not show that the model is generally smarter than Gemma 3 270M-it.
- Knowledge did not improve beyond what was explicitly trained. On 73 facts held out from the training tables, the model got 47 of 55 new arithmetic questions right (the previous version of this model, before the second round of dialogs: 32), but only 1 of 14 capitals and 0 of 4 authors that were not in the tables. The "basic knowledge" gain on SBB comes from arithmetic and from trained facts that overlap with benchmark questions.
- On 300 held-out dialogs with different wording, replies with an obvious failure (empty, looping, an excuse, not Russian) were 3 of 300.
Intended use, limitations and risks
- Intended use: hobby experiments, demos, studying how small language models behave, a baseline for tiny Russian chat models.
- Not for: advice, facts, calculations, moderation, anything where a wrong or rude answer matters.
- Factual knowledge is unreliable. The model sounds fluent while often being wrong or meaningless; it mostly learned the style of conversation.
- Stray foreign characters appear without the vocabulary mask (about 32% of sampled replies in our test).
- At temperature 0.8 the model sometimes produces non-words made of Russian letters ("ััะดะพะผัะตะบ"); a lower temperature (about 0.5) helps but was not measured.
- No extra safety tuning. The base model has Gemma's own alignment, which fine-tuning on casual dialogs may have weakened. If you expose it publicly, add your own filtering.
- The fine-tuning dialogs are LLM-generated, so the style is narrow (casual, short, lowercase) and carries the habits of the generator. The model also mentions "SalgrAI" in places where it does not fit.
- Mainly Russian; English is weak. Not for float16 inference.
SalgrAI family
| Model | Parameters | Notes |
|---|---|---|
| SalgrAI-v1 / v1.1 | 14,997,888 | from scratch, first releases |
| SalgrAI-v1.2 | 24,874,368 | from scratch, grown to 11 layers |
| SalgrAI-v2-Lite | 24,874,368 | from scratch, only casual conversation; SBB 60 of 100 |
| SalgrAI-v2-Full | 268,098,176 | Gemma 3 270M-it fine-tuned; SBB 81 of 100 |
| SalgrAI-Decider | 25,024,129 | not a chat model: picks one of 2-8 options |
Live demo: https://salgr.top/freeopus/ - benchmark page: https://salgr.top/freeopus/sbb/
License
This model is a Model Derivative of Gemma and is provided under the Gemma Terms of Use (https://gemma.ai/resources/terms). Whoever uses or redistributes it must follow those terms, including the Gemma Prohibited Use Policy (https://gemma.ai/resources/prohibited_use_policy), must receive a copy of the terms and must keep the NOTICE file. The weights were modified by fine-tuning (see Training). Also consider the terms of the data used to generate the dialogs.
- Downloads last month
- 164