indian-tax-law-slm-base

indian-tax-law-slm-base is a domain-specialized language model for Indian legal and tax text, trained from scratch on a curated corpus of statutes, judgments, and legal documents. It is the first release in an ongoing series of increasingly capable open models targeting the Indian legal domain.

This initial model is a compact 31.8M-parameter base checkpoint that demonstrates strong, measurable domain specialization. Larger models β€” with substantially improved fluency and retrieval-grounded factual accuracy β€” are actively in development.

Highlights

  • 🎯 Purpose-built for Indian legal & tax language β€” statutes, case law, and procedure
  • πŸ“Š 10.6Γ— stronger on legal text than on general English (perplexity: 40.7 vs 431.7)
  • 🧱 Standard Llama architecture β€” loads with AutoModelForCausalLM, no custom code
  • πŸ”§ Fine-tuning ready β€” clean base for LoRA/PEFT adaptation to specific legal tasks
  • πŸͺΆ Custom 16K tokenizer trained on the domain for efficient legal text encoding
  • πŸ”“ Fully open β€” Apache-2.0, permissively-licensed training data

Model Summary

Architecture LlamaForCausalLM (grouped-query attention, RoPE, SwiGLU)
Parameters 31.8M
Layers 8
Hidden size 512
Attention heads 8 (4 KV heads)
Context length 512 tokens
Vocabulary 16,000 (custom byte-level BPE)
Precision fp16
Corpus ~430M tokens, ~68% Indian legal by weight

Evaluation

Held-out perplexity (lower = better):

Domain Perplexity
Indian legal 40.7
General English 431.7

The model is 10.6Γ— more confident on Indian legal text than on general text β€” clear, quantitative evidence of domain specialization. This is the intended behavior of a domain base model: it internalizes the vocabulary, structure, and register of Indian statutory and case law.

Try it live

An interactive demo is available as a Hugging Face Space:

Usage

from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("balrampandey/indian-tax-law-slm-base")
tok = AutoTokenizer.from_pretrained("balrampandey/indian-tax-law-slm-base")

ids = tok("The assessee", return_tensors="pt")
out = model.generate(**ids, max_new_tokens=40, repetition_penalty=1.3)
print(tok.decode(out[0], skip_special_tokens=True))

Fine-tuning

The model is designed as a base for adaptation. Attach a LoRA adapter with peft:

from peft import LoraConfig, get_peft_model

model = get_peft_model(model, LoraConfig(
    task_type="CAUSAL_LM", r=8, lora_alpha=16,
    target_modules=["q_proj", "k_proj", "v_proj", "o_proj"],
))

Training Data

A curated mix of general English (for language competence) and open Indian legal text (for domain specialization):

Source Content Licence
allenai/c4 General English ODC-By
KanoonGPT/indian-legal-documents Legal documents Apache-2.0
KanoonGPT/indian-case-laws Case law Apache-2.0
169Pi/indian_law Legal Q&A / reasoning Apache-2.0
vihaannnn/Indian-Supreme-Court-Judgements-Chunked SC judgments MIT
varshith7/income-tax-act-india Income Tax Act CC-BY-4.0

The underlying text of Acts and judgments is exempt from copyright under s.52(1)(q) of the Indian Copyright Act; dataset compilations retain the licences above.

Intended Use

  • A base model for fine-tuning on Indian legal and tax tasks (LoRA/PEFT)
  • Research on domain-specialized language modeling
  • A foundation for the larger models in this series

As an early, compact checkpoint, generation fluency is limited and outputs should not be treated as authoritative legal or tax information. Factual grounding via retrieval is planned for larger releases.

Roadmap

This model is the first step in a staged program:

  • βœ… v0 β€” 32M base (this release) β€” validated pipeline, measurable specialization
  • πŸ”„ In progress β€” larger base models β€” improved fluency and coherence at greater scale
  • πŸ”œ Planned β€” retrieval-augmented variants β€” factual grounding on live statutory text
  • πŸ”œ Planned β€” instruction-tuned releases β€” task-ready models for legal workflows

License

Apache-2.0 (code and weights).

Downloads last month
65
Safetensors
Model size
31.8M params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Space using balrampandey/indian-tax-law-slm-base 1