johnfebry chenxz commited on
Commit
b108bc7
·
verified ·
0 Parent(s):

Duplicate from chenxz/RareBench

Browse files

Co-authored-by: Xuanzhong Chen <chenxz@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
12
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
13
+ *.model filter=lfs diff=lfs merge=lfs -text
14
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
15
+ *.npy filter=lfs diff=lfs merge=lfs -text
16
+ *.npz filter=lfs diff=lfs merge=lfs -text
17
+ *.onnx filter=lfs diff=lfs merge=lfs -text
18
+ *.ot filter=lfs diff=lfs merge=lfs -text
19
+ *.parquet filter=lfs diff=lfs merge=lfs -text
20
+ *.pb filter=lfs diff=lfs merge=lfs -text
21
+ *.pickle filter=lfs diff=lfs merge=lfs -text
22
+ *.pkl filter=lfs diff=lfs merge=lfs -text
23
+ *.pt filter=lfs diff=lfs merge=lfs -text
24
+ *.pth filter=lfs diff=lfs merge=lfs -text
25
+ *.rar filter=lfs diff=lfs merge=lfs -text
26
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
27
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
29
+ *.tar filter=lfs diff=lfs merge=lfs -text
30
+ *.tflite filter=lfs diff=lfs merge=lfs -text
31
+ *.tgz filter=lfs diff=lfs merge=lfs -text
32
+ *.wasm filter=lfs diff=lfs merge=lfs -text
33
+ *.xz filter=lfs diff=lfs merge=lfs -text
34
+ # *.zip filter=lfs diff=lfs merge=lfs -text
35
+ *.zst filter=lfs diff=lfs merge=lfs -text
36
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
37
+ # Audio files - uncompressed
38
+ *.pcm filter=lfs diff=lfs merge=lfs -text
39
+ *.sam filter=lfs diff=lfs merge=lfs -text
40
+ *.raw filter=lfs diff=lfs merge=lfs -text
41
+ # Audio files - compressed
42
+ *.aac filter=lfs diff=lfs merge=lfs -text
43
+ *.flac filter=lfs diff=lfs merge=lfs -text
44
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
45
+ *.ogg filter=lfs diff=lfs merge=lfs -text
46
+ *.wav filter=lfs diff=lfs merge=lfs -text
47
+ # Image files - uncompressed
48
+ *.bmp filter=lfs diff=lfs merge=lfs -text
49
+ *.gif filter=lfs diff=lfs merge=lfs -text
50
+ *.png filter=lfs diff=lfs merge=lfs -text
51
+ *.tiff filter=lfs diff=lfs merge=lfs -text
52
+ # Image files - compressed
53
+ *.jpg filter=lfs diff=lfs merge=lfs -text
54
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
55
+ *.webp filter=lfs diff=lfs merge=lfs -text
56
+ mapping/phe2embedding.json filter=lfs diff=lfs merge=lfs -text
57
+ prompt_comparison_results.zip filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ configs:
3
+ - config_name: default
4
+ license: apache-2.0
5
+ task_categories:
6
+ - question-answering
7
+ language:
8
+ - en
9
+ tags:
10
+ - medical
11
+ size_categories:
12
+ - 1K<n<10K
13
+ viewer: false
14
+ ---
15
+
16
+ # RareBench [KDD2024 ADS Track]
17
+
18
+ **RareBench** is a pioneering benchmark designed to systematically evaluate the capabilities of LLMs on 4 critical dimensions within the realm of rare diseases.
19
+ Meanwhile, we have compiled the largest open-source dataset on rare disease patients, establishing a benchmark for future studies in this domain. To facilitate differential diagnosis of rare diseases, we develop a dynamic few-shot prompt methodology, leveraging a comprehensive rare disease knowledge graph synthesized from multiple knowledge bases, significantly enhancing LLMs’ diagnos-
20
+ tic performance. Moreover, we present an exhaustive comparative study of GPT-4’s diagnostic capabilities against those of specialist physicians. Our experimental findings underscore the promising potential of integrating LLMs into the clinical diagnostic process for rare diseases.
21
+
22
+ Github Repo for RareBench: https://github.com/chenxz1111/RareBench
23
+ Arxiv Paper for RareBench: https://arxiv.org/pdf/2402.06341.pdf
24
+
25
+
26
+
27
+ ## How to use it?
28
+
29
+ #### Loading Data
30
+
31
+ ```python
32
+ from datasets import load_dataset
33
+
34
+ datasets = ["RAMEDIS", "MME", "HMS", "LIRICAL", "PUMCH_ADM"]
35
+
36
+ for dataset in datasets:
37
+ data = load_dataset('chenxz/RareBench', dataset, split='test')
38
+ print(data)
39
+ ```
40
+
41
+ #### Data Format
42
+
43
+ ```json
44
+ {
45
+ "Phenotype": "The list of phenotypes presented in HPO codes",
46
+ "RareDisease": "The list of rare diseases code including OMIM, Orphanet and CCRD format",
47
+ "Department": "(Optional) Only provided in PUMCH_ADM"
48
+ }
49
+ ```
50
+
51
+ #### Evaluation
52
+
53
+ This repository provides data and mapping files for **RareBench**. Please refer to our [github](https://github.com/chenxz1111/RareBench) for further automated evaluation.
54
+
55
+
56
+ ## Source Data
57
+
58
+ #### Data Collection and statistics
59
+
60
+ This study categorizes datasets into two main groups: publicly available datasets and the Peking Union Medical College Hospital (PUMCH) datasets.
61
+
62
+ | Dataset | RAMEDIS | MME | HMS | LIRICAL | PUMCH_ADM |
63
+ | :---------------- | :------:| :------: |:------: | :-----------: |:--------: |
64
+ | Countries/Regions | Europe | Canada | Germany | Multi-Country | China |
65
+ | \#Cases | 624 | 40 | 88 | 370 | 75 |
66
+ | \#Disease | 74 | 17 | 39 | 252 | 16 |
67
+ | \#Department | N/A | N/A | N/A | N/A | 5 |
68
+ |\#Cases per disease| | | | | |
69
+ |--- Minimum | 1 | 1 | 1 | 1 | 3 |
70
+ |--- Median | 2 | 1 | 1 | 1 | 5 |
71
+ |--- Maximum |82 |11 |11 | 19 | 8 |
72
+ |\#HPO terms per case| | | | | |
73
+ |--- Minimum | 3 | 3 | 5 | 3 | 3 |
74
+ |--- Median | 9 | 10.5 | 17.5 | 11 | 16 |
75
+ |--- Maximum |46 |26 |54 | 95 | 47 |
76
+
77
+ > Note: The total number of cases in PUMCH is 1,650. We have currently only made public the 75 cases used in the Human versus LLMs experiment.
78
+
79
+ #### Data Processing
80
+
81
+ We apply reasonable filtering criteria to identify and remove cases of low quality that may be caused by recording errors or missing information, such as those with uncertain or imprecise diagnoses and those lacking sufficient relevant information, i.e., fewer than three phenotypes.
82
+
83
+ #### Personal and Sensitive Information
84
+
85
+ Doctors from PUMCH monitored all cases before uploading text information, ensuring the absence of any potential personal information leaks.
86
+
87
+ #### Mapping Files
88
+
89
+ Files in mapping directory, including:
90
+
91
+ `phenotype_mapping.json`: HPO phenotype code mapping to term name
92
+
93
+ `disease_mapping.json`: OMIM/Orphanet/CCRD code mapping to disease name
94
+
95
+ `ic_dict.json`: HPO phenotype terms' Information Content(IC) values obtained from HPO hierarchical structure
96
+
97
+ `phe2embedding.json`: HPO phenotype terms' 256 dimension embedding vectors learned by IC-based random walk
98
+
99
+ ## Citation
100
+ ```
101
+ @article{chen2024rarebench,
102
+ title={RareBench: Can LLMs Serve as Rare Diseases Specialists?},
103
+ author={Chen, Xuanzhong and Mao, Xiaohao and Guo, Qihan and Wang, Lun and Zhang, Shuyang and Chen, Ting},
104
+ journal={arXiv preprint arXiv:2402.06341},
105
+ year={2024}
106
+ }
107
+ ```
RareBench.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ import json
17
+ import os
18
+
19
+ import datasets
20
+
21
+
22
+ _DESCRIPTION = """\
23
+ RareBench is a pioneering benchmark designed to systematically evaluate the capabilities of LLMs within the realm of rare diseases.
24
+ """
25
+
26
+ _HOMEPAGE = "https://github.com/chenxz1111/RareBench"
27
+
28
+ _URL = r"https://huggingface.co/datasets/chenxz/RareBench/resolve/main/data.zip"
29
+
30
+ data_list = [
31
+ "RAMEDIS",
32
+ "HMS",
33
+ "MME",
34
+ "LIRICAL",
35
+ "PUMCH_ADM"
36
+ ]
37
+
38
+ class RareBenchConfig(datasets.BuilderConfig):
39
+ def __init__(self, **kwargs):
40
+ super().__init__(version=datasets.Version("1.0.0"), **kwargs)
41
+
42
+
43
+ class RareBench(datasets.GeneratorBasedBuilder):
44
+ BUILDER_CONFIGS = [
45
+ RareBenchConfig(
46
+ name=data_name,
47
+ )
48
+ for data_name in data_list
49
+ ]
50
+
51
+ def _info(self):
52
+ features = datasets.Features(
53
+ {
54
+ "Phenotype": [datasets.Value("string")],
55
+ "RareDisease": [datasets.Value("string")],
56
+ "Department": datasets.Value("string"),
57
+ }
58
+ )
59
+ return datasets.DatasetInfo(
60
+ description=_DESCRIPTION,
61
+ features=features,
62
+ homepage=_HOMEPAGE,
63
+ )
64
+
65
+ def _split_generators(self, dl_manager):
66
+ data_dir = dl_manager.download_and_extract(_URL)
67
+ data_name = self.config.name
68
+ return [
69
+ datasets.SplitGenerator(
70
+ name=datasets.Split.TEST,
71
+ gen_kwargs={
72
+ "filepath": os.path.join(
73
+ data_dir, "data", f"{data_name}.jsonl"
74
+ ),
75
+ },
76
+ )
77
+ ]
78
+
79
+ def _generate_examples(self, filepath):
80
+ with open(filepath, encoding="utf-8") as f:
81
+ for idx, line in enumerate(f):
82
+ key = f"{self.config.name}-{idx}"
83
+ item = json.loads(line)
84
+ yield key, {
85
+ "Phenotype": item["Phenotype"],
86
+ "RareDisease": item["RareDisease"],
87
+ "Department": item["Department"],
88
+ }
Task1_in_RareBench.zip ADDED
Binary file (22.8 kB). View file
 
data.zip ADDED
Binary file (32.4 kB). View file
 
mapping/disease_mapping.json ADDED
The diff for this file is too large to render. See raw diff
 
mapping/ic_dict.json ADDED
The diff for this file is too large to render. See raw diff
 
mapping/num.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "1": "first",
3
+ "2": "second",
4
+ "3": "third",
5
+ "4": "fourth",
6
+ "5": "fifth",
7
+ "6": "sixth",
8
+ "7": "seventh",
9
+ "8": "eighth",
10
+ "9": "ninth",
11
+ "10": "tenth"
12
+ }
mapping/phe2embedding.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:835633eabece9f2c039633b45f29584cd81cc274fccd767ab28e478ee2be5c03
3
+ size 148198311
mapping/phenotype_mapping.json ADDED
The diff for this file is too large to render. See raw diff
 
mapping/pumch_mdt_department.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "儿科": "Pediatrics",
3
+ "神经内科": "Neurology",
4
+ "心内(外)科": "Cardiology",
5
+ "肾内科": "Nephrology",
6
+ "血液科": "Hematology"
7
+ }
prompt_comparison_results.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1db8c85811665d2164e1e74857312d3bacbcb82be800c7131798ea8fb80bf7cd
3
+ size 2163729