spellman — Cyrillic-optimized language detection

This is the runtime model for spellman, a fast Rust language detector covering 30 languages: the big world languages plus twenty Cyrillic-script languages (Yakut, Tuvan, Udmurt, Komi, Mari, Ossetic, Chechen, …) that most detectors don't know exist. It is built for the text that breaks language detectors — tweets, comments, two-word utterances, and close pairs like Russian/Ukrainian — and runs at ~3.5 µs per document on a desktop CPU.

8.9 MB, one lookup table. The trained network folds algebraically into a single quantized table; inference is pure lookups, no matmul.

Usage

The featurizer lives in the Rust runtime, so the model is consumed through the spellman crate or CLI (not a standalone checkpoint):

echo "Съешь ещё этих мягких французских булок" | spellman detect --model hf:vpermilp/spellman   # rus
printf 'Қазақша\nHello\n' | spellman detect --model hf:vpermilp/spellman --lines               # kaz / eng
use spellman_detector::SingleDetector;
let mut det = SingleDetector::from_hub(1024)?;
let d = det.detect("Күн сайын аҕыйах тыл үөрэт")?;   // sah

Pick a storage format by variant — all are accuracy-identical (the loader dequantizes; gates measured within 0.01pp):

ref format size
vpermilp/spellman (root) int8, per-row scales 8.9 MB
vpermilp/spellman/f16 f16 15.7 MB
vpermilp/spellman/int8-col int8, per-column scales 7.9 MB
vpermilp/spellman/fp8-row / fp8-col fp8 e4m3 8.9 / 7.9 MB
spellman detect --model hf:vpermilp/spellman/int8-col < text.txt

Languages (30)

  • Cyrillic (21): Russian, Ukrainian, Belarusian, Bulgarian, Macedonian, Serbian, Kazakh, Kyrgyz, Tajik, Uzbek (Cyrillic), Tatar, Bashkir, Chuvash, Yakut, Tuvan, Mongolian, Ossetic, Chechen, Udmurt, Meadow Mari, Komi-Zyrian
  • Latin (5): English, Spanish, French, Portuguese, German
  • Script-routed (4, no model columns): Mandarin, Japanese, Hindi, Arabic

Accuracy (v14, 2026-08-31)

eval accuracy
held-out mix (719,255 rows, all registers) 98.62%
Tatoeba (37,051, out-of-domain) 99.01%
single words / pairs / triples (Tatoeba ladder) 72.06 / 89.60 / 95.21
wild Russian tweets (2,606, label-audited) 96.89%
COSMUS gold-labeled wild Russian (2,808, unseen) 97.40%
real short utterances (≤19 chars, orthography-certified) 94.95%
literary Russian (2,000 sentences, held-out novel) 98.90%
throughput ~3.5 µs/doc bulk, 7.5 µs single (Ryzen 9 7950X3D)

On identical rows it beats fastText lid.176 and lingua everywhere they overlap with it, and beats open-LID SOTA GlotLID v3 on everything except clean out-of-domain sentences (99.25 vs 99.01) — while running ~100× faster. Wild Russian: 96.89 vs GlotLID's 82.73; short utterances: 94.95 vs 71.25; single words: 72.06 vs 43.9. Full tables and methodology: docs/benchmarks.md.

Files

  • model.json — the runtime contract: language order, hash id/seed, n-gram config, canonicalization/lexical flags, and θ — the confidence threshold under which a detection is flagged uncertain (0.67, calibrated so the flag actually predicts errors).
  • model.safetensors — the folded table P [262145×30] (int8 + per-row f32 scales in this root variant) and the class bias.

Features are canonicalized char 1–5-grams plus whole-word and word-bigram keys, sign-hashed into 2^18 buckets (fmix32).

Training data

Trained on a 4.2M-row, 26-language mix published with its byte-exact recipe and per-upstream license table at vpermilp/spellman (dataset repo type). Sources include FineWeb-2 line-windows, Tatoeba, per-language community and parallel corpora, a wild social-media lane, a verified short-utterance lane, and the six open crawl datasets (vpermilp/lid-*: news/library sites + Telegram/VK for sah/tyv/kpv/mhr/oss/udm) built for this project. Every source passes LID hygiene with twin-language protection; the mix is NC-free (2026-08 license audit).

Version history

  • v14 (2026-08-31): architecture-review retrain — 2^18 buckets, full-length training truncation, θ by error-detection F1; int8-row root artifact.
  • v13c (2026-08-30): the six crawl datasets + per-language cap 32k → 120k (+3.4pp wild Russian, +4.0pp short vs v12).
  • v12 (2026-08-24): commercial-clean rebuild — every NC-licensed upstream replaced or row-filtered.

The full measured experiment log (including what failed): docs/experiments.md.

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