Downloads · 30 days
20
7% of all-time downloads
akshan-main/termsconditioned-roberta-large-ledgar-lora
termsconditioned-roberta-large-ledgar-lora is a text classification model from akshan-main. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as mit.
A RoBERTa-large encoder, fine-tuned with LoRA on the LEDGAR subset of LexGLUE to classify contract paragraphs into 100 clause families, with an explicit risk bucket and slice-level governance analysis.
Downloads · 30 days
20
7% of all-time downloads
All-time downloads
295
Public
Repo size
526 MB
Likes
0
Public
Click a slice to open those files.
.pt330 MB · 60%
From the Hugging Face model README
A RoBERTa-large encoder, fine-tuned with LoRA on the LEDGAR subset of LexGLUE to classify contract paragraphs into 100 clause families, with an explicit risk bucket and slice-level governance analysis.
This repo only contains the adapter weights + tokenizer, not the full base model.
To use it, you must load roberta-large from Hugging Face and then apply these LoRA adapters.
You cannot AutoModelForSequenceClassification.from_pretrained("akshan-main/…")
Arbitration, Governing Laws, Indemnity, Limitation Of Liability, Amendments, etc.).This model is designed to be part of a Terms & Conditions / contract intake triage tool that:
coastalcph/lex_glue (LEDGAR split)Each example is a single paragraph of a contract, labeled with exactly one family.
roberta-large from Hugging Face (transformers).We apply LoRA to a subset of the encoder:
query, key, value, intermediate.dense, output.denser = 16lora_alpha = 32lora_dropout = 0.05classifier head kept and saved along with adapters.Reproducibility knobs:
All numbers below are on the validation split (10,000 paragraphs) with the LoRA adapters applied.
This is a multi-class setting with 100 labels and notable class imbalance.
On top of logits, we apply temperature scaling:
ECE_raw ≈ 0.115ECE_cal ≈ 0.022These calibrated probabilities are what we use for governance policies (false-green caps, abstain band, etc.).
from transformers import AutoTokenizer, AutoModelForSequenceClassification
from peft import PeftModel
BASE = "roberta-large"
ADAPTER_REPO = "akshan-main/termsconditioned-roberta-large-ledgar-lora"
tokenizer = AutoTokenizer.from_pretrained(BASE)
base_model = AutoModelForSequenceClassification.from_pretrained(
BASE,
num_labels=100,
)
model = PeftModel.from_pretrained(base_model, ADAPTER_REPO)
model.eval()
You can test the model on synthetic or real ToS paragraphs (for example, arbitration clauses, limitation of liability caps, or indemnity language)
# Must run the above cell first
# This cell is a sample use case for the model
text = "Any dispute arising out of or relating to this Agreement shall be finally settled by binding arbitration..."
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=384)
with torch.no_grad():
outputs = model(**inputs)
probs = outputs.logits.softmax(dim=-1)[0]
topk = torch.topk(probs, k=5)
for idx, score in zip(topk.indices.tolist(), topk.values.tolist()):
print(idx, float(score))
The model is trained on LEDGAR (public contract clauses). Behavior on consumer terms of service, privacy policies, employment agreements, or narrow industry contracts may differ. You should re-check performance on your own corpus.
The dataset assumes one dominant clause family per paragraph. Real-world paragraphs can mix multiple concerns (for example, arbitration plus waiver of class actions). Treat the prediction as the "primary" family, not an exhaustive tagging of everything risky in the text.
Training data is English-only; performance on other languages is not characterized.
This model is not legal advice. Any production use should keep a human in the loop.
If you use this model in a writeup, you can cite it as:
@misc{akshan_krithick_2025,
author = { Akshan Krithick },
title = { termsconditioned-roberta-large-ledgar-lora (Revision 1605a22) },
year = 2025,
url = { https://huggingface.co/akshan-main/termsconditioned-roberta-large-ledgar-lora },
doi = { 10.57967/hf/7109 },
publisher = { Hugging Face }
}
training checkpointsThe base roberta-large weights are not duplicated here; at inference time they are loaded from the main Hugging Face model hub.