quanfire-dev commited on
Commit
6d6cec3
Β·
verified Β·
1 Parent(s): bcc57b4

Correct the headline to +59.7% on a clean, document-isolated split

Browse files

Measured on a split that isolates at the source-document level. See the notice at the top of the card.

Files changed (1) hide show
  1. README.md +59 -16
README.md CHANGED
@@ -17,6 +17,42 @@ language:
17
 
18
  # Quanfire Legal Embedding β€” `embed-legal-en` (Supreme Court judgments)
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  A retrieval adapter for **English-language Indian Supreme Court judgment text**. It
21
  is a LoRA adaptation over a frozen
22
  [`intfloat/multilingual-e5-small`](https://huggingface.co/intfloat/multilingual-e5-small)
@@ -31,7 +67,7 @@ you both, measured.
31
  - **Framework & code:** [github.com/quanfire-ai/quanfire-multilingual-embedding](https://github.com/quanfire-ai/quanfire-multilingual-embedding) (Apache-2.0)
32
  - **PyPI:** `pip install quanfire-multilingual-embedding`
33
  - **Weights licence:** Apache-2.0 (see *Licence & provenance* β€” the training text is statutory public domain, so no share-alike floor applies)
34
- - **Internal run:** `legal-indic-e1` Β· base e5-small Β· rank 32 / alpha 64, LoRA on `query,value` Β· 589,824 adapter params Β· 1 epoch, lr 1e-4, batch 256 (bf16, CUDA)
35
 
36
  ## What it is for
37
 
@@ -43,7 +79,7 @@ It embeds a query and a passage into the same 384-d space; cosine similarity ran
43
 
44
  | | Validated? |
45
  |---|---|
46
- | English Supreme Court **judgment** retrieval | βœ… **Yes** β€” strong, measured below |
47
  | **Statutory / bare-act** text, FAQs, other legal registers | ❌ **No** β€” transfer tested, came back flat (see below) |
48
  | **Non-English** legal text (Hindi, Tamil, …) | ❌ **No** β€” the model and its training data are English-only |
49
 
@@ -56,23 +92,29 @@ contracts, or non-English legal material, use the base model or a purpose-built
56
  **In-distribution β€” 2,000 held-out Supreme Court judgment pairs.** The published base
57
  is the only honest baseline; the adapter is scored on the *same* held-out pairs.
58
 
59
- | Metric | base e5-small | **embed-legal-en** | change |
60
- |---|---|---|---|
61
- | Recall@1 | 0.309 | **0.545** | **+76.2 %** |
62
- | Recall@5 | 0.494 | **0.772** | +56.3 % |
63
- | Recall@10 | 0.567 | **0.829** | +46.2 % |
64
- | MRR | 0.399 | **0.647** | +62.2 % |
65
- | nDCG@10 | 0.433 | **0.687** | +58.7 % |
 
 
 
66
 
67
- The Recall@1 95 % confidence intervals are disjoint (base `[0.289, 0.330]` β†’
68
- adapter `[0.523, 0.566]`), so the gain is not sampling noise. It holds where it is
69
  hardest: on the **low-lexical-overlap** bucket (`<0.3`, pure-semantic matches, no
70
- shared words to lean on) Recall@1 more than doubles, **0.156 β†’ 0.325**.
 
71
 
72
  **Out-of-origin transfer β€” 1,578 English *statutory* adjacency pairs** (a different
73
  legal register: bare-act sections and regulatory FAQs, origin-walled from the
74
  judgment training corpus). This is the honest generalization test, and it is
75
- **flat**:
 
 
76
 
77
  | Metric | base e5-small | embed-legal-en |
78
  |---|---|---|
@@ -81,9 +123,10 @@ judgment training corpus). This is the honest generalization test, and it is
81
 
82
  The instrument is informative, not degenerate β€” the base model has real signal on it
83
  (high-overlap Recall@5 0.76). The adapter simply does not improve statutory
84
- retrieval. **We publish this row on purpose:** the +76 % is a judgment-domain result,
85
- not a "legal English" result, and the difference is exactly what a buyer needs to
86
- know.
 
87
 
88
  ## Usage
89
 
 
17
 
18
  # Quanfire Legal Embedding β€” `embed-legal-en` (Supreme Court judgments)
19
 
20
+ > ### ⚠️ Measurement correction β€” 2026-08-21
21
+ >
22
+ > **The headline this card used to carry (+76.2 % Recall@1) was measured on a
23
+ > contaminated evaluation split. The corrected figure is +59.7 %.**
24
+ >
25
+ > The bug: the training filter dropped a pair only when its *positive* was in the
26
+ > held-out set, and pairs drawn from a held-out judgment were never excluded at
27
+ > all. Adjacent-passage pairs from the same judgment therefore sat on both sides
28
+ > of the split β€” the model was partly trained on the documents it was scored on.
29
+ >
30
+ > The adapter was retrained and rescored on a split that isolates at the
31
+ > **judgment-document** level (1,379 documents held out, 48,304 pairs dropped
32
+ > from the pool). **Every in-distribution number in *Results* below is the clean
33
+ > measurement.** This was the best-surviving of the three corrections we pushed
34
+ > that day: the gain lost about a quarter of its magnitude and kept its
35
+ > direction, its significance and its shape.
36
+ >
37
+ > Two things a reader deserves to know:
38
+ >
39
+ > 1. **The clean figures are for a retrain (`legal-indic-e1c`), not for the
40
+ > weight file currently in this repo.** The published weights saw the
41
+ > evaluation documents during training, so no honest score for *them* exists.
42
+ > Publishing the clean adapter as a new revision is pending.
43
+ > 2. **The runs are not volume-matched** β€” 46,115 training pairs clean against
44
+ > 92,419 before. Do not read the difference as a clean measure of "what the
45
+ > leak was worth".
46
+ >
47
+ > The **out-of-origin transfer** result is unaffected in kind β€” it is scored on a
48
+ > different corpus, so the split bug cannot reach it β€” but the figures below
49
+ > belong to the withdrawn adapter and have not been recomputed for the retrain.
50
+ >
51
+ > Fix: `without_held_out()` in
52
+ > [quanfire-multilingual-embedding](https://github.com/quanfire-ai/quanfire-multilingual-embedding)
53
+ > (commits `66470fe`, `6fe7e6b`, `3deaf8d`).
54
+
55
+
56
  A retrieval adapter for **English-language Indian Supreme Court judgment text**. It
57
  is a LoRA adaptation over a frozen
58
  [`intfloat/multilingual-e5-small`](https://huggingface.co/intfloat/multilingual-e5-small)
 
67
  - **Framework & code:** [github.com/quanfire-ai/quanfire-multilingual-embedding](https://github.com/quanfire-ai/quanfire-multilingual-embedding) (Apache-2.0)
68
  - **PyPI:** `pip install quanfire-multilingual-embedding`
69
  - **Weights licence:** Apache-2.0 (see *Licence & provenance* β€” the training text is statutory public domain, so no share-alike floor applies)
70
+ - **Internal run:** `legal-indic-e1` Β· base e5-small Β· rank 32 / alpha 64, LoRA on `query,value` Β· 589,824 adapter params Β· 1 epoch, lr 1e-4, batch 256 (bf16, CUDA) Β· the clean re-measure reported below is `legal-indic-e1c`: identical configuration, retrained on a document-isolated split
71
 
72
  ## What it is for
73
 
 
79
 
80
  | | Validated? |
81
  |---|---|
82
+ | English Supreme Court **judgment** retrieval | βœ… **Yes** β€” +59.7 % Recall@1 on a clean, document-isolated split; measured below |
83
  | **Statutory / bare-act** text, FAQs, other legal registers | ❌ **No** β€” transfer tested, came back flat (see below) |
84
  | **Non-English** legal text (Hindi, Tamil, …) | ❌ **No** β€” the model and its training data are English-only |
85
 
 
92
  **In-distribution β€” 2,000 held-out Supreme Court judgment pairs.** The published base
93
  is the only honest baseline; the adapter is scored on the *same* held-out pairs.
94
 
95
+ | Metric | base e5-small | **clean retrain (`legal-indic-e1c`)** | change | withdrawn figure |
96
+ |---|---|---|---|---|
97
+ | Recall@1 | 0.3090 | **0.4935** | **+59.7 %** | ~~0.545 / +76.2 %~~ |
98
+ | Recall@5 | 0.4940 | **0.7180** | +45.3 % | ~~0.772~~ |
99
+ | Recall@10 | 0.5670 | **0.7910** | +39.5 % | ~~0.829~~ |
100
+ | MRR | 0.3988 | **0.5996** | +50.4 % | ~~0.647~~ |
101
+ | nDCG@10 | 0.4326 | **0.6408** | +48.1 % | ~~0.687~~ |
102
+
103
+ The base column is unchanged β€” the contamination only ever inflated the adapter, so the
104
+ correction is confined to one column.
105
 
106
+ The Recall@1 95 % confidence intervals are disjoint (base `[0.2891, 0.3296]` β†’
107
+ clean retrain `[0.4716, 0.5154]`), so the gain is not sampling noise. It holds where it is
108
  hardest: on the **low-lexical-overlap** bucket (`<0.3`, pure-semantic matches, no
109
+ shared words to lean on) Recall@1 rises **0.156 β†’ 0.290** (+85.7 %; the withdrawn figure
110
+ was 0.325).
111
 
112
  **Out-of-origin transfer β€” 1,578 English *statutory* adjacency pairs** (a different
113
  legal register: bare-act sections and regulatory FAQs, origin-walled from the
114
  judgment training corpus). This is the honest generalization test, and it is
115
+ **flat**. *These two rows are the withdrawn adapter's numbers and have not been recomputed
116
+ for the clean retrain; the split bug could not reach them (different corpus), but a retrained
117
+ adapter is a different adapter:*
118
 
119
  | Metric | base e5-small | embed-legal-en |
120
  |---|---|---|
 
123
 
124
  The instrument is informative, not degenerate β€” the base model has real signal on it
125
  (high-overlap Recall@5 0.76). The adapter simply does not improve statutory
126
+ retrieval. **We publish this row on purpose:** the in-distribution gain is a
127
+ judgment-domain result, not a "legal English" result, and the difference is exactly what a
128
+ buyer needs to know. For statutory text, use the purpose-built sibling
129
+ [`embed-statute-en`](https://huggingface.co/quanfire-ai/embed-statute-en).
130
 
131
  ## Usage
132