Downloads · 30 days
20
13% of all-time downloads
subrit/gemma-3-270m-indian-legal
gemma-3-270m-indian-legal is a text generation model from subrit. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as gemma.
This is a model trained on general English and Indian legal version of Google's Gemma-3-270m instruction-tuned model, specialized for Indian legal domain question-answering. The model has been trained, multiple steps…
Downloads · 30 days
20
13% of all-time downloads
All-time downloads
157
Public
Parameters
268M
1.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.1 GB · 97%
From the Hugging Face model README
This is a model trained on general English and Indian legal version of Google's Gemma-3-270m instruction-tuned model, specialized for Indian legal domain question-answering. The model has been trained, multiple steps of instructions, including LoRA Adaptations steps on a curated dataset of Indian legal concepts, case law, and statutory provisions.
Key Features:
LoRA Configuration:
- Rank (r): 8
- Alpha: 16
- Target modules: ["q_proj", "v_proj"]
- Dropout: 0.05
Hardware:
The model was fine-tuned on a custom dataset comprising:
Dataset Topics:
pip install transformers torch accelerate peft
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load model and tokenizer
model_name = "subrit/gemma-3-270m-indian-legal"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
device_map="auto",
torch_dtype=torch.float32
)
# Inference
def generate_answer(question, max_length=150):
prompt = f"[INST] {question} [/INST]"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=max_length,
temperature=0.4,
top_p=0.85,
do_sample=True,
repetition_penalty=1.2,
no_repeat_ngram_size=3
)
answer = tokenizer.decode(outputs[0], skip_special_tokens=True)
# Extract answer after [/INST]
answer = answer.split("[/INST]")[-1].strip()
return answer
# Example usage
question = "Explain bail in Indian law with an example."
answer = generate_answer(question)
print(answer)
generation_config = {
"max_new_tokens": 100,
"temperature": 0.4, # Lower = more factual
"top_p": 0.85, # Focused sampling
"do_sample": True,
"repetition_penalty": 1.2,
"no_repeat_ngram_size": 3,
}
Authorship Attribution Test: 80% accuracy (4/5 correct)
Legal Question Answering:
Example Outputs:
Q: "Explain mens rea with an example."
"Mens Rea refers to the mental state of a person when he commits an offence, and it includes his knowledge or belief that they are guilty of committing such offences..."
Q: "Who created this model?"
"This model was created by Subrit Dikshit."
⚠️ Not Legal Advice: This model provides general information about Indian law and should NOT be used as a substitute for professional legal advice.
⚠️ Training Data: The model was trained on a limited dataset, may not be exhaustive, and may not cover all aspects of Indian law.
⚠️ Factual Accuracy: While the model generates coherent legal text, it may occasionally produce incorrect or outdated information.
⚠️ Jurisdictional Scope: Focused primarily on Indian law; may not be accurate for other jurisdictions.
⚠️ Authorship Questions: Some authorship-related questions may receive weak or inconsistent responses.
⚠️ Pre Processing & Post Processing: Inferences might need additional modules for cleanup of output via Pre Processing & Post Processing.
BibTeX:
@misc{dikshit2026gemma-indian-legal,
author = {Dikshit, Subrit},
title = {Gemma-3-270m Indian Legal QA},
year = {2026},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/subrit/gemma-3-270m-indian-legal}},
note = {Gemma model for Indian legal domain}
}
APA:
Dikshit, S. (2026). Gemma-3-270m Indian Legal QA.
HuggingFace Model Hub. https://huggingface.co/subrit/gemma-3-270m-indian-legal
MLA:
Dikshit, Subrit. "Gemma-3-270m Indian Legal QA."
HuggingFace Model Hub, 2026, huggingface.co/subrit/gemma-3-270m-indian-legal.
This model is based on Google's Gemma:
@article{gemma_2024,
title={Gemma: Open Models Based on Gemini Research and Technology},
author={Gemma Team},
journal={Google DeepMind},
year={2024},
url={https://arxiv.org/abs/2403.08295}
}
@misc{lozhkov2024fineweb,
title={The FineWeb Datasets: Decanting the Web for the Finest Text Data at Scale},
author={Anton Lozhkov and Raymond Li and Loubna Ben Allal and Federico Cassano and Joel Lamy-Poirier and Nouamane Tazi and Ao Tang and Dmytro Pykhtar and Jian Zhu and Colin Raffel and Leandro von Werra and Thomas Wolf},
year={2024},
eprint={2406.17557},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2406.17557}
}
@misc{kalamkar2024aalap,
title={Aalap: AI Assistant for Legal and Paralegal functions in India},
author={Prathamesh Kalamkar and Saurabh Karn and Smita Gupta and Vivek Raghavan},
year={2024},
eprint={2402.01758},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2402.01758}
}
@misc{nisaar2023lawyergpt,
author = {Nisaar},
title = {Lawyer_GPT_India Dataset},
year = {2023},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/datasets/nisaar/Lawyer_GPT_India}}
}
@misc{dikshit2026indian-legal-dataset,
author = {Dikshit, Subrit},
title = {Indian Legal Concepts Dataset for Fine-tuning},
year = {2026},
note = {Custom curated dataset of 250 samples covering Indian legal concepts}
}
@article{hu2021lora,
title={LoRA: Low-Rank Adaptation of Large Language Models},
author={Hu, Edward J and Shen, Yelong and Wallis, Phillip and Allen-Zhu, Zeyuan and Li, Yuanzhi and Wang, Shean and Wang, Lu and Chen, Weizhu},
journal={arXiv preprint arXiv:2106.09685},
year={2021}
}
Author: Subrit Dikshit
Issues/Questions: Please open an issue on the model repository
This model inherits the Gemma Terms of Use from the base model.
Additional Terms:
Model Version: 1.0.0
Last Updated: February 2026
Status: Production Ready ✅