MedRAG commited on
Commit
f48d525
1 Parent(s): 02d1a55

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +72 -0
README.md ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Wikipedia Corpus in MedRAG
15
+
16
+ This HF dataset contains the chunked snippets from the Wikipedia 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
+ As a large-scale open-source encyclopedia, Wikipedia is frequently used as a corpus in information retrieval tasks.
23
+ We select Wikipedia as one of the corpora to see if the general domain database can be used to improve the ability of medical QA.
24
+ We downloaded the processed Wikipedia data from [HuggingFace](https://huggingface.co/datasets/wikipedia) and chunked the text using [LangChain](https://www.langchain.com/) as snippets with no more than 1000 characters.
25
+ This HF dataset contains our ready-to-use chunked snippets for the Wikipedia corpus, including 29,913,202 snippets with an average of 162 tokens.
26
+
27
+ ### Dataset Structure
28
+ Each row is a snippet of Wikipedia, which includes the following features:
29
+
30
+ - id: a unique identifier of the snippet
31
+ - title: the title of the Wikipedia article from which the snippet is collected
32
+ - content: the content of the snippet
33
+ - contents: a concatenation of 'title' and 'content', which will be used by the [BM25](https://github.com/castorini/pyserini) retriever
34
+
35
+ ## Uses
36
+
37
+ <!-- Address questions around how the dataset is intended to be used. -->
38
+
39
+ ### Direct Use
40
+
41
+ <!-- This section describes suitable use cases for the dataset. -->
42
+
43
+ ```shell
44
+ git clone https://huggingface.co/datasets/MedRAG/wikipedia
45
+ ```
46
+
47
+ ### Use in MedRAG
48
+
49
+ ```python
50
+ >> from src.medrag import MedRAG
51
+
52
+ >> question = "A lesion causing compression of the facial nerve at the stylomastoid foramen will cause ipsilateral"
53
+ >> options = {
54
+ "A": "paralysis of the facial muscles.",
55
+ "B": "paralysis of the facial muscles and loss of taste.",
56
+ "C": "paralysis of the facial muscles, loss of taste and lacrimation.",
57
+ "D": "paralysis of the facial muscles, loss of taste, lacrimation and decreased salivation."
58
+ }
59
+
60
+ >> medrag = MedRAG(llm_name="OpenAI/gpt-3.5-turbo-16k", rag=True, retriever_name="MedCPT", corpus_name="Wikipedia")
61
+ >> answer, snippets, scores = medrag.answer(question=question, options=options, k=32) # scores are given by the retrieval system
62
+ ```
63
+
64
+ ## Citation
65
+ ```shell
66
+ @article{xiong2024benchmarking,
67
+ title={Benchmarking Retrieval-Augmented Generation for Medicine},
68
+ author={Guangzhi Xiong and Qiao Jin and Zhiyong Lu and Aidong Zhang},
69
+ journal={arXiv preprint arXiv:2402.13178},
70
+ year={2024}
71
+ }
72
+ ```