Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
task_categories:
|
3 |
+
- question-answering
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
tags:
|
7 |
+
- medical
|
8 |
+
- question answering
|
9 |
+
- large language model
|
10 |
+
- retrieval-augmented generation
|
11 |
+
size_categories:
|
12 |
+
- 10M<n<100M
|
13 |
+
---
|
14 |
+
# The PubMed Corpus in MedRAG
|
15 |
+
|
16 |
+
This HF dataset contains the snippets from the PubMed corpus used in [MedRAG](https://arxiv.org/abs/2402.13178). It can be used for medical Retrieval-Augmented Generation (RAG).
|
17 |
+
|
18 |
+
## Dataset Details
|
19 |
+
|
20 |
+
### Dataset Descriptions
|
21 |
+
|
22 |
+
[PubMed](https://pubmed.ncbi.nlm.nih.gov/) is the most widely used literature resource, containing over 36 million biomedical articles.
|
23 |
+
For MedRAG, we use a PubMed subset of 23.9 million articles with valid titles and abstracts.
|
24 |
+
This HF dataset contains our ready-to-use snippets for the PubMed corpus, including 23,898,701 snippets with an average of 296 tokens.
|
25 |
+
|
26 |
+
### Dataset Structure
|
27 |
+
Each row is a snippet of PubMed, which includes the following features:
|
28 |
+
|
29 |
+
- id: a unique identifier of the snippet
|
30 |
+
- title: the title of the PubMed article from which the snippet is collected
|
31 |
+
- content: the abstract of the PubMed article from which the snippet is collected
|
32 |
+
- contents: a concatenation of 'title' and 'content', which will be used by the [BM25](https://github.com/castorini/pyserini) retriever
|
33 |
+
|
34 |
+
## Uses
|
35 |
+
|
36 |
+
<!-- Address questions around how the dataset is intended to be used. -->
|
37 |
+
|
38 |
+
### Direct Use
|
39 |
+
|
40 |
+
<!-- This section describes suitable use cases for the dataset. -->
|
41 |
+
|
42 |
+
```shell
|
43 |
+
git clone https://huggingface.co/datasets/MedRAG/pubmed
|
44 |
+
```
|
45 |
+
|
46 |
+
### Use in MedRAG
|
47 |
+
|
48 |
+
```python
|
49 |
+
>> from src.medrag import MedRAG
|
50 |
+
|
51 |
+
>> question = "A lesion causing compression of the facial nerve at the stylomastoid foramen will cause ipsilateral"
|
52 |
+
>> options = {
|
53 |
+
"A": "paralysis of the facial muscles.",
|
54 |
+
"B": "paralysis of the facial muscles and loss of taste.",
|
55 |
+
"C": "paralysis of the facial muscles, loss of taste and lacrimation.",
|
56 |
+
"D": "paralysis of the facial muscles, loss of taste, lacrimation and decreased salivation."
|
57 |
+
}
|
58 |
+
|
59 |
+
>> medrag = MedRAG(llm_name="OpenAI/gpt-3.5-turbo-16k", rag=True, retriever_name="MedCPT", corpus_name="PubMed")
|
60 |
+
>> answer, snippets, scores = medrag.answer(question=question, options=options, k=32) # scores are given by the retrieval system
|
61 |
+
```
|
62 |
+
|
63 |
+
## Citation
|
64 |
+
```shell
|
65 |
+
@article{xiong2024benchmarking,
|
66 |
+
title={Benchmarking Retrieval-Augmented Generation for Medicine},
|
67 |
+
author={Guangzhi Xiong and Qiao Jin and Zhiyong Lu and Aidong Zhang},
|
68 |
+
journal={arXiv preprint arXiv:2402.13178},
|
69 |
+
year={2024}
|
70 |
+
}
|
71 |
+
```
|