Instructions to use Abogatic/qwen35-27b-legal-sft-es-v1-merged with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Abogatic/qwen35-27b-legal-sft-es-v1-merged with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Abogatic/qwen35-27b-legal-sft-es-v1-merged") 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)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Abogatic/qwen35-27b-legal-sft-es-v1-merged") model = AutoModelForMultimodalLM.from_pretrained("Abogatic/qwen35-27b-legal-sft-es-v1-merged", 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Abogatic/qwen35-27b-legal-sft-es-v1-merged with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Abogatic/qwen35-27b-legal-sft-es-v1-merged" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Abogatic/qwen35-27b-legal-sft-es-v1-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Abogatic/qwen35-27b-legal-sft-es-v1-merged
- SGLang
How to use Abogatic/qwen35-27b-legal-sft-es-v1-merged 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 "Abogatic/qwen35-27b-legal-sft-es-v1-merged" \ --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": "Abogatic/qwen35-27b-legal-sft-es-v1-merged", "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 "Abogatic/qwen35-27b-legal-sft-es-v1-merged" \ --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": "Abogatic/qwen35-27b-legal-sft-es-v1-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use Abogatic/qwen35-27b-legal-sft-es-v1-merged with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Abogatic/qwen35-27b-legal-sft-es-v1-merged to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Abogatic/qwen35-27b-legal-sft-es-v1-merged to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Abogatic/qwen35-27b-legal-sft-es-v1-merged to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="Abogatic/qwen35-27b-legal-sft-es-v1-merged", max_seq_length=2048, ) - Docker Model Runner
How to use Abogatic/qwen35-27b-legal-sft-es-v1-merged with Docker Model Runner:
docker model run hf.co/Abogatic/qwen35-27b-legal-sft-es-v1-merged
Qwen3.5-27B Legal SFT ES v1 Merged
Merged full model derived from a LoRA fine-tuning on Qwen/Qwen3.5-27B, specialized for conservative Spanish legal assistant behavior over statutes and case law.
This repository contains merged weights and can be served directly as a standalone model.
Intended behavior
The fine-tuning objective was behavioral, not encyclopedic. The target model should:
- cite only what is visible in the provided material;
- avoid converting an old judicial citation into a statement of current positive law;
- explicitly recognize when the available text is partial or insufficient;
- write in a more prudent, structured, professional Spanish legal style.
The model is meant for RAG-style systems over Spanish legal sources, especially where the retrieved context may include:
- anonymized Spanish Supreme Court judgments;
- partial extracts of judgments;
- visible statutory fragments;
- mixed legal bundles where caution matters.
What was trained
The training corpus was built from anonymized Spanish Supreme Court judgments and transformed into chat-format SFT examples focused on:
- sentence analysis;
- prudent legal analysis;
- legal drafting style;
- autocontention and explicit limits;
- separation between facts, allegations, prior rulings, legal reasoning, and operative part;
- temporal normative caution when a judgment cites legal provisions.
The dataset was designed to reduce these failure modes:
- inventing articles, dates, ECLI, ROJ, or holdings not visible in the prompt;
- treating a provision cited inside an old judgment as if it were necessarily the current wording in force;
- overstating what can be concluded from partial context.
Training details
- Base model:
Qwen/Qwen3.5-27B - Training method: supervised fine-tuning with LoRA
- Training stack: Unsloth + TRL + PEFT
- Training profile:
gold_plus_reviewed_behavior_27b_v1 - Train samples:
5684 - Validation samples:
293 - Runtime:
23384.78seconds - Final train loss:
3.5116 - Final eval loss:
0.436 - Thinking mode during training: disabled
LoRA configuration before merge
- Rank
r:32 - Alpha:
32 - Dropout:
0.0 - Bias:
none - Target modules:
q_projk_projv_projo_projgate_projup_projdown_proj
Recommended use
Best fit:
- Spanish legal RAG over statutes and case law;
- systems that pass visible source excerpts to the model;
- structured legal summarization with explicit limits.
Recommended guardrails:
- instruct the model to answer only from retrieved material;
- distinguish between "norm cited by the judgment" and "currently visible statutory text";
- require explicit statements like
no constawhen the context is partial; - prefer deterministic decoding for legal production workflows.
Not a full legal authority
This model is not a substitute for:
- legal source validation;
- current-law verification;
- professional legal review.
It should not be used to assert current legal validity unless the current statutory text is explicitly present in the retrieved context.
Usage with Transformers
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "Abogatic/qwen35-27b-legal-sft-es-v1-merged"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
trust_remote_code=True,
torch_dtype=torch.bfloat16,
device_map="auto",
)
model.eval()
Usage with vLLM
vllm serve Abogatic/qwen35-27b-legal-sft-es-v1-merged \
--trust-remote-code \
--generation-config vllm \
--default-chat-template-kwargs '{"enable_thinking": false}'
Languages
- Spanish
Source and licensing notes
This merged model was trained from anonymized judicial material transformed into behavioral SFT examples. Review the legal and organizational requirements applicable to the source corpus before redistribution or downstream commercial use.
Use remains subject to the base model license and the legal constraints of the training corpus.
- Downloads last month
- 11
Model tree for Abogatic/qwen35-27b-legal-sft-es-v1-merged
Base model
Qwen/Qwen3.5-27B