/ Модель

Характеристики

Контекст
512 токенов
Лицензия
CC BY-NC 4.0
Архитектура
sansar · dense
Библиотека
transformers
Опубликована
4 окт 2026

sansar-350m

Генерация текстаТекст → текст

Sansar 350M — базовая модель Muse Mesh для генерации продолжений текстов на санскрите в деванагари.

475скачиваний за 30 дней1лайквеса обновлены7 окт 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Sansar 350M — языковая модель на санскрите от проекта Sansar компании Muse Mesh, обученная с нуля для продолжения текста. Это базовая, не настроенная на выполнение инструкций модель на основе decoder-only трансформера с 24 слоями, 16 головами внимания и шириной 1024; размер — 318,4 млн параметров. Модель принимает и генерирует текст на деванагари, использует токенизатор с поддержкой SLP1 и имеет контекст 512 токенов.

Модель предназначена для генерации продолжений санскритских текстов и исследовательских экспериментов с языковым моделированием санскрита. Обучающий корпус включает классические и современные источники, в том числе тексты из AI4Bharat Sangraha и коллекции санскритских текстов. В карточке приведена оценка на отложенных наборах: 0,5547 бит на байт деванагари, без «Бхагавад-гиты».

Модель может генерировать беглый на вид, но грамматически неверный санскрит и вымышленные цитаты, стихи, авторов и произведения; точное воспроизведение стихов ненадёжно. Она не предназначена для диалога, ответов на вопросы или следования инструкциям. В обучающих данных встречаются хинди, маратхи и пали, поэтому возможен переход на хинди; ведийский регистр освоен слабее. Лицензия — CC BY-NC 4.0, допускающая использование с указанием авторства, но ограничивающая коммерческое применение.

Сценарии применения

  • генерация продолжения санскритских текстов
  • создание черновиков на санскрите в деванагари
  • эксперименты с языковым моделированием санскрита
  • изучение генерации классической и современной санскритской прозы

Ограничения

Модель не настроена на инструкции и может генерировать грамматически ошибочный текст, вымышленные цитаты и факты; точное воспроизведение стихов ненадёжно. Возможен переход на хинди, а ведийский санскрит обрабатывается слабее; контекст ограничен 512 токенами.

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Sansar 350M

A 318.4M-parameter Sanskrit language model trained from scratch, from the Sansar project at Muse Mesh (Hugging Face): Sanskrit language models, their corpus and their tokenizer. Size class: the d350m preset, GPT-2-medium shape: 24 layers, width 1,024 (302.0M parameters outside the embeddings; 318.4M in total with the 8k vocabulary and untied head).

  • This version: v0.2.0 = training run f9_slp1_uni8k_d350m_plus_all_3x, finished 2026-10-04 (experiment F9: 350M, F7 recipe on the full F9 slice at three passes).
  • Held-out score: 0.5547 bits per Devanagari byte (pooled over four held-out sets, excluding the Bhagavad-gītā; lower is better); 0.5773 on the stricter clean_v1 sets.
  • Base model: it continues Devanagari Sanskrit text; it is not instruction-tuned.
  • Why this checkpoint: The best model so far: -3.0% ex-Gītā against v0.1.0 on the standard sets and -2.8% on clean_v1.

Quick start

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

repo = "MuseMesh/sansar-350m"
tok = AutoTokenizer.from_pretrained(repo, revision="v0.2.0", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(repo, revision="v0.2.0", trust_remote_code=True)

inputs = tok("संस्कृतं नाम दैवी वाक्", return_tensors="pt")      # Devanagari in
out = model.generate(**inputs, max_new_tokens=50, do_sample=True, temperature=0.8, top_k=100)
print(tok.decode(out[0], skip_special_tokens=True))              # Devanagari out

Needs transformers (tested with 5.18.0), torch and sentencepiece. trust_remote_code=True runs three small files from this repository: modeling_sansar.py (the network), tokenization_sansar.py and translit.py (Devanagari <-> SLP1); read them before you run them. The weights are stored in bfloat16 (transformers 5 loads them as such); pass dtype=torch.float32 for fp32, usually the faster choice on a CPU. The tokenizer adds no BOS/EOS: training records were separated by </s> only.

What this checkpoint wrote for that prompt (CPU, torch.manual_seed(0), 50 new tokens):

संस्कृतं नाम दैवी वाक् । तस्मिस्तु संस्कृते शब्दे संवृत्ते हि सति संस्कृतं नाम दैवी वाग्भवति । तस्मान्मकाराकारे ओङ्कारे प्रतिष्ठित इति ।। ।। इति एकोनवि

and with greedy decoding:

संस्कृतं नाम दैवी वाक् । अस्या अर्थः - अस्याः संस्कृतभाषायाः अर्थः - अभिधेयः । अर्थः - अभिधेयः । अर्थः - प्रयोजनं ।

To score text instead of generating it, call the model with labels=input_ids; loss is the mean negative log-likelihood per token in nats.

Model details

Architecturedecoder-only transformer, pre-LayerNorm (LayerNorm without bias), no biases anywhere
Layers / heads / width24 / 16 / 1,024 (head dim 64); MLP 4x = 4,096
Positionsrotary (base 10,000; half-split pairing), no position table
Attentioncausal SDPA; queries and keys RMS-normalised per head (QK-norm)
MLP activationsquared ReLU
Output headseparate (untied), zero-initialised
Vocabulary8,000 (SentencePiece unigram over SLP1, MuseMesh/sansar-sanskrit-tokenizer v0.1.0)
Context512 tokens (about 3.6 kB of Devanagari text at the training data's 6.94 Devanagari bytes per token)
Parameters, total318,424,064
Parameters, non-embedding302,040,064
Token embedding8,192,000
Output head8,192,000
Weights in this repobfloat16 safetensors (trained as fp32 master weights under bf16 autocast)

Training

Optimizer, block matricesMuon (301,989,888 params): momentum 0.95 (Nesterov), 5 Newton-Schulz steps in bf16, peak lr 0.02, update scaled by sqrt(max(1, rows/cols)), no weight decay
Optimizer, everything elseAdamW: embedding + head (16,384,000 params) with weight decay 0.1, LayerNorm gains without; peak lr 0.001, betas (0.9, 0.95), eps 1e-8
Learning-rate schedulelinear warm-up over 500 steps, then cosine decay to 0.1 x peak at step 103,527 (Muon and AdamW share it)
Batch48 sequences x 2 accumulation steps x 512 tokens = 49,152 tokens per step
Steps103,527
Tokens seen5,088,559,104 (3.00 passes over 1,696.2M training tokens)
Gradient clippingglobal norm 1.0
Dropout0.0
Precisionbf16 autocast, fp32 master weights, torch.compile
Seed1337
Data sampling512-token windows at uniformly random offsets of the token stream (records separated by </s>), so passes are counted in expectation
Hardware1x NVIDIA A100 40 GB (Google Cloud a2-highgpu-1g, spot, us-central1)
Wall time20.5 h (73,701 s), 71.7k tokens/s, no preemptions
Compute costabout $27 of spot GPU time (watcher estimate $26.7 at $1.30/h)
Final validationloss 2.4171 nats/token = 0.5033 bits per Devanagari byte on the run's own validation split (0.5% of records by near-duplicate cluster; not comparable across data slices)

Training code: scripts/train/train.py, model.py and muon.py of the Sansar repository; the exact arguments are in training/summary.json.

Training data

train_slice_plus_all (520.4M words, 15.2M records) = the v0.1.0 data (448.9M words) plus 71.6M words of leak-gated additions: tier 10 git-hosted e-texts 60.4M (vishvAsa, the e-Bhāratī GitHub copy, ACIP, DSBC, Wikibooks/Wikiquote, ...), repaired core text 3.8M, sanskritdocuments.org 2.8M, All India Radio Sanskrit news 1.1M, school textbooks 1.0M, Google-Vision re-OCR of 9 books 1.5M, and smaller sources. After held-out masking: 15,113,203 training records, 1,696.2M tokens, 11.77 GB of Devanagari text. The run saw 5,088.6M tokens = 3.0 passes.

Held-out texts excluded by dedup key and masked inside training records (28-character windows, stride 4); every addition passed an independent leak gate (0 held-out items per set). After training, a blind spot was found: text that types the visarga as ASCII ":" hides overlaps from both the mask and the gate. The clean_v1 columns below re-score on the held-out items with any such overlap removed; F9 keeps about 91% of its gain there.

The text comes from the Sansar corpus, which collects Sanskrit in Devanagari from public sources: classical e-text collections (GRETIL, SARIT, Muktabodha, the Digital Corpus of Sanskrit, DharmaNexus and others), Sanskrit Wikisource and Wikipedia, dictionaries, and the Sanskrit parts of web-crawl datasets (AI4Bharat Sangraha, IndicCorp, MADLAD-400, the sanskrit-monolingual-pretraining collection). Every record keeps its provenance and a licence tier (T0 permissive, T1 share-alike, T2 non-commercial, T3 no licence statement or all rights reserved). The training slice mixes all tiers: a large share is licensed for non-commercial use only and some sources state no licence, which is why the weights are released under CC BY-NC 4.0 (see Licence). Old archive.org OCR of printed books is left out (it measurably hurt the models).

Preparation: Unicode NFC; standalone / and // read as daṇḍa । and double daṇḍa ॥; machine reference markers (verse numbers of digital editions) stripped; transliterated to SLP1 and tokenized; one </s> after every record; a 0.5% validation split by near-duplicate cluster.

Evaluation

Metric: bits per Devanagari byte (lower is better): the model's negative log-likelihood of a text divided by the UTF-8 byte count of the same text in Devanagari, so models with different tokenizers are measured against the same denominator. Scored teacher-forced with scripts/train/eval_bpb.py: each set's records joined with </s> into one stream, 512-token windows with stride 256 (every scored token after the first window has at least 256 tokens of context), text cleaned exactly as the training text was.

Sets (E0, frozen before any model was trained and excluded from training): dcs_gold 3,000 sentences of the Digital Corpus of Sanskrit gold standard (classical), prose 2,470 prose passages, ood 2,000 web, Wikipedia and other out-of-domain texts, vedic 1,000 accented Ṛgveda pādas, gita all 700 verses of the Bhagavad-gītā. The headline is pooled excluding the Gītā (byte-weighted over the other four): the Gītā is quoted inside commentaries and epics throughout the training text, so its column measures memorisation.

ex-Gītā (headline)pooled, all fivedcs_goldproseoodvedicgita (memorisation)
E0 sets (9,170 items)0.55470.53940.56870.54060.55420.68920.1367
clean_v1 (8,270 items)0.57730.55620.57190.55420.58470.69120.1436

Verse completion (600 verses: 200 each from the Bhagavad-gītā, Mahābhārata and Rāmāyaṇa; the model gets the first half-verse and greedily writes the second, stopping at ॥ or a newline): chrF 0.125, exact match 0/600. chrF credits shared character n-grams, so it rewards plausible vocabulary even when the half-verse is not the right one.

clean_v1 (added 2026-10-04): the same five sets minus every item that could overlap the training text in a way the held-out masking could not see. Some training text types the visarga as an ASCII colon (":" for "ः"); both the held-out mask and the leak gate ignored ":", so a 16-character window of a held-out item could survive inside such a record. clean_v1 removes every item with any such window in either training slice (900 of 9,170 items; mostly a shared stock phrase, rarely a real near-copy). It keeps 8,270 items; ood loses half its bytes and reads harder, so compare clean_v1 numbers only with clean_v1 numbers.

Reference points

Same metric and sets. External models were scored zero-shot with their own tokenizers and a 2,048-token window (stride 1,024), which gives them more context than our 512-token window; their training data may contain the public ood and prose texts.

modelparametersex-Gītāclean_v1 ex-Gītānotes
Sansar 20M v0.1.027.1M0.7177n/aTOK-v3 screen, arm v0.1, 0.34B tokens
Sansar 60M v0.1.063.2M0.6434n/aF0, 1.34B tokens
Sansar 125M v0.1.097.2M0.60390.6254F6-clean-2x, 2.66B tokens
Sansar 350M v0.1.0318.4M0.57200.5937F7, 2.66B tokens
Sansar 350M v0.2.0 (this model)318.4M0.55470.5773F9, 5.09B tokens
Sansar 700M v0.1.0704.1M0.53070.5541F10, 4.76B tokens
Krutrim-2-instruct (zero-shot, nf4)12B0.512n/ageneral model, 2,048-token window
Sarvam-1 (zero-shot, fp16)2.5B0.750n/ageneral model, 2,048-token window
Gemma 4 E2B (zero-shot, fp16)4B0.892n/ageneral model, 2,048-token window

Checked before release

  • modeling_sansar.py against the training code (scripts/train/model.py), fp32 on CPU, 6 inputs (one held-out text per set, cropped to 512 tokens, and 512 random ids): with the same bf16 weights the logits are identical (max |difference| 0.0e+00); against the fp32 training weights the bf16 storage moves logits by at most 0.217.
  • Bits per byte on the first 20 records of each set with eval_bpb.py's own scoring: 0.50865 (training checkpoint, fp32) vs 0.50870 (this repo, bf16 weights) = +0.0100%.
  • Tokenizer: the same ids as the evaluation pipeline on 100/100 sample texts with fence_latin=False (95/100 with the default fence; the rest contain English words); Devanagari round trip exact on 100/100.
  • Left-padded batches give the same logits as single sequences (max |difference| 5.0e-05).

Limitations

  • Base model. It continues Sanskrit text. It has not been instruction-tuned or aligned: it does not follow instructions, answer questions or chat, and it will not refuse anything.
  • It makes things up. Output is fluent-looking Sanskrit that can be ungrammatical, mix registers and invent verses, authors and works. Do not use it as a source of quotations or facts; exact verse recall is close to zero (see verse completion).
  • Other languages in the data. The training text still holds some Hindi, Marathi and Pali lines that passed the Sanskrit filters of the time (a stricter filter came after this run), so the model can drift into Hindi.
  • Small and short. 318M parameters and a 512-token context. This implementation has no key/value cache, so long generations are slow (each new token re-reads the last 512).
  • Vedic is the weakest register: accent marks fragment the tokenization and Vedic text is a small share of the training data.
  • Script. Devanagari in and out. English words inside the text are fenced by the tokenizer so they come back unchanged; the model never saw the fence marks in training, so its predictions around them are weaker (AutoTokenizer.from_pretrained(..., fence_latin=False) reproduces the training encoding, but then Latin letters decode as Devanagari). IAST and other Indic scripts are not transliterated for you.
  • What the corpus says, the model says. Most of the text is religious, philosophical and classical literature, plus modern web and news Sanskrit; the model reproduces its views and its errors, including OCR errors that survived in web-crawl sources.
  • The Gītā is memorised in part (see the gita column), so do not read its score as generalisation.

Versions

Each version is a git tag on this repository; main is the newest. Pin one with revision="v0.2.0". A version is one training run, named by its run id in the Sansar experiment log.

versiondatetraining runtokens seenex-Gītāclean_v1 ex-Gītā
v0.1.02026-10-03f7_slp1_uni8k_d350m_plus_clean_2x (F7)2.66B0.57200.5937
v0.2.02026-10-04f9_slp1_uni8k_d350m_plus_all_3x (F9)5.09B0.55470.5773

All runs of this size (ex-Gītā on the same E0 sets):

rundaterecipeex-Gītāstatus
F72026-10-03plus_clean slice (448.9M words), 2.66B tokens0.5720v0.1.0
F92026-10-04plus_all slice (520.4M words), 5.09B tokens0.5547v0.2.0

Files

filewhat
model.safetensorsthe weights, bfloat16 (no optimizer state)
config.json, generation_config.jsonarchitecture and default sampling settings
configuration_sansar.py, modeling_sansar.pythe network for transformers (auto_map, trust_remote_code)
tokenizer.model, tokenization_sansar.py, translit.py, tokenizer_config.json, special_tokens_map.jsonthe tokenizer (MuseMesh/sansar-sanskrit-tokenizer v0.1.0) with its Devanagari <-> SLP1 wrapper
eval/bpb.json, eval/bpb_clean_v1.json, eval/verse_scores.jsonthe evaluation outputs quoted above
eval/verification.json, eval/smoke_test.jsonthe release checks and the sample generations
training/summary.json, training/data_meta.json, training/cloud.jsonevery training argument, the loss curve's evaluation points, and the data preparation record
LICENSE, LICENSE-CODE, CHANGELOG.mdlicences and version history

Licence

This release is for research and non-commercial use. The training data includes texts licensed for non-commercial use only and texts without a licence statement, used here for research. A commercially licensed model, trained only on permissively licensed text, is planned as a separate release with its own version line.

  • Weights (model.safetensors) and tokenizer.model: CC BY-NC 4.0 (LICENSE). Non-commercial use (research, teaching, non-profit work) with attribution to "Sansar, Muse Mesh Private Limited".
  • Code (configuration_sansar.py, modeling_sansar.py, tokenization_sansar.py, translit.py): Apache-2.0 (LICENSE-CODE).
  • Commercial use: contact kushal@muse-mesh.com.

Citation

@misc{sansar_350m_2026,
  title  = {Sansar 350M: a Sanskrit language model},
  author = {Muse Mesh},
  year   = {2026},
  note   = {v0.2.0},
  url    = {https://huggingface.co/MuseMesh/sansar-350m}
}

Contact: kushal@muse-mesh.com

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers

Нельзя запустить

Модели нужен код из репозитория; автор пока не в списке доверенных организаций.

Класс архитектуры
SansarForCausalLM
Ревизия весов
1bbb6d7

0 моделей