Instructions to use bhimaailabs/Ambedkar-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bhimaailabs/Ambedkar-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="bhimaailabs/Ambedkar-v1") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("bhimaailabs/Ambedkar-v1") model = AutoModelForMultimodalLM.from_pretrained("bhimaailabs/Ambedkar-v1", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use bhimaailabs/Ambedkar-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bhimaailabs/Ambedkar-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bhimaailabs/Ambedkar-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/bhimaailabs/Ambedkar-v1
- SGLang
How to use bhimaailabs/Ambedkar-v1 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "bhimaailabs/Ambedkar-v1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bhimaailabs/Ambedkar-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "bhimaailabs/Ambedkar-v1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bhimaailabs/Ambedkar-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use bhimaailabs/Ambedkar-v1 with Docker Model Runner:
docker model run hf.co/bhimaailabs/Ambedkar-v1
Ambedkar-v1
Ambedkar-v1 is the first version of our Indian legal-assistant models. It is the merged model created by incorporating the Ambedkar-v1-qwen3.5-2b-lora LoRA adapter into Qwen/Qwen3.5-2B, fine-tuned with Unsloth on the bhimaailabs/indian-legal-situations dataset that we created.
It is trained for behaviour, not legal knowledge. Given a legal situation and retrieved passages, it learns to cite what it was given, to refuse politely when the passages don't answer the question, and to ask clarifying questions when facts are missing. It is meant to be used together with a verified, current-law retriever, never as a standalone legal authority.
Not legal advice. Outputs can be wrong, incomplete or out of date. Verify every answer against official sources (India Code and state gazettes) or a qualified advocate.
Model Details
Model Description
- Developed by: bhimaailabs (Bhima AI Labs)
- Model name / version: Ambedkar-v1 (first version, merged model)
- Model type: Full causal language model with LoRA fine-tuning weights merged into the base model; trained with supervised fine-tuning (SFT)
- Language(s) (NLP): English, Hindi and Hinglish (the dataset also has a small share of rows labelled
other) - License: Apache-2.0 for the merged model and dataset. The base model has its own license, which you must also follow.
- Finetuned from model: Qwen/Qwen3.5-2B
- Adapter used: Ambedkar-v1-qwen3.5-2b-lora
Model Sources
- Repository: https://huggingface.co/bhimaailabs/Ambedkar-v1
- LoRA adapter: https://huggingface.co/bhimaailabs/Ambedkar-v1-qwen3.5-2b-lora
- Training dataset: https://huggingface.co/datasets/bhimaailabs/indian-legal-situations
- Demo: none yet
Uses
Direct Use
A small legal-assistant model that sits behind a retriever in a RAG pipeline for Indian law. It is trained to:
- answer from the passages it is given and cite them;
- refuse politely when the passages are inadequate, instead of inventing a provision;
- ask clarifying questions when key facts are missing from the user's situation;
- respond in English, Hindi or Hinglish.
Domains in the training data: cheque bounce, consumer and e-commerce (CPA 2019), RERA and real estate, wages, industrial disputes, the IT Act, RTI, fraud and BNS cheating, and old-to-new law translation (IPC to BNS and similar).
Downstream Use
Research on small-model legal format learning and multilingual legal Q&A, and as a starting point for further fine-tuning on advocate-reviewed data.
Out-of-Scope Use
- Using the model as legal advice or as a standalone legal authority, or without a retriever supplying current law.
- High-stakes decisions without review by a qualified advocate.
- Sensitive situations: domestic violence, sexual offences, suicide and child abuse were deliberately excluded from the training data. Those need hand-written, advocate-reviewed handling, which this model does not have.
- State-specific law (for example tenancy, stamp duty and state labour rules). It was not covered in training.
Bias, Risks, and Limitations
- Format over knowledge. The training signal teaches the model to respond to the passages it receives, not to recall Indian law. Without good passages it can hallucinate sections, penalties or deadlines.
- Synthetic data, not advocate-verified. The answers were machine-generated from passages in
vaquill/open-india-law. An advocate review of a 100-row sample is still pending. - Known data issues: 22.4% of rows carry the
high_spurious_citationflag and about 2.1% carrygenuinely_unfaithful. These flags are informational and not necessarily errors, but the model may have learned some spurious citations. - Retrieval limits: some
partialrows reflect retrieval misses rather than label errors, and some retrieved passages may be from repealed laws (IPC, the ID Act, old CrPC). Validate your retriever for current law. - Small model and small dataset: a 2B-parameter model trained on about 2,700 examples. Expect errors on unusual situations, long statutes and non-English text.
- Third-party generators: the training answers were produced by LLM providers (NIM, Sarvam, Groq, Google). Check their terms if you redistribute or build on the data.
- Language coverage: Hindi and Hinglish are present but smaller than English (about 9% and 21% of rows).
Recommendations
Use the model only with a curated, current-law retriever. Show users the cited passages and a clear disclaimer. Have an advocate review any deployment. Do not use it for the sensitive scenarios listed above.
How to Get Started with the Model
Use the same prompt format as training.
messages = [
{
"role": "system",
"content": (
"You are Ambedkar-v1, an Indian legal assistant. "
"Be careful and structured. Do not invent legal provisions. "
"If necessary information is missing, ask for clarification."
)
},
{
"role": "user",
"content": (
"I purchased a mobile phone online, but the seller "
"delivered a different and cheaper model. "
"What legal options might be available in India?"
)
}
]
Option A: Transformers (recommended for the merged model).
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "bhimaailabs/Ambedkar-v1"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype="auto",
device_map="auto",
)
model.eval()
messages = [
{
"role": "system",
"content": (
"You are Ambedkar-v1, an Indian legal assistant. "
"Be careful and structured. Do not invent legal provisions. "
"If necessary information is missing, ask for clarification."
)
},
{
"role": "user",
"content": (
"I purchased a mobile phone online, but the seller "
"delivered a different and cheaper model. "
"What legal options might be available in India?"
)
}
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt"
).to(model.device)
out = model.generate(
input_ids=inputs,
max_new_tokens=600,
do_sample=False
)
print(
tokenizer.decode(
out[0][inputs.shape[1]:],
skip_special_tokens=True
)
)
Option B: Unsloth.
from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
"bhimaailabs/Ambedkar-v1",
max_seq_length=2048,
load_in_4bit=False,
full_finetuning=False,
)
FastModel.for_inference(model)
Training Details
Training Data
bhimaailabs/indian-legal-situations: synthetic Indian legal situations with structured answers, generated from retrieval passages and designed to teach citation, refusal and clarification behaviour.
| Rows | |
|---|---|
| Total | 3,334 |
| Train | 2,703 |
| Validation | 315 |
| Test | 316 |
- Domains: 12 (59 sub-issues)
- Answer modes: grounded 48.0%, partial 32.6%, refusal 19.4%
- Languages (dataset labels): english 58.2%, hinglish 20.7%, other 11.9%, hindi 9.2%
- Sensitive topics: excluded by design
Training Procedure
Training Hyperparameters
| Setting | Value |
|---|---|
| Method | LoRA SFT with Unsloth and TRL; adapter weights merged into the base model for this release |
| Base model | Qwen/Qwen3.5-2B |
| LoRA rank / alpha / dropout | 16 / 16 / 0 |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Learning rate / scheduler | 2e-4 / cosine |
| Epochs | 2 |
| Per-device batch size / grad. accumulation | 1 / 8 |
| Max sequence length | 2048 |
| Optimizer | AdamW (PyTorch) |
| Precision | FP16 enabled, BF16 disabled |
| Seed | 3407 |
Speeds, Sizes, Times
- Training time: ~2hrs
- Final train / validation loss: 0.923828
- Merged model size and saved precision: ~4.5GB
Technical Specifications
Model Architecture and Objective
Qwen/Qwen3.5-2B with LoRA fine-tuning weights merged into the base model, trained with a causal language-modelling (next-token) objective on the assistant responses.
Compute Infrastructure
Hardware
Kaggle NVIDIA T4 GPU.
Software
Unsloth, TRL, PEFT, Transformers.
Citation
@misc{bhimaailabs_ambedkar_v1_2026,
author = {Bhima AI Labs},
title = {Ambedkar-v1: A merged model for Indian legal-assistant format discipline},
year = {2026},
publisher = {Hugging Face},
url = {https://huggingface.co/bhimaailabs/Ambedkar-v1},
note = {Merged from Qwen/Qwen3.5-2B and bhimaailabs/Ambedkar-v1-qwen3.5-2b-lora. Fine-tuned on bhimaailabs/indian-legal-situations. Not legal advice.}
}
Model Card Authors
Bhima AI Labs
Model Card Contact
http://huggingface.co/bhimaailabs
Framework versions
- PEFT 0.21.3
- Transformers
- TRL
- Unsloth
- PyTorch
- Downloads last month
- -