matulichpt commited on
Commit
812c876
·
verified ·
1 Parent(s): dd3583d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +239 -242
README.md CHANGED
@@ -1,242 +1,239 @@
1
- ---
2
- language:
3
- - en
4
- license: apache-2.0
5
- library_name: sentence-transformers
6
- tags:
7
- - sentence-transformers
8
- - feature-extraction
9
- - sentence-similarity
10
- - radiology
11
- - medical
12
- - retrieval
13
- - embedding
14
- datasets:
15
- - custom
16
- metrics:
17
- - mrr
18
- - recall
19
- pipeline_tag: sentence-similarity
20
- model-index:
21
- - name: radlit-biencoder
22
- results:
23
- - task:
24
- type: retrieval
25
- name: Radiology Document Retrieval
26
- dataset:
27
- type: custom
28
- name: RadLIT-9
29
- config: radlit9-v1.1-balanced
30
- metrics:
31
- - type: mrr
32
- value: 0.829
33
- name: MRR
34
- - type: recall@10
35
- value: 0.971
36
- name: Recall@10
37
- - type: ndcg@10
38
- value: 0.863
39
- name: nDCG@10
40
- ---
41
-
42
- # RadLIT-BiEncoder: Radiology Late Interaction Transformer
43
-
44
- A domain-specialized bi-encoder model for radiology document retrieval, trained to understand medical imaging terminology, clinical reasoning patterns, and radiology-specific queries.
45
-
46
- ## Model Description
47
-
48
- RadLIT-BiEncoder is the first stage of the RadLITE retrieval pipeline. It generates dense embeddings optimized for radiology content retrieval, significantly outperforming general-purpose embedding models on radiology-specific queries.
49
-
50
- ### Architecture
51
-
52
- - **Base Model**: RoBERTa-base architecture
53
- - **Hidden Size**: 768
54
- - **Layers**: 12
55
- - **Attention Heads**: 12
56
- - **Parameters**: ~125M
57
- - **Max Sequence Length**: 512 tokens
58
- - **Embedding Dimension**: 768
59
-
60
- ### Training
61
-
62
- The model was trained using contrastive learning with hard negative mining on a large corpus of radiology educational content. Training details:
63
-
64
- - **Training Objective**: Multiple Negatives Ranking Loss with hard negatives
65
- - **Batch Size**: 32
66
- - **Learning Rate**: 2e-5 with warmup
67
- - **Training Epochs**: 4
68
- - **Hard Negatives**: Mined from top-k retrieval failures
69
-
70
- **Note**: Training data consisted of radiology educational materials. Specific sources are not disclosed due to variable licensing, but the model is released under Apache 2.0 for research and commercial use.
71
-
72
- ## Performance
73
-
74
- ### RadLIT-9 Benchmark
75
-
76
- RadLIT-9 is a comprehensive radiology retrieval benchmark covering 9 subspecialties:
77
-
78
- | Metric | Score |
79
- |--------|-------|
80
- | **MRR** | 0.829 |
81
- | **nDCG@10** | 0.863 |
82
- | **Recall@10** | 97.1% |
83
- | **Recall@5** | 93.8% |
84
- | **Recall@1** | 74.3% |
85
-
86
- ### Subspecialty Performance
87
-
88
- | Subspecialty | MRR | Recall@10 |
89
- |--------------|-----|-----------|
90
- | Physics/Nuclear | 0.936 | 100% |
91
- | Pediatric | 0.931 | 100% |
92
- | Thoracic | 0.913 | 98% |
93
- | Cardiac | 0.862 | 98% |
94
- | Neuroradiology | 0.860 | 98% |
95
- | Gastrointestinal | 0.800 | 96% |
96
- | Breast | 0.722 | 93% |
97
- | Musculoskeletal | 0.695 | 89% |
98
- | Genitourinary | 0.694 | 100% |
99
-
100
- ### Comparison with Baselines
101
-
102
- | Model | MRR | vs RadLIT |
103
- |-------|-----|-----------|
104
- | **RadLIT-BiEncoder** | **0.829** | -- |
105
- | ColBERT-v2 | 0.750 | -9.5% |
106
- | General bi-encoder | 0.703 | -15.2% |
107
- | BM25 | ~0.55 | -33.6% |
108
-
109
- ## Usage
110
-
111
- ### Installation
112
-
113
- ```bash
114
- pip install sentence-transformers
115
- ```
116
-
117
- ### Basic Usage
118
-
119
- ```python
120
- from sentence_transformers import SentenceTransformer
121
-
122
- # Load model
123
- model = SentenceTransformer('matulichpt/radlit-biencoder')
124
-
125
- # Encode queries and documents
126
- queries = [
127
- "What are the imaging features of hepatocellular carcinoma on MRI?",
128
- "How do you differentiate glioblastoma from metastasis?"
129
- ]
130
- documents = [
131
- "HCC typically shows arterial enhancement with washout on portal venous phase...",
132
- "GBM and metastases can be differentiated by their location and multiplicity..."
133
- ]
134
-
135
- query_embeddings = model.encode(queries, convert_to_tensor=True)
136
- doc_embeddings = model.encode(documents, convert_to_tensor=True)
137
-
138
- # Compute similarity
139
- from sentence_transformers.util import cos_sim
140
- similarities = cos_sim(query_embeddings, doc_embeddings)
141
- print(similarities)
142
- ```
143
-
144
- ### For Retrieval Pipeline
145
-
146
- ```python
147
- from sentence_transformers import SentenceTransformer, util
148
- import torch
149
-
150
- model = SentenceTransformer('matulichpt/radlit-biencoder')
151
-
152
- # Pre-encode your document corpus
153
- corpus = ["document 1...", "document 2...", ...]
154
- corpus_embeddings = model.encode(corpus, convert_to_tensor=True, show_progress_bar=True)
155
-
156
- # At query time
157
- query = "What are the CT findings in pulmonary embolism?"
158
- query_embedding = model.encode(query, convert_to_tensor=True)
159
-
160
- # Find top-k similar documents
161
- cos_scores = util.cos_sim(query_embedding, corpus_embeddings)[0]
162
- top_results = torch.topk(cos_scores, k=10)
163
-
164
- for score, idx in zip(top_results[0], top_results[1]):
165
- print(f"Score: {score:.4f} - {corpus[idx][:100]}...")
166
- ```
167
-
168
- ## Recommended: Full RadLITE Pipeline
169
-
170
- For best results, use RadLIT-BiEncoder as the first stage followed by RadLIT-CrossEncoder for reranking:
171
-
172
- ```python
173
- from sentence_transformers import SentenceTransformer, CrossEncoder
174
-
175
- # Stage 1: Bi-encoder retrieval
176
- biencoder = SentenceTransformer('grai-rad/radlit-biencoder')
177
-
178
- # Stage 2: Cross-encoder reranking
179
- crossencoder = CrossEncoder('matulichpt/radlit-crossencoder')
180
-
181
- # Retrieve candidates
182
- query = "What are the MRI findings in anterior cruciate ligament tear?"
183
- candidates = retrieve_with_biencoder(query, corpus, biencoder, top_k=50)
184
-
185
- # Rerank with cross-encoder
186
- pairs = [[query, doc] for doc in candidates]
187
- scores = crossencoder.predict(pairs)
188
-
189
- # Apply temperature calibration (recommended: T=1.5)
190
- calibrated_scores = scores / 1.5
191
-
192
- # Sort by calibrated scores
193
- reranked = sorted(zip(candidates, calibrated_scores), key=lambda x: x[1], reverse=True)
194
- ```
195
-
196
- ## Intended Use
197
-
198
- ### Primary Use Cases
199
-
200
- - Radiology educational content retrieval
201
- - Medical imaging literature search
202
- - Clinical decision support (retrieval component)
203
- - Radiology question-answering systems
204
-
205
- ### Out-of-Scope Uses
206
-
207
- - General web search
208
- - Non-medical document retrieval
209
- - Clinical diagnosis (this is a retrieval model, not a diagnostic tool)
210
-
211
- ## Limitations
212
-
213
- 1. **Domain Specificity**: Optimized for radiology; may underperform on general medical or non-medical content
214
- 2. **Language**: English only
215
- 3. **Subspecialty Variance**: Performance varies by subspecialty (0.69-0.94 MRR range)
216
- 4. **Not a Diagnostic Tool**: This model retrieves relevant documents; it does not provide medical diagnoses
217
-
218
- ## Ethical Considerations
219
-
220
- - This model should not be used as a sole source for clinical decision-making
221
- - Retrieved documents should be reviewed by qualified medical professionals
222
- - The model may reflect biases present in radiology educational literature
223
-
224
- ## Citation
225
-
226
- ```bibtex
227
- @software{radlit_biencoder_2026,
228
- title = {RadLIT-BiEncoder: Domain-Specialized Embeddings for Radiology Retrieval},
229
- author = {Grai Team},
230
- year = {2026},
231
- url = {https://huggingface.co/matulichpt/radlit-biencoder},
232
- note = {MRR 0.829 on RadLIT-9 benchmark}
233
- }
234
- ```
235
-
236
- ## License
237
-
238
- Apache 2.0 - Free for research and commercial use.
239
-
240
- ## Contact
241
-
242
- For questions or collaboration: Open an issue on the model repository
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: apache-2.0
5
+ library_name: sentence-transformers
6
+ tags:
7
+ - sentence-transformers
8
+ - feature-extraction
9
+ - sentence-similarity
10
+ - radiology
11
+ - medical
12
+ - retrieval
13
+ - embedding
14
+ datasets:
15
+ - custom
16
+ pipeline_tag: sentence-similarity
17
+ model-index:
18
+ - name: radlit-biencoder
19
+ results:
20
+ - task:
21
+ type: retrieval
22
+ name: Radiology Document Retrieval
23
+ dataset:
24
+ type: custom
25
+ name: RadLIT-9
26
+ config: radlit9-v1.1-balanced
27
+ metrics:
28
+ - type: mrr
29
+ value: 0.829
30
+ name: MRR
31
+ - type: recall@10
32
+ value: 0.971
33
+ name: Recall@10
34
+ - type: ndcg@10
35
+ value: 0.863
36
+ name: nDCG@10
37
+ ---
38
+
39
+ # RadLIT-BiEncoder: Radiology Late Interaction Transformer
40
+
41
+ A domain-specialized bi-encoder model for radiology document retrieval, trained to understand medical imaging terminology, clinical reasoning patterns, and radiology-specific queries.
42
+
43
+ ## Model Description
44
+
45
+ RadLIT-BiEncoder is the first stage of the RadLITE retrieval pipeline. It generates dense embeddings optimized for radiology content retrieval, significantly outperforming general-purpose embedding models on radiology-specific queries.
46
+
47
+ ### Architecture
48
+
49
+ - **Base Model**: RoBERTa-base architecture
50
+ - **Hidden Size**: 768
51
+ - **Layers**: 12
52
+ - **Attention Heads**: 12
53
+ - **Parameters**: ~125M
54
+ - **Max Sequence Length**: 512 tokens
55
+ - **Embedding Dimension**: 768
56
+
57
+ ### Training
58
+
59
+ The model was trained using contrastive learning with hard negative mining on a large corpus of radiology educational content. Training details:
60
+
61
+ - **Training Objective**: Multiple Negatives Ranking Loss with hard negatives
62
+ - **Batch Size**: 32
63
+ - **Learning Rate**: 2e-5 with warmup
64
+ - **Training Epochs**: 4
65
+ - **Hard Negatives**: Mined from top-k retrieval failures
66
+
67
+ **Note**: Training data consisted of radiology educational materials. Specific sources are not disclosed due to variable licensing, but the model is released under Apache 2.0 for research and commercial use.
68
+
69
+ ## Performance
70
+
71
+ ### RadLIT-9 Benchmark
72
+
73
+ RadLIT-9 is a comprehensive radiology retrieval benchmark covering 9 subspecialties:
74
+
75
+ | Metric | Score |
76
+ |--------|-------|
77
+ | **MRR** | 0.829 |
78
+ | **nDCG@10** | 0.863 |
79
+ | **Recall@10** | 97.1% |
80
+ | **Recall@5** | 93.8% |
81
+ | **Recall@1** | 74.3% |
82
+
83
+ ### Subspecialty Performance
84
+
85
+ | Subspecialty | MRR | Recall@10 |
86
+ |--------------|-----|-----------|
87
+ | Physics/Nuclear | 0.936 | 100% |
88
+ | Pediatric | 0.931 | 100% |
89
+ | Thoracic | 0.913 | 98% |
90
+ | Cardiac | 0.862 | 98% |
91
+ | Neuroradiology | 0.860 | 98% |
92
+ | Gastrointestinal | 0.800 | 96% |
93
+ | Breast | 0.722 | 93% |
94
+ | Musculoskeletal | 0.695 | 89% |
95
+ | Genitourinary | 0.694 | 100% |
96
+
97
+ ### Comparison with Baselines
98
+
99
+ | Model | MRR | vs RadLIT |
100
+ |-------|-----|-----------|
101
+ | **RadLIT-BiEncoder** | **0.829** | -- |
102
+ | ColBERT-v2 | 0.750 | -9.5% |
103
+ | General bi-encoder | 0.703 | -15.2% |
104
+ | BM25 | ~0.55 | -33.6% |
105
+
106
+ ## Usage
107
+
108
+ ### Installation
109
+
110
+ ```bash
111
+ pip install sentence-transformers
112
+ ```
113
+
114
+ ### Basic Usage
115
+
116
+ ```python
117
+ from sentence_transformers import SentenceTransformer
118
+
119
+ # Load model
120
+ model = SentenceTransformer('matulichpt/radlit-biencoder')
121
+
122
+ # Encode queries and documents
123
+ queries = [
124
+ "What are the imaging features of hepatocellular carcinoma on MRI?",
125
+ "How do you differentiate glioblastoma from metastasis?"
126
+ ]
127
+ documents = [
128
+ "HCC typically shows arterial enhancement with washout on portal venous phase...",
129
+ "GBM and metastases can be differentiated by their location and multiplicity..."
130
+ ]
131
+
132
+ query_embeddings = model.encode(queries, convert_to_tensor=True)
133
+ doc_embeddings = model.encode(documents, convert_to_tensor=True)
134
+
135
+ # Compute similarity
136
+ from sentence_transformers.util import cos_sim
137
+ similarities = cos_sim(query_embeddings, doc_embeddings)
138
+ print(similarities)
139
+ ```
140
+
141
+ ### For Retrieval Pipeline
142
+
143
+ ```python
144
+ from sentence_transformers import SentenceTransformer, util
145
+ import torch
146
+
147
+ model = SentenceTransformer('matulichpt/radlit-biencoder')
148
+
149
+ # Pre-encode your document corpus
150
+ corpus = ["document 1...", "document 2...", ...]
151
+ corpus_embeddings = model.encode(corpus, convert_to_tensor=True, show_progress_bar=True)
152
+
153
+ # At query time
154
+ query = "What are the CT findings in pulmonary embolism?"
155
+ query_embedding = model.encode(query, convert_to_tensor=True)
156
+
157
+ # Find top-k similar documents
158
+ cos_scores = util.cos_sim(query_embedding, corpus_embeddings)[0]
159
+ top_results = torch.topk(cos_scores, k=10)
160
+
161
+ for score, idx in zip(top_results[0], top_results[1]):
162
+ print(f"Score: {score:.4f} - {corpus[idx][:100]}...")
163
+ ```
164
+
165
+ ## Recommended: Full RadLITE Pipeline
166
+
167
+ For best results, use RadLIT-BiEncoder as the first stage followed by RadLIT-CrossEncoder for reranking:
168
+
169
+ ```python
170
+ from sentence_transformers import SentenceTransformer, CrossEncoder
171
+
172
+ # Stage 1: Bi-encoder retrieval
173
+ biencoder = SentenceTransformer('grai-rad/radlit-biencoder')
174
+
175
+ # Stage 2: Cross-encoder reranking
176
+ crossencoder = CrossEncoder('matulichpt/radlit-crossencoder')
177
+
178
+ # Retrieve candidates
179
+ query = "What are the MRI findings in anterior cruciate ligament tear?"
180
+ candidates = retrieve_with_biencoder(query, corpus, biencoder, top_k=50)
181
+
182
+ # Rerank with cross-encoder
183
+ pairs = [[query, doc] for doc in candidates]
184
+ scores = crossencoder.predict(pairs)
185
+
186
+ # Apply temperature calibration (recommended: T=1.5)
187
+ calibrated_scores = scores / 1.5
188
+
189
+ # Sort by calibrated scores
190
+ reranked = sorted(zip(candidates, calibrated_scores), key=lambda x: x[1], reverse=True)
191
+ ```
192
+
193
+ ## Intended Use
194
+
195
+ ### Primary Use Cases
196
+
197
+ - Radiology educational content retrieval
198
+ - Medical imaging literature search
199
+ - Clinical decision support (retrieval component)
200
+ - Radiology question-answering systems
201
+
202
+ ### Out-of-Scope Uses
203
+
204
+ - General web search
205
+ - Non-medical document retrieval
206
+ - Clinical diagnosis (this is a retrieval model, not a diagnostic tool)
207
+
208
+ ## Limitations
209
+
210
+ 1. **Domain Specificity**: Optimized for radiology; may underperform on general medical or non-medical content
211
+ 2. **Language**: English only
212
+ 3. **Subspecialty Variance**: Performance varies by subspecialty (0.69-0.94 MRR range)
213
+ 4. **Not a Diagnostic Tool**: This model retrieves relevant documents; it does not provide medical diagnoses
214
+
215
+ ## Ethical Considerations
216
+
217
+ - This model should not be used as a sole source for clinical decision-making
218
+ - Retrieved documents should be reviewed by qualified medical professionals
219
+ - The model may reflect biases present in radiology educational literature
220
+
221
+ ## Citation
222
+
223
+ ```bibtex
224
+ @software{radlit_biencoder_2026,
225
+ title = {RadLIT-BiEncoder: Domain-Specialized Embeddings for Radiology Retrieval},
226
+ author = {Grai Team},
227
+ year = {2026},
228
+ url = {https://huggingface.co/matulichpt/radlit-biencoder},
229
+ note = {MRR 0.829 on RadLIT-9 benchmark}
230
+ }
231
+ ```
232
+
233
+ ## License
234
+
235
+ Apache 2.0 - Free for research and commercial use.
236
+
237
+ ## Contact
238
+
239
+ For questions or collaboration: Open an issue on the model repository