Versalit SAC-1
A language model built entirely from scratch — tokenizer, Mixture-of-Experts architecture, training and benchmark, all in pure PyTorch. Made for customer service and sales in Brazilian Portuguese.
python generate.py --demo, in Portuguese. The model continues the customer's line (in italics) and replies as the agent; sampling uses temperature 0.8, so every run differs. In order: "my order hasn't arrived" → it asks for the order number; "I want to know the price" → it describes the premium plan; "I want to cancel my purchase" → the limit shows: instead of handling the cancellation, it answers about a free size exchange.What it is
A Small Language Model with a Mixture-of-Experts architecture: each token is routed to 2 of 8 experts — the same principle behind Mixtral. It uses RoPE, RMSNorm, SwiGLU, weight tying and a BPE tokenizer trained from scratch on the domain itself.
No pre-trained model, no fine-tuning, no LLM framework: tokenizer, architecture, training and benchmark were written by hand in pure PyTorch. The only dependency is torch.
How Mixture-of-Experts works
In a regular transformer every token goes through the same feed-forward layer. In MoE, that layer becomes 8 experts, and a router learns, token by token, which 2 to call. That is why the model has 12.4 million parameters in total, but only about 5 million work on each token.
A load balancing loss is added during training so the router does not send everything to the same experts. In SAC-1, layers 0, 2 and 4 are MoE and layers 1, 3 and 5 are dense — six blocks in total.
Embedding (1,024 tokens, 256 dim)
└─ 6 transformer blocks
RMSNorm → causal attention (8 heads, RoPE)
RMSNorm → SwiGLU FFN
blocks 0, 2, 4: MoE, 8 experts, top-2
blocks 1, 3, 5: dense
└─ RMSNorm → LM head (weights tied to the embedding)
Benchmark — 904 questions, 8 categories
| Category | Score |
|---|---|
| Exact FAQ | 100% |
| Multi-turn conversation | 100% |
| Sales objection | 100% |
| Sales script | 86.5% |
| Sentence completion | 85.9% |
| Paraphrased FAQ | 80.5% |
| Domain relevance | 75% |
| Intent classification | 68.4% |
| Composite score | 85.7% |
How to read it: overall, 87.8% of answers contain the expected information, 98.9% are coherent and 84.8% stay within the customer-service domain. The weak spot is paraphrased intent — the model memorizes more than it generalizes, and we publish that.
Training
| Parameter | Value |
|---|---|
| GPU | NVIDIA RTX 3060 (12 GB) |
| Optimizer | AdamW (β 0.9 / 0.95) |
| Learning rate | 3e-4, 500-step warmup + cosine |
| Batch | 64 |
| Precision | mixed (FP16) |
| Final loss (train) | 0.25 |
| Final perplexity | 1.3 |
| Data | ~3,900 synthetic customer-service and sales texts |
How to run
git clone https://huggingface.co/delvek/versalit-sac-1 cd versalit-sac-1 pip install torch python generate.py # interactive chat python generate.py --demo # demo python benchmark_qa.py # runs the 904-question benchmark
Honest limitations
- Trained on ~3,900 synthetic texts — production use needs real data from your support team.
- 1,024-token vocabulary: out-of-domain words become
<unk>. - 256-token context — long conversations get truncated.
- Brazilian Portuguese only — that is all it was trained on.
- It is a proof of concept of the MoE architecture, not a production chatbot.