minilm-contracts-ft
finding legal clauses in contracts
2 min readupdated
This model is a specialized version (fine-tune) of the popular compact all-MiniLM-L6-v2 architecture, trained to find relevant fragments and clauses in commercial contracts using the CUAD (Contract Understanding Atticus Dataset) collection. Created for the ContractLens project, the model helps accurately extract specific terms from legal documents. It outputs text vector representations that allow you to quickly match questions with relevant contract sections. This solution will be useful for developers and lawyers building automated analysis and search systems for contract databases.
Key features
- Specialization in 12 types of standard legal clauses from the CUAD dataset.
- Significant boost in the Recall@1 metric (up to 0.765 compared to 0.439 for the base version).
- Trained on a sample of 357 real commercial contracts (primarily US agreements).
- Very compact size (about 22 million parameters), ensuring high operating speed.
What you can do
- Integrate the model into a RAG (retrieval-augmented generation) system to answer questions about contracts.
- Use it in search engines to automatically find specific obligations, warranties, or termination conditions.
- Build a preliminary commercial agreement audit tool for quick risk detection.
Example
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("sindhisalam/minilm-contracts-ft")
emb = model.encode(["Which state's or country's law governs this contract?"], normalize_embeddings=True)Read more
DetailsMetrics on the held-out test: Recall@1 increased by +0.325, Recall@5 reached 0.950, and MRR@10 hit 0.848.
Training: 1 epoch, batch size 64, lr 2e-5 using MultipleNegativesRankingLoss.
Limitations: tested only on 12 clause types from the CUAD dataset; the model does not replace professional legal advice.










Comments