Shlokartha Himalayan manuscript cover

Shlokartha Vāgartha SFT

Shlokartha is a compact causal language model fine-tuned for layered Sanskrit verse interpretation. It is designed to separate Pada Artha (word-by-word meaning), Anvaya (semantic translation), and Bhavartha (expanded context) while preserving Devanagari and transliteration where useful.

Model details

Training configuration

The final run used three epochs and 3,372 optimizer steps:

Setting Value
Learning rate 2e-4
Scheduler cosine
Warmup 10% of training steps
Per-device batch size 4
Gradient accumulation 8
Effective batch size 32 sequences/update
Maximum sequence length 8,192 tokens
Packing enabled
Precision bfloat16
Optimizer adamw_torch_fused
Gradient checkpointing enabled
Hardware 1 × 96 GB RTX 6000-class GPU

The held-out validation split contained 4,404 examples. The final logged validation loss was 1.469 and mean token accuracy was 0.6935. These are training diagnostics, not a claim of expert-level Sanskrit correctness or a substitute for human evaluation.

Intended use

Use this checkpoint for experimentation with Sanskrit verse explanation, Indic-language interfaces, educational prototypes, and research on structured literary interpretation. The companion playground exposes decoding controls and displays the three intended commentary layers separately.

Limitations and responsible use

The model can produce fluent but incorrect translations, grammatical analyses, source attributions, or philosophical context. It should not be treated as an authoritative Sanskrit scholar, a substitute for a critical edition, or a sole source for religious, historical, or educational claims. Review outputs against the original text and qualified references. The training corpus contains source explanations from the upstream Vāgartha dataset; retain its CC-BY-4.0 attribution when redistributing derived material.

Quick start

from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "kshitijthakkar/shlokartha"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    model_id, trust_remote_code=True, dtype="auto"
)

messages = [{
    "role": "user",
    "content": (
        "Explain this Sanskrit verse with exactly these headings: "
        "**Pada Artha**, **Anvaya**, and **Bhavartha**.\n\n"
        "कर्मण्येवाधिकारस्ते मा फलेषु कदाचन।"
    ),
}]
inputs = tokenizer.apply_chat_template(
    messages, tokenize=True, add_generation_prompt=True, return_tensors="pt"
)
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0, inputs["input_ids"].shape[-1]:], skip_special_tokens=True))

License and attribution

The dataset used for fine-tuning is derived from sarvamai/vagartha and is distributed under CC-BY-4.0 with upstream attribution requirements. Consult the base checkpoint's terms for model redistribution and derivative-use conditions.

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

Model tree for kshitijthakkar/shlokartha

Space using kshitijthakkar/shlokartha 1

Collection including kshitijthakkar/shlokartha