Instructions to use salgr/SalgrAI_v2.1_Lite with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use salgr/SalgrAI_v2.1_Lite with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="salgr/SalgrAI_v2.1_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.1_Lite") model = AutoModelForCausalLM.from_pretrained("salgr/SalgrAI_v2.1_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.1_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.1_Lite:F16 # Run inference directly in the terminal: llama cli -hf salgr/SalgrAI_v2.1_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.1_Lite:F16 # Run inference directly in the terminal: llama cli -hf salgr/SalgrAI_v2.1_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.1_Lite:F16 # Run inference directly in the terminal: ./build/bin/llama cli -hf salgr/SalgrAI_v2.1_Lite:F16
Use Docker
docker model run hf.co/salgr/SalgrAI_v2.1_Lite:F16
- Llama new
- LM Studio
- Jan
- vLLM
How to use salgr/SalgrAI_v2.1_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.1_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.1_Lite", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/salgr/SalgrAI_v2.1_Lite:F16
- SGLang
How to use salgr/SalgrAI_v2.1_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.1_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.1_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.1_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.1_Lite", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use salgr/SalgrAI_v2.1_Lite with Ollama:
ollama run hf.co/salgr/SalgrAI_v2.1_Lite:F16
- Unsloth Desktop
- Docker Model Runner
How to use salgr/SalgrAI_v2.1_Lite with Docker Model Runner:
docker model run hf.co/salgr/SalgrAI_v2.1_Lite:F16
- Lemonade
How to use salgr/SalgrAI_v2.1_Lite with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull salgr/SalgrAI_v2.1_Lite:F16
Run and chat with the model
lemonade run user.SalgrAI_v2.1_Lite-F16
List all available models
lemonade list
- Atomic Chat
SalgrAI-v2.1-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 is an update of SalgrAI-v2-Lite: the same network and tokenizer, but with 400M more tokens of pretraining (more Wikipedia, subtitles and Python code) and a larger fine-tuning set (casual chat, simple knowledge, Python basics, and facts about itself). It chats in a casual, friend-like style ("lowercase Telegram Russian") and is meant for experiments, demos and learning, not for serious use.
Please read the Limitations section. The model is far too small to be reliably correct: its factual knowledge is close to zero (about 3 correct answers out of 90 on our knowledge test), it writes short Python functions in the right form but often gets their output wrong, and it 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 Russian/English text; the same tokenizer as all SalgrAI models). It is inefficient for code: about 1.4 characters per token, against about 4 for Russian |
| Language | Russian (some English, digits and symbols) |
| Format | chat: `< |
| 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.1-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 1.6e-5), greedy generation is identical on 5 of 5 test prompts, and the GGUF file run in llama.cpp gives the same top token on 6 of 6 prompts and identical 30-token greedy continuations on 6 of 6 (max log-probability difference 0.004).
Quick start
Transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "YOUR-USERNAME/SalgrAI-v2.1-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.1-Lite-F16.gguf -c 1024 --port 8080
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}'
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) 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.
Training
Everything was trained from random initialization on one RTX 3060 (12 GB) in bf16. No third-party model weights were used.
Stage 1, as in v2-Lite. A 6-layer model was pretrained and then grown to 11 layers by inserting layers with zero-initialised output projections (the grown model gave exactly the same logits), and trained for about 300M more tokens of Russian Wikipedia (25%) and Russian OpenSubtitles (75%). See the SalgrAI-v2-Lite model card for the details of this stage.
Stage 2, new in v2.1-Lite: 400M more tokens (6,103 steps of 65,536 tokens, 67 minutes with torch.compile), AdamW, learning rate 3e-4 decayed to 3e-5. The mix of 1024-token windows: 12% the earlier Wikipedia, 38% new Wikipedia (shards not used before), 33% subtitles, 17% Python code. Validation loss before and after: Wikipedia 2.915 to 2.774, new Wikipedia 2.972 to 2.738, subtitles 2.965 to 2.974 (unchanged: their share was lower), code 2.341 to 0.907.
- Code: 24,720 Python files (50.3M tokens) from codeparrot-clean, only files under permissive licenses (MIT, Apache-2.0, BSD-2/3-Clause, ISC, Unlicense, CC0-1.0), auto-generated files and files with non-Russian/non-ASCII text removed, indentation kept.
Stage 3, fine-tuning (loss on assistant tokens only): about 19,000 short dialogs, learning rate 2e-4 decayed to 2e-5, batch 32, dropout 0.1, weight decay 0.05; the epoch with the best validation loss (epoch 5, 2.284, perplexity 9.8) is published.
- ~9,800 casual conversation dialogs, synthetic, written by Claude Haiku (Anthropic) from a written specification (short replies, a consistent persona, no advice and no excuses);
- ~3,400 short knowledge dialogs (geography, history, science, mathematics, Russian language and literature, culture, technology), also written by Claude Haiku; and ~1,000 examples built from small hand-made tables (capitals, authors, dates) and simple arithmetic;
- ~900 dialogs about programming concepts (Python, HTML, SQL, Git) written by Claude Haiku;
- ~2,400 "what does this Python code print" examples, generated by a script and answered by actually running the code, and ~570 "write a function" examples in which every solution was checked by tests;
- 94 dialogs about the model itself (name, version, creator, size), repeated 4 times: "I am SalgrAI v2.1 Lite, a small neural network made by Salgr, about 25 million parameters". 310 dialogs were held out for validation. The dialogs are not released with the model.
Benchmark leakage control. Dialogs whose first message matched a question of the SBB or SBKCB benchmarks word for word were removed. For knowledge data, dialogs sharing two or more content words with a knowledge question of the benchmarks, or containing its expected answer, were also removed (about a quarter of the knowledge dialogs). The code-task data are of the same types as the benchmark's coding questions ("write a function", "what does this code print"), only not the same wording, so the coding score should not be read as a general ability.
Pretraining text sources. Russian Wikipedia (wikimedia/wikipedia, 20231101.ru; CC BY-SA), Russian OpenSubtitles from OPUS (subtitle copyright belongs to the respective rights holders; check the OPUS terms before any reuse) and the permissively licensed Python files listed above. If you reuse the model, please also check these terms.
Evaluation
Two small benchmarks of the author, one reply per prompt, no history, temperature 0, rule-based checks (keywords, not meaning, so conversational scores are somewhat generous). Local runs.
SBB V1.0 (100 short messages: 80 casual, 20 basic knowledge):
| Category | Questions | v2-Lite | v2.1-Lite |
|---|---|---|---|
| Greetings | 12 | 75% | 92% |
| How are you / mood | 10 | 80% | 60% |
| About itself | 10 | 80% | 90% |
| Everyday chat | 14 | 93% | 93% |
| Emotions and support | 10 | 50% | 100% |
| Simple requests and advice | 12 | 42% | 42% |
| Thanks, farewells, reactions | 12 | 92% | 92% |
| Basic knowledge | 20 | 5% | 10% |
| Total (of 100) | 100 | 60 | 67 |
SBKCB V1.0 (SalgrAI Basic Knowledge and Coding Bench, 150 harder questions: 90 knowledge, 20 coding, 40 conversation):
| Section | Questions | v2-Lite | v2.1-Lite |
|---|---|---|---|
| Knowledge | 90 | 1 | 3 |
| Coding | 20 | 0 | 5 |
| Conversation | 40 | 22 | 27 |
| Total (of 150) | 150 | 23 | 35 |
How to read it, honestly.
- The gains are in conversation (greetings, emotions and support, talking about itself) and in knowing who it is. Knowledge stays at noise level (3 of 90): the model does not know facts it was not trained on, such as capitals or authors.
- Coding (5 of 20) comes largely from question types the model was trained on, with different wording. It writes short functions in the right form (for example
def add(a, b): return a + b) but often predicts the output of code wrongly. - SBB is in-distribution for this model family: the fine-tuning dialogs were written around its categories (the benchmark prompts themselves were removed). A few points of difference between versions are within the run-to-run noise of these small benchmarks.
- The rules of SBKCB were refined after looking at model answers (false accepts for answers listing several options were closed), so the benchmark is somewhat tuned to the models that were tested.
Examples (temperature 0, unedited).
| Prompt | Reply |
|---|---|
| кто ты? | я SalgrAI v2.1 Lite, небольшая нейросеть для общения. |
| какая у тебя версия? | v2.1 Lite: это обновление v2 Lite. |
| напиши функцию сложения двух чисел на Python | def add(a, b): newline, four spaces, return a + b |
| Что выведет код на Python: print(6 * 7) | выведет 66 (wrong, the answer is 42) |
| какая столица у Италии? | Манила) а ты там бывал? (wrong) |
| мне грустно | грустно, когда так грустит. что случилось? |
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, writing or checking real code, moderation, anything where a wrong or rude answer matters.
- Factual knowledge is essentially absent and arithmetic is unreliable: with about 25M parameters the model mostly learned the style of conversation. It often sounds fluent while being wrong or meaningless; at temperature 0.8 it sometimes produces glued non-words made of Russian letters.
- No safety tuning and no profanity filter. Part of the pretraining text is movie subtitles, so the model can occasionally produce rude language. 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 names itself in places where it does not fit.
- The code was learned through a tokenizer built for Russian text (about 1.4 characters per token), and the model was trained on GitHub code under permissive licenses; its code answers are short and simple.
- Mainly Russian; English is weak. Context is 1024 tokens.
- Sampled replies differ from run to run and slightly between runtimes (
transformersapplies the repetition penalty to the prompt tokens as well, the reference code only to generated ones); the weights are numerically equivalent in all formats.
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.1-Lite | 24,874,368 | v2-Lite with 400M more tokens (Wikipedia, subtitles, code) and richer fine-tuning; SBB 67 of 100 |
| SalgrAI-v2 / v2-Full | 130.8M / 268.1M | Gemma 3 270M-it fine-tuned (separate repositories) |
| SalgrAI-Decider | 25,024,129 | not a chat model: picks one of 2-8 options |
Live demo: https://salgr.top/freeopus/ - benchmarks: https://salgr.top/freeopus/benchmarks
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
- 114