Downloads · 30 days
23
40% of all-time downloads
UmaiTech/qwen-2.5-7b-redline-llm-v1
qwen-2.5-7b-redline-llm-v1 is a machine learning model from UmaiTech. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as apache-2.0.
Fine-tuned model for automated legal contract redlining
Downloads · 30 days
23
40% of all-time downloads
All-time downloads
57
Public
Repo size
173 MB
Likes
0
Public
Click a slice to open those files.
.safetensors162 MB · 91%
From the Hugging Face model README
Fine-tuned model for automated legal contract redlining
This is a LORA adapter trained for automated legal document redlining. The model was fine-tuned on legal contracts to suggest protective edits that reduce risk for the reviewing party.
Base Model: Qwen/Qwen2.5-7B-Instruct Training Dataset: UmaiTech/legal-contract-gpt41-redlining-10k Adapter Type: LORA Training Date: 2025-11-11
This model is designed to assist legal professionals in reviewing and redlining contracts. It suggests edits to:
Important: This model is an AI assistant tool. All redlines should be reviewed by qualified attorneys before use in actual contracts.
The model was trained on UmaiTech/legal-contract-gpt41-redlining-10k containing pairs of original contract clauses and their redlined versions, generated using GPT-4.1.
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load adapter config
config = PeftConfig.from_pretrained("UmaiTech/qwen-2.5-7b-redline-llm-v1")
# Load base model
model = AutoModelForCausalLM.from_pretrained(
config.base_model_name_or_path,
torch_dtype=torch.bfloat16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
# Load adapter
model = PeftModel.from_pretrained(model, "UmaiTech/qwen-2.5-7b-redline-llm-v1")
# Generate redline
prompt = """Redline this contract clause to be more protective:
Original: Either party may terminate this Agreement at will without notice.
Redlined:"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
redline = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(redline)
from peft import PeftModel
from transformers import AutoModelForCausalLM
# Load and merge
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-7B-Instruct")
model = PeftModel.from_pretrained(base_model, "UmaiTech/qwen-2.5-7b-redline-llm-v1")
merged_model = model.merge_and_unload()
# Save merged model
merged_model.save_pretrained("./merged_model")
Test Set: 100 samples from legal-contract-gpt41-redlining-10k test split
| Model | Overall Score | BERTScore | ROUGE-L | BLEU | Edit Sim | Clause Pres | Latency |
|---|---|---|---|---|---|---|---|
| Qwen 2.5 7B (This Model) | 0.5591 | 0.6895 | 0.4509 | 0.2784 | 0.4064 | 0.9024 | 4.6s |
| GPT-4.1-mini (Baseline) | 0.5632 | 0.6841 | 0.4694 | 0.2918 | 0.3905 | 0.8805 | 2.6s |
Key Findings:
Metrics Explained:
@misc{qwen_2.5_7b_redline_llm_v1_2025},
author = {UmaiTech},
title = {qwen-2.5-7b-redline-llm-v1: Fine-tuned Model for Legal Contract Redlining},
year = {2025},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/UmaiTech/qwen-2.5-7b-redline-llm-v1}}
}
This adapter is released under the Apache 2.0 license. The base model may have different licensing terms.
For questions or issues:
Disclaimer: This model is for research and assistant purposes. Always consult qualified legal counsel for actual contract work.