Views
No views yet
Qwen/Qwen2.5-3B-Instruct (4-bit QLoRA) to convert real legal
contract clauses into structured JSON: clause_type, risk_level, obligated_party,
has_penalty, summary.llama-3.1-8b-instant)
and spot-checked by hand.| Metric | Baseline (zero-shot) | Fine-tuned (this adapter) |
|---|---|---|
| JSON validity | 61.2% | 100.0% |
| Field accuracy | 33.9% | 66.5% |
1from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
2from peft import PeftModel
3import torch
4
5bnb_config = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="nf4",
6 bnb_4bit_compute_dtype=torch.bfloat16)
7base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-3B-Instruct", quantization_config=bnb_config, device_map="auto")
8model = PeftModel.from_pretrained(base, "SatyamGhosh/qlora-legal-clause-extractor")
9tokenizer = AutoTokenizer.from_pretrained("SatyamGhosh/qlora-legal-clause-extractor")