Text Generation
Transformers
Safetensors
English
legal-ai
legal-reasoning
mistral
qlora
lora
california-law
reasoning
conversational
Instructions to use Shubhwtf/ministral-legis-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Shubhwtf/ministral-legis-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Shubhwtf/ministral-legis-lora") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Shubhwtf/ministral-legis-lora", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Shubhwtf/ministral-legis-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Shubhwtf/ministral-legis-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Shubhwtf/ministral-legis-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Shubhwtf/ministral-legis-lora
- SGLang
How to use Shubhwtf/ministral-legis-lora 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 "Shubhwtf/ministral-legis-lora" \ --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": "Shubhwtf/ministral-legis-lora", "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 "Shubhwtf/ministral-legis-lora" \ --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": "Shubhwtf/ministral-legis-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Shubhwtf/ministral-legis-lora with Docker Model Runner:
docker model run hf.co/Shubhwtf/ministral-legis-lora
Ministral Legal Reasoning LoRA
A QLoRA fine-tuned legal reasoning adapter trained for grounded California statutory question answering and legal reasoning tasks.
This model was trained to:
- answer using only provided statutory excerpts
- reduce hallucinations
- refuse unsupported claims
- provide concise citation-aware responses
- perform legal QA over California legislative text
Base Model
- Ministral / Mistral reasoning model
- Quantized 4-bit QLoRA training
- Fine-tuned using Unsloth
Training Objective
The model was supervised on synthetic legal reasoning data generated from California legislative and statutory excerpts.
Training focused heavily on:
- grounded statutory reasoning
- hallucination resistance
- refusal behavior
- concise legal answers
- section-aware responses
- lightweight chain-of-thought reasoning
Dataset Characteristics
The dataset contains:
- statutory QA
- obligations
- timelines
- reporting requirements
- applicability questions
- refusal examples
- adversarial hallucination-resistance prompts
Examples of trained refusal behavior:
"The provided text does not specify this information."
Example Usage
Load Base Model + LoRA Adapter
from unsloth import FastLanguageModel
from peft import PeftModel
base_model, tokenizer = FastLanguageModel.from_pretrained(
"YOUR_BASE_MODEL"
)
model = PeftModel.from_pretrained(
base_model,
"Shubhwtf/ministral-legis-lora"
)
Example Prompt
Bill: AB1064
Statutory Excerpt:
Section 22757.21(c)(2)(B) excludes systems designed solely for research or technical assistance.
Question:
Does the law apply to systems used solely for research purposes?
Example Output
Section 22757.21(c)(2)(B) excludes systems designed solely for research or technical assistance from the scope of the law.
Model tree for Shubhwtf/ministral-legis-lora
Base model
mistralai/Ministral-8B-Instruct-2410