Instructions to use salgr/SalgrAI_v2_Lite with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use salgr/SalgrAI_v2_Lite with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="salgr/SalgrAI_v2_Lite") 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_Lite") model = AutoModelForCausalLM.from_pretrained("salgr/SalgrAI_v2_Lite", 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_Lite 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_Lite:F16 # Run inference directly in the terminal: llama cli -hf salgr/SalgrAI_v2_Lite: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_Lite:F16 # Run inference directly in the terminal: llama cli -hf salgr/SalgrAI_v2_Lite: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_Lite:F16 # Run inference directly in the terminal: ./build/bin/llama cli -hf salgr/SalgrAI_v2_Lite:F16
Use Docker
docker model run hf.co/salgr/SalgrAI_v2_Lite:F16
- Llama new
- LM Studio
- Jan
- vLLM
How to use salgr/SalgrAI_v2_Lite with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "salgr/SalgrAI_v2_Lite" # 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_Lite", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/salgr/SalgrAI_v2_Lite:F16
- SGLang
How to use salgr/SalgrAI_v2_Lite 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_Lite" \ --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_Lite", "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_Lite" \ --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_Lite", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use salgr/SalgrAI_v2_Lite with Ollama:
ollama run hf.co/salgr/SalgrAI_v2_Lite:F16
- Unsloth Desktop
- Docker Model Runner
How to use salgr/SalgrAI_v2_Lite with Docker Model Runner:
docker model run hf.co/salgr/SalgrAI_v2_Lite:F16
- Lemonade
How to use salgr/SalgrAI_v2_Lite with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull salgr/SalgrAI_v2_Lite:F16
Run and chat with the model
lemonade run user.SalgrAI_v2_Lite-F16
List all available models
lemonade list
- Atomic Chat
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("salgr/SalgrAI_v2_Lite")
model = AutoModelForCausalLM.from_pretrained("salgr/SalgrAI_v2_Lite", 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]:]))SalgrAI-v2-Lite
A tiny Russian-language chat model (24,874,368 parameters, 11 layers) trained from scratch by one person on a single RTX 3060. It chats in a casual, friend-like style ("lowercase Telegram Russian") and is meant for experiments, demos and learning, not for serious use: it is far too small to be reliably correct.
Please read the Limitations section. The model often replies off-topic, gets facts and arithmetic wrong, and has no profanity or safety filter.
Model summary
| Architecture | decoder-only Transformer, Llama-style: RMSNorm, RoPE (theta 10000), SwiGLU, no biases, tied input/output embeddings |
| Size | 11 layers, hidden 384, 6 attention heads (head dim 64), FFN 1202, 24,874,368 parameters |
| Context | 1024 tokens |
| Vocabulary | 8192 (byte-level BPE trained on the pretraining text and the dialogs) |
| Language | Russian (some English, digits and symbols) |
| Format | chat: <|user|>...<|assistant|>...<|eos|> |
| Developed by | Salgr |
Files
| File | What it is |
|---|---|
model.safetensors |
weights, float32, Llama layout (loads with transformers, no custom code) |
pytorch_model.bin |
the same weights as a PyTorch state dict |
SalgrAI-v2-Lite-F16.gguf |
GGUF, float16, for llama.cpp (quantized variants are not provided) |
config.json, generation_config.json |
Llama config and the recommended sampling settings |
tokenizer.json, tokenizer_config.json, special_tokens_map.json |
tokenizer and chat template |
original/ |
the original code (model.py, common.py), the native checkpoint salgrai_original.pt and chat_example.py |
The three weight formats were checked against each other: transformers logits match the original model (max difference ~1e-5), greedy generation is identical, and the GGUF file run in llama.cpp gives the same top token and log-probabilities within 0.002 on the test prompts.
Quick start
Transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "YOUR-USERNAME/SalgrAI-v2-Lite"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo)
messages = [{"role": "user", "content": "привет"}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt", return_dict=True)
out = model.generate(**inputs) # sampling settings come from generation_config.json
print(tok.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
llama.cpp (GGUF)
llama-server -m SalgrAI-v2-Lite-F16.gguf -c 1024 --port 8080
# then, for example:
curl http://127.0.0.1:8080/completion -d '{"prompt": "<|user|>привет<|assistant|>", "n_predict": 120, "temperature": 0.8, "top_k": 40, "top_p": 0.9, "repeat_penalty": 1.1}'
# or the OpenAI-compatible endpoint (the chat template is embedded in the file):
curl http://127.0.0.1:8080/v1/chat/completions -d '{"messages": [{"role": "user", "content": "привет"}], "max_tokens": 120}'
Generation stops by itself at the end-of-turn token <|eos|>.
Native PyTorch
cd original
python chat_example.py # needs torch and tokenizers; commands: /reset, /exit
Prompt format
<|user|>message<|assistant|>reply<|eos|><|user|>next message<|assistant|>
The model was trained with the loss on assistant tokens only. The reference code (original/common.py) additionally collapses whitespace, replaces <| in user text with < | (so users cannot inject service tokens) and drops the oldest turns when the context is full; the Hugging Face chat template does none of that. Recommended sampling: temperature 0.8 (0.5-0.6 gives steadier but duller replies), top-k 40, top-p 0.9, repetition penalty 1.1. Note that transformers applies the repetition penalty to the prompt tokens as well, the reference code only to generated tokens.
Training
Everything was trained from random initialization on one RTX 3060 (12 GB) in bf16. No third-party model weights were used.
Tokenizer. Byte-level BPE, 8192 tokens, trained on the pretraining text plus the dialogs.
Pretraining. Grown from the 6-layer pretraining checkpoint to 11 layers: 5 new layers were inserted between the old ones with zero-initialised output projections, so at the start the grown model computed exactly the same logits as the 6-layer model (checked: max difference 0). It was then trained for about 300M more tokens (4,577 steps x 65,536) on windows from 25% Wikipedia and 75% OpenSubtitles (the subtitle corpus was extended to about 273M training tokens), AdamW lr 8e-4 with cosine decay to 8e-5. Final validation loss: Wikipedia 2.916 (perplexity 18.5), subtitles 2.943 (perplexity 19.0); the subtitle validation set differs from the 6-layer run, so these numbers are not directly comparable with it.
Fine-tuning. SFT from the 11-layer pretraining checkpoint (the same one v1.2 started from) on 4,691 short casual-conversation dialogs (see below), lr 2e-4, best epoch 3 by validation loss; 300 dialogs held out. Loss only on assistant tokens.
Synthetic dialogs. The fine-tuning dialogs are synthetic, written by Claude Haiku (Anthropic) from a written specification: about 5,000 short casual dialogs (62% a single exchange, 28% two, 9% three) in ten groups: greetings, how-are-you and mood, questions about the assistant itself, everyday chat (home, food, weather), hobbies and entertainment, people and daily affairs, emotions and support, simple requests (a film, a joke, a cat's name), thanks / farewells / short reactions, and a little basic knowledge. The specification follows the eight SBB categories and asks for short replies (median 7 words) that react to what the user said, a consistent assistant persona (SalgrAI, a small neural network made by Salgr, no age, favourite colour blue, likes cats a bit more than dogs, pop/rock/jazz, winter, chess and word games), a question back in about 45% of replies, and no advice, no excuses ("не знаю", "хз") and no filler openers ("ну", "тогда"). After generation, dialogs whose first user message exactly matched an SBB prompt (2) and duplicates were removed and 300 dialogs were held out; 4,691 were used for training. The dialogs are not released with the model. If you reuse the model, please also check the terms of the sources below.
Pretraining text sources. Russian Wikipedia (wikimedia/wikipedia, 20231101.ru; CC BY-SA) and Russian OpenSubtitles from OPUS (subtitle copyright belongs to the respective rights holders; check the OPUS terms before any reuse).
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 (a greeting for "привет", the right word or first number for a fact), is not an excuse ("не знаю", "хз"), has no profanity, does not loop on one word and is in Russian. The rules look at keywords, not meaning, so conversational scores are somewhat generous. Pass rate per category (results of 22 Nov 2026 from https://salgr.top/freeopus/sbb/):
| Category | Questions | v1 | v1.1 | v2 Lite |
|---|---|---|---|---|
| Greetings | 12 | 67% | 50% | 75% |
| How are you / mood | 10 | 20% | 50% | 80% |
| About itself | 10 | 80% | 100% | 80% |
| Everyday chat | 14 | 43% | 36% | 93% |
| Emotions and support | 10 | 30% | 10% | 50% |
| Simple requests and advice | 12 | 0% | 42% | 42% |
| Thanks, farewells, reactions | 12 | 67% | 50% | 92% |
| Basic knowledge | 20 | 0% | 5% | 5% |
| Total (of 100) | 100 | 35 | 39 | 60 |
How to read it, honestly.
- SBB is in-distribution for v2 Lite: its fine-tuning dialogs were written around the eight SBB categories (the 100 benchmark prompts themselves were removed from the training data, but similar phrasings exist), while v1 and v1.1 were not tuned this way. So 60 vs 39 shows that targeted data works for this kind of short conversation; it does not show that v2 Lite is generally 20 points smarter.
- An independent check by the author on 300 held-out dialogs with different wording (never used in training): replies with an obvious failure (empty, looping, an excuse, not Russian) were 5 of 300 for v2 Lite against 53 of 300 for v1.1. This check only catches obvious failures, not relevance; many replies are still off-topic.
- Basic knowledge stays at 5% (1 question of 20): the model does not know facts, simple arithmetic or capitals. That is expected: only about a tenth of the dialogs carry basic knowledge, there is no advice at all, and the model is tiny.
- Validation loss on 300 held-out dialogs from its own training distribution: 2.755 (perplexity 15.7). It is not comparable with other versions (different data).
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 and arithmetic almost never works: with 15-25M parameters and a small amount of Wikipedia text the model mostly learned the style of conversation, not facts. It often sounds fluent while being wrong or meaningless.
- No safety tuning and no profanity filter. Part of the pretraining text is movie subtitles, so the model can occasionally produce rude language or profanity. 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 biases and habits of the generator; the replies are short (typically 10 words or fewer).
- Mainly Russian; English is weak. Context is 1024 tokens.
- Sampled replies differ from run to run (sampling) and slightly between runtimes (the repetition-penalty difference noted above); the weights themselves are numerically equivalent in all formats.
SalgrAI family
| Model | Parameters | Notes |
|---|---|---|
| SalgrAI-v1 | 14,997,888 | first release; extra subtitle pseudo-dialog stage, 2,850 SFT dialogs |
| SalgrAI-v1.1 | 14,997,888 | second wave of dialogs, cleaner style (fewer "ну вот" tics), 4,317 SFT dialogs |
| SalgrAI-v1.2 | 24,874,368 | grown to 11 layers, more subtitles, third wave of dialogs, 5,878 SFT dialogs |
| SalgrAI-v2-Lite | 24,874,368 | same 25M network, fine-tuned only on casual conversation (no advice, no excuses); SBB 60 of 100 |
| SalgrAI-Decider | 25,024,129 | not a chat model: picks one of 2-8 options and returns probabilities |
Live demo (v1.1 and v2 Lite, switch at the top): https://salgr.top/freeopus/ - the SBB benchmark page: https://salgr.top/freeopus/sbb/ - the Decider: https://salgr.top/freeopus/decider/
License
Not specified yet (see the note at the top of this file). Also consider the licenses and terms of the training sources listed above.
- Downloads last month
- 93
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="salgr/SalgrAI_v2_Lite") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)