Update model card with v11 eval results
Browse files
README.md
CHANGED
|
@@ -16,9 +16,9 @@ pipeline_tag: text-ranking
|
|
| 16 |
|
| 17 |
# cuad-cross-encoder-v11
|
| 18 |
|
| 19 |
-
A cross-encoder reranker fine-tuned for **legal clause retrieval** in contract review workflows. Built on
|
| 20 |
|
| 21 |
-
Deployed as **ONNX INT8** for in-browser inference via [
|
| 22 |
|
| 23 |
---
|
| 24 |
|
|
@@ -38,13 +38,18 @@ Deployed as **ONNX INT8** for in-browser inference via [WebAssembly / ONNX Runti
|
|
| 38 |
| ACCORD | 3,931 annotated legal passages | ~6,000 |
|
| 39 |
| LEDGAR | SEC EDGAR provisions, 14 labels filtered for JV/NC/IP | ~4,000 |
|
| 40 |
| ContractNLI / LegalBench | 14 NLI tasks over contract text | ~3,000 |
|
| 41 |
-
| EDGAR
|
| 42 |
-
| EDGAR JV | 8-K joint venture exhibit filings |
|
| 43 |
-
| EDGAR Sino-JV | 20-F chapter-format Sino-JV agreements | ~4,272 |
|
| 44 |
-
|
|
| 45 |
-
|
|
| 46 |
-
|
| 47 |
-
**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
Pairs are `(query, positive_chunk, negative_chunk)` triplets. Negatives are a mix of hard negatives (wrong clause from same contract) and random negatives (chunks from other contracts).
|
| 50 |
|
|
@@ -61,8 +66,8 @@ Pairs are `(query, positive_chunk, negative_chunk)` triplets. Negatives are a mi
|
|
| 61 |
| Max sequence length | 512 tokens |
|
| 62 |
| Warmup steps | 10% of total steps |
|
| 63 |
| Loss | Cross-entropy (sentence-transformers `CrossEncoderTrainer`) |
|
| 64 |
-
| Hardware | NVIDIA RTX 3090
|
| 65 |
-
| Training time | ~
|
| 66 |
|
| 67 |
---
|
| 68 |
|
|
@@ -70,12 +75,12 @@ Pairs are `(query, positive_chunk, negative_chunk)` triplets. Negatives are a mi
|
|
| 70 |
|
| 71 |
Evaluated on a held-out set of 16 contracts across 4 clause domains. Each contract is queried with 3–8 clause-type questions; the top-ranked chunk is scored as **pass** (correct clause returned), **partial** (correct section but wrong chunk boundary), or **fail**.
|
| 72 |
|
| 73 |
-
| Suite | Contracts | Queries | Pass | Partial | Fail |
|
| 74 |
-
|-------|-----------|---------|------|---------|------|
|
| 75 |
-
| Joint Venture | 9 | 51 |
|
| 76 |
-
| Intellectual Property | 4 | 49 |
|
| 77 |
-
| Non-Compete / Non-Solicit | 3 | 13 |
|
| 78 |
-
| NDA | 3 | 19 |
|
| 79 |
|
| 80 |
**Test contracts (JV):** MightyCell Batteries, BorrowMoney.com, Galera Therapeutics, MINDA IMPCO Technologies, Kiromic Biopharma, Novo Integrated Sciences, Transphorm / Aizu Fujitsu, Valence Technology / Baoding Fengfan, Veoneer
|
| 81 |
|
|
@@ -83,6 +88,8 @@ Evaluated on a held-out set of 16 contracts across 4 clause domains. Each contra
|
|
| 83 |
|
| 84 |
**Test contracts (NDA):** Kite Pharma / Gilead Sciences, Fortune Brands / Norcraft Companies, Aspect Medical Systems / Tyco Healthcare
|
| 85 |
|
|
|
|
|
|
|
| 86 |
---
|
| 87 |
|
| 88 |
## Usage
|
|
@@ -95,7 +102,7 @@ from transformers import AutoTokenizer
|
|
| 95 |
import numpy as np
|
| 96 |
|
| 97 |
tokenizer = AutoTokenizer.from_pretrained("datgacon/cuad-cross-encoder-v11")
|
| 98 |
-
session = ort.InferenceSession("model_quantized.onnx")
|
| 99 |
|
| 100 |
query = "What governing law applies to this agreement?"
|
| 101 |
passage = "This Agreement shall be governed by and construed in accordance with the laws of the State of Delaware."
|
|
@@ -134,6 +141,7 @@ for score, passage in ranked:
|
|
| 134 |
- Partial matches are common at clause-boundary edges — chunk size and overlap in the retrieval pipeline significantly affect results
|
| 135 |
- Not a legal advisor — scores indicate retrieval relevance, not legal interpretation
|
| 136 |
- Performance on clause types outside the four trained domains (JV, IP, NC, NDA) is untested
|
|
|
|
| 137 |
|
| 138 |
---
|
| 139 |
|
|
|
|
| 16 |
|
| 17 |
# cuad-cross-encoder-v11
|
| 18 |
|
| 19 |
+
A cross-encoder reranker fine-tuned for **legal clause retrieval** in contract review workflows. Built on [`cross-encoder/ms-marco-MiniLM-L-6-v2`](https://huggingface.co/cross-encoder/ms-marco-MiniLM-L-6-v2) and fine-tuned on a combination of CUAD, ACCORD, LEDGAR, ContractNLI, EDGAR-sourced contract pairs, and LLM-generated synthetic pairs targeting known failure patterns.
|
| 20 |
|
| 21 |
+
Deployed as **ONNX INT8** for in-browser inference via [ONNX Runtime Web](https://onnxruntime.ai/docs/tutorials/web/).
|
| 22 |
|
| 23 |
---
|
| 24 |
|
|
|
|
| 38 |
| ACCORD | 3,931 annotated legal passages | ~6,000 |
|
| 39 |
| LEDGAR | SEC EDGAR provisions, 14 labels filtered for JV/NC/IP | ~4,000 |
|
| 40 |
| ContractNLI / LegalBench | 14 NLI tasks over contract text | ~3,000 |
|
| 41 |
+
| EDGAR default (re-run) | SC 13D + 8-K NC/IP exhibits | 6,680 pos |
|
| 42 |
+
| EDGAR JV (re-run) | 8-K joint venture exhibit filings | 1,054 pos |
|
| 43 |
+
| EDGAR Sino-JV (re-run) | 20-F chapter-format Sino-JV agreements | ~4,272 |
|
| 44 |
+
| EDGAR NDA *(new v11)* | EX-99 confidentiality exhibits from SC TO-T / 8-K filings | 4,417 pos |
|
| 45 |
+
| Synthetic spinoff-IP *(new v11)* | LLM-labeled pairs for IP spinoff format failures | 294 |
|
| 46 |
+
| Synthetic NDA *(new v11)* | LLM-labeled pairs for NDA section-dominance failures | 267 |
|
| 47 |
+
| Synthetic definitions-bleed *(new v11)* | LLM-labeled pairs for definitions-article bleed failures | 507 |
|
| 48 |
+
| Synthetic Armstrong-IP *(new v11)* | LLM-labeled pairs for irrevocable license confusion | 102 |
|
| 49 |
+
| Eval positives | Full-chunk positives extracted from passing eval cases | 84 |
|
| 50 |
+
| Pipeline hard negatives | Clause queries where prior model failed — reranked negatives | 254 |
|
| 51 |
+
|
| 52 |
+
**Total: ~72,101 training pairs · 5,612 validation pairs**
|
| 53 |
|
| 54 |
Pairs are `(query, positive_chunk, negative_chunk)` triplets. Negatives are a mix of hard negatives (wrong clause from same contract) and random negatives (chunks from other contracts).
|
| 55 |
|
|
|
|
| 66 |
| Max sequence length | 512 tokens |
|
| 67 |
| Warmup steps | 10% of total steps |
|
| 68 |
| Loss | Cross-entropy (sentence-transformers `CrossEncoderTrainer`) |
|
| 69 |
+
| Hardware | NVIDIA RTX 3090 (RunPod) |
|
| 70 |
+
| Training time | ~50 min |
|
| 71 |
|
| 72 |
---
|
| 73 |
|
|
|
|
| 75 |
|
| 76 |
Evaluated on a held-out set of 16 contracts across 4 clause domains. Each contract is queried with 3–8 clause-type questions; the top-ranked chunk is scored as **pass** (correct clause returned), **partial** (correct section but wrong chunk boundary), or **fail**.
|
| 77 |
|
| 78 |
+
| Suite | Contracts | Queries | Pass | Partial | Fail | vs v10 |
|
| 79 |
+
|-------|-----------|---------|------|---------|------|--------|
|
| 80 |
+
| Joint Venture | 9 | 51 | 20 (39%) | 15 (29%) | 16 (31%) | +11 pass 🚀 |
|
| 81 |
+
| Intellectual Property | 4 | 49 | 18 (37%) | 18 (37%) | 13 (27%) | +1 pass |
|
| 82 |
+
| Non-Compete / Non-Solicit | 3 | 13 | 6 (46%) | 7 (54%) | 0 (0%) | +1 pass |
|
| 83 |
+
| NDA | 3 | 19 | 9 (47%) | 7 (37%) | 3 (16%) | +1 pass |
|
| 84 |
|
| 85 |
**Test contracts (JV):** MightyCell Batteries, BorrowMoney.com, Galera Therapeutics, MINDA IMPCO Technologies, Kiromic Biopharma, Novo Integrated Sciences, Transphorm / Aizu Fujitsu, Valence Technology / Baoding Fengfan, Veoneer
|
| 86 |
|
|
|
|
| 88 |
|
| 89 |
**Test contracts (NDA):** Kite Pharma / Gilead Sciences, Fortune Brands / Norcraft Companies, Aspect Medical Systems / Tyco Healthcare
|
| 90 |
|
| 91 |
+
The JV improvement (+11 pass) is driven by new Sino-JV EDGAR data and synthetic definitions-bleed pairs targeting contracts where the model previously returned definitions articles for Governing Law and Non-Compete queries.
|
| 92 |
+
|
| 93 |
---
|
| 94 |
|
| 95 |
## Usage
|
|
|
|
| 102 |
import numpy as np
|
| 103 |
|
| 104 |
tokenizer = AutoTokenizer.from_pretrained("datgacon/cuad-cross-encoder-v11")
|
| 105 |
+
session = ort.InferenceSession("onnx/model_quantized.onnx")
|
| 106 |
|
| 107 |
query = "What governing law applies to this agreement?"
|
| 108 |
passage = "This Agreement shall be governed by and construed in accordance with the laws of the State of Delaware."
|
|
|
|
| 141 |
- Partial matches are common at clause-boundary edges — chunk size and overlap in the retrieval pipeline significantly affect results
|
| 142 |
- Not a legal advisor — scores indicate retrieval relevance, not legal interpretation
|
| 143 |
- Performance on clause types outside the four trained domains (JV, IP, NC, NDA) is untested
|
| 144 |
+
- Token type IDs must be passed explicitly when using ONNX Runtime Web; omitting them collapses score spread
|
| 145 |
|
| 146 |
---
|
| 147 |
|