MedRAG commited on
Commit
274da28
1 Parent(s): d6d1d71

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
+ - 100K<n<1M
13
+ ---
14
+ # The Textbooks Corpus in MedRAG
15
+
16
+ This HF dataset contains the chunked snippets from the Textbooks 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
+ [Textbooks](https://github.com/jind11/MedQA) is a collection of 18 widely used medical textbooks, which are important references for students taking the United States Medical Licensing Examination (USLME).
23
+ In MedRAG, the textbooks are processed as chunks with no more than 1000 characters.
24
+ We used the RecursiveCharacterTextSplitter from [LangChain](https://www.langchain.com/) to perform the chunking.
25
+ This HF dataset contains our ready-to-use chunked snippets for the Textbooks corpus, including 125,847 snippets with an average of 182 tokens.
26
+
27
+ ### Dataset Structure
28
+ Each row is a snippet of Textbooks, which include the following features:
29
+
30
+ - id: a unique identifier of the snippet
31
+ - title: the title of the textbook 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/textbooks
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="Textbooks")
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
+ ```