SalgrAI-Decider

Русская версия

A tiny (25,024,129 parameters) decision model: you give it a situation, a question and 2-8 options (it was trained with 2-7), and it returns a probability for every option in a single forward pass. It does not generate text. The idea follows the "decision model / System One" family (for example Jev by TypeSafe AI); this is an independent small model trained by one person and is not affiliated with or a reproduction of any of them.

It works on the kinds of tasks it was trained on (message type, topic, simple arithmetic, ...) and is unreliable on anything else. See Limitations. Do not use it for moderation or safety decisions.

Model summary

Backbone the SalgrAI-v1.2 transformer (11 layers, hidden 384, 6 heads, FFN 1202, RoPE, RMSNorm, SwiGLU) initialised from its pretraining checkpoint (before chat fine-tuning)
Changes bidirectional attention (with padding mask), no language-model head, a "pointer" head: MLP 384 -> 384 -> 1 applied to the hidden state at each <|option|> marker
Vocabulary 8196 = the 8192 SalgrAI tokens + 4 service tokens: <|state|>, <|criteria|>, <|option|>, <|end|>
Context 1024 tokens; trained with 2-7 options (the code accepts up to 8)
Parameters 25,024,129
Output softmax over options of logit / T, T = 1.72 (fitted on validation)
Developed by Salgr

Input is one sequence: <|state|> situation <|criteria|> question <|option|> option 1 <|option|> option 2 ... <|end|>.

Files

File What it is
model.safetensors, pytorch_model.bin weights, float32 (identical tensors in both files)
config.json sizes and the calibration temperature
tokenizer.json SalgrAI tokenizer with the 4 extra service tokens
salgrai_decider.py standalone inference code (needs torch, tokenizers, safetensors)

There is no GGUF: llama.cpp has no architecture matching a bidirectional model with a pointer head.

Quick start

import sys
from huggingface_hub import snapshot_download

path = snapshot_download("YOUR-USERNAME/SalgrAI-Decider")
sys.path.insert(0, path)
from salgrai_decider import SalgrDecider

d = SalgrDecider.from_pretrained(path)
for r in d.decide("Как установить питон на компьютер?",
                  ["программирование", "еда, здоровье и быт", "география и история"],
                  criteria="О чём этот диалог?"):
    print(f"{r['prob']:.2f}  {r['option']}")
# 0.62  программирование
# 0.25  география и история
# 0.13  еда, здоровье и быт

The model was trained on Russian text with Russian criteria; the criteria wording used in training is listed under Training (it copes best with similar phrasing).

Training

Initialised from the SalgrAI-v1.2 pretraining checkpoint and fine-tuned on 81,534 automatically generated "choose an option" tasks (the correct option is known by construction, no manual labelling). Small task families were repeated to balance them; each family was capped at 14,000 tasks.

Task family Where the tasks come from Options
message type user messages of our synthetic dialogs, labelled by keyword rules 3-6 of 6 types
topic the topic group a dialog came from 3-7 of 12 topics
reply continuation the real assistant reply vs replies of other dialogs (half from the same topic) 3-6
refuse / not sure whether the assistant refused / said it is not sure in the synthetic data 2
arithmetic generated by a program (sum, difference, product, quotient, percent, largest/smallest, parity, sequences, word problems) 2-5
Wikipedia article paragraph (title words masked) -> its title among random titles 3-6
subtitle continuation 3 subtitle lines -> the real next line vs random lines 3-5

3 epochs, AdamW (lr 2e-4 for the backbone, 1e-3 for the head), batch 32, bf16; the checkpoint with the best validation loss (epoch 2) is published. Validation and test tasks are held out by source: all tasks built from one dialog / article / subtitle window go to the same split (message-type tasks are held out per unique message). Distractor options are drawn from the whole pool, so a distractor may come from a training source.

Evaluation (test split, tasks the model has not seen)

Task family Accuracy Random choice Tasks
type of a message (greeting, question, request, thanks, farewell, emotion) 0.98 0.23 190
topic of a dialog (12 topics) 0.89 0.22 870
which Wikipedia article a paragraph comes from (title words are masked) 0.45 0.24 779
arithmetic, largest number, parity, number sequences, word problems 0.42 0.28 1200
which reply continues a dialog (true reply vs replies from other dialogs) 0.33 0.24 870
which line continues a movie-subtitle exchange 0.30 0.26 1100
should the assistant refuse this request 0.67 0.50 24
should the assistant honestly say it is not sure 0.65 0.50 26

The refuse and not sure test sets are tiny (24-26 tasks) because there are few such examples in the data: treat those two numbers as indicative only. The message-type and topic families are the strong ones; arithmetic, continuation of dialogs and subtitles are weak (close to chance for subtitles).

Calibration. A temperature of 1.72 was fitted on the validation split. Expected calibration error on the test split was 0.030 before and 0.033 after, i.e. the temperature did not help: probabilities were already roughly calibrated on these task families. That does not carry over to arbitrary tasks.

Intended use, limitations and risks

  • Intended use: demos and experiments with small "decision" models, routing or labelling among a few options in the task families above, studying calibration of tiny models.
  • Not for: moderation, safety, legal, medical or financial decisions.
  • The labels come from simple rules and from the synthetic data (topic from the group a dialog came from, message type from keywords, refusals and "not sure" from what a generator model wrote), so they are noisy and reflect that data's biases.
  • It is not a general zero-shot decider: new kinds of tasks or unusual option sets can give confident wrong answers. When it does not know it often returns nearly equal probabilities, which is the useful behaviour.
  • Arithmetic is poor (0.42 accuracy where chance is 0.28), facts are weak; more than 7 options were not trained, and more than 8 are rejected by the code.
  • Mainly Russian.

SalgrAI family

SalgrAI-v1, SalgrAI-v1.1 and SalgrAI-v1.2 are the chat models (15M / 15M / 25M parameters). Live demo: https://salgr.top/freeopus/decider/

License

Not specified yet (see the note at the top of this file).

Downloads last month
25
Safetensors
Model size
25M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support