redcourage commited on
Commit
4edb990
·
verified ·
1 Parent(s): f849303

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +216 -25
README.md CHANGED
@@ -1,25 +1,216 @@
1
- ---
2
- license: apache-2.0
3
- configs:
4
- - config_name: default
5
- data_files:
6
- - split: train
7
- path: data/train-*
8
- - split: test_1k
9
- path: data/test_1k-*
10
- dataset_info:
11
- features:
12
- - name: id
13
- dtype: int64
14
- - name: emb
15
- list: float64
16
- splits:
17
- - name: train
18
- num_bytes: 2464462260
19
- num_examples: 400335
20
- - name: test_1k
21
- num_bytes: 6156000
22
- num_examples: 1000
23
- download_size: 1903324645
24
- dataset_size: 2470618260
25
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ task_categories:
4
+ - text-retrieval
5
+ - sentence-similarity
6
+ language:
7
+ - en
8
+ tags:
9
+ - embeddings
10
+ - pubmed
11
+ - arxiv
12
+ - scientific-papers
13
+ - vector-database
14
+ - benchmark
15
+ - embedding-gemma
16
+ size_categories:
17
+ - 100K<n<1M
18
+ ---
19
+
20
+ # PubMed & arXiv Abstract Embeddings for Vector Database Benchmarking
21
+
22
+ ## Dataset Description
23
+
24
+ This dataset contains pre-computed embeddings of scientific paper abstracts from PubMed and arXiv, designed for evaluating vector database performance. The embeddings are generated using Google's EmbeddingGemma-300M model.
25
+
26
+ ### Purpose
27
+
28
+ Benchmark dataset for evaluating vector database performance, specifically designed for use with [VectorDBBench](https://github.com/zilliztech/VectorDBBench).
29
+
30
+ ### Dataset Summary
31
+
32
+ - **Total Training Samples**: 400,335
33
+ - **Test Queries**: 1,000
34
+ - **Ground Truth**: Top-1000 nearest neighbors per query
35
+ - **Embedding Dimension**: 768
36
+ - **Embedding Model**: [google/embeddinggemma-300m](https://huggingface.co/google/embeddinggemma-300m)
37
+ - **Source Data**: [brainchalov/pubmed_arxiv_abstracts_data](https://huggingface.co/datasets/brainchalov/pubmed_arxiv_abstracts_data)
38
+
39
+ ## Dataset Structure
40
+
41
+ ### Data Splits
42
+
43
+ | Split | Samples | Description |
44
+ |-------|---------|-------------|
45
+ | `train` | 400,335 | Training embeddings (80% random sample from source) |
46
+ | `test_1k` | 1,000 | Test query embeddings (from remaining 20%, non-overlapping) |
47
+ | `ground_truth_1k.parquet` | 1,000 | Top-1000 nearest neighbors for each test query |
48
+
49
+ ### Data Fields
50
+
51
+ #### train & test_1k
52
+ - `id` (int64): Unique identifier for each paper
53
+ - `emb` (List[float64]): 768-dimensional L2-normalized embedding vector
54
+
55
+ #### ground_truth_1k.parquet
56
+ - `id` (int64): Query identifier (matches test_1k)
57
+ - `neighbors_id` (List[int64]): List of 1000 nearest neighbor IDs from train set
58
+
59
+ ## Dataset Creation
60
+
61
+ ### Source Data
62
+
63
+ The dataset is derived from approximately 500K scientific abstracts from PubMed and arXiv:
64
+ - **Train**: 80% random sample (400,335 papers)
65
+ - **Test**: 1,000 papers randomly sampled from remaining 20% (non-overlapping with train)
66
+
67
+ ### Preprocessing
68
+
69
+ 1. **Text Preparation**: Concatenated title + abstract for each paper
70
+ 2. **Chunking**: For texts exceeding 2048 tokens:
71
+ - Split into chunks with ~50 token overlap
72
+ - Embedded each chunk separately
73
+ - Averaged chunk embeddings for final representation
74
+ 3. **Normalization**: All embeddings are L2-normalized
75
+
76
+ ### Embedding Generation
77
+
78
+ - **Model**: [google/embeddinggemma-300m](https://huggingface.co/google/embeddinggemma-300m)
79
+ - **Dimension**: 768
80
+ - **Max Token Length**: 2048
81
+ - **Normalization**: L2-normalized
82
+
83
+ ### Ground Truth Generation
84
+
85
+ Ground truth nearest neighbors were computed using:
86
+ - **Method**: Flat search (brute-force)
87
+ - **Metric**: Cosine similarity
88
+ - **K**: Top-1000 neighbors per query
89
+
90
+ ## Usage
91
+
92
+ ### Loading the Dataset
93
+ ```python
94
+ from datasets import load_dataset
95
+ import pandas as pd
96
+
97
+ # Load train and test splits
98
+ dataset = load_dataset("redcourage/pubmed-arxiv-abstract-embedding-gemma-300m")
99
+ train = dataset['train']
100
+ test = dataset['test_1k']
101
+
102
+ # Load ground truth
103
+ ground_truth = pd.read_parquet(
104
+ "hf://datasets/redcourage/pubmed-arxiv-abstract-embedding-gemma-300m/ground_truth_1k.parquet"
105
+ )
106
+ ```
107
+
108
+ ### Evaluation Example
109
+ ```python
110
+ import numpy as np
111
+ from datasets import load_dataset
112
+ import pandas as pd
113
+
114
+ # Load data
115
+ dataset = load_dataset("redcourage/pubmed-arxiv-abstract-embedding-gemma-300m")
116
+ train_data = dataset['train']
117
+ test_data = dataset['test_1k']
118
+ ground_truth = pd.read_parquet(
119
+ "hf://datasets/redcourage/pubmed-arxiv-abstract-embedding-gemma-300m/ground_truth_1k.parquet"
120
+ )
121
+
122
+ # Convert to numpy arrays
123
+ train_embeddings = np.array(train_data['emb'])
124
+ test_embeddings = np.array(test_data['emb'])
125
+
126
+ # Example: Compute recall@10
127
+ def compute_recall_at_k(retrieved_ids, ground_truth_ids, k=10):
128
+ """
129
+ Compute Recall@K
130
+
131
+ Args:
132
+ retrieved_ids: List of retrieved neighbor IDs
133
+ ground_truth_ids: List of ground truth neighbor IDs
134
+ k: Number of top results to consider
135
+ """
136
+ retrieved_k = set(retrieved_ids[:k])
137
+ ground_truth_k = set(ground_truth_ids[:k])
138
+
139
+ if len(ground_truth_k) == 0:
140
+ return 0.0
141
+
142
+ return len(retrieved_k & ground_truth_k) / len(ground_truth_k)
143
+
144
+ # Use with your vector database
145
+ # ... insert your vector DB search code here ...
146
+ ```
147
+
148
+ ### VectorDBBench Integration
149
+
150
+ This dataset is compatible with [VectorDBBench](https://github.com/zilliztech/VectorDBBench) for benchmarking vector databases like:
151
+ - Milvus
152
+ - Qdrant
153
+ - Weaviate
154
+ - Pinecone
155
+ - FAISS
156
+ - And more...
157
+
158
+ ## Use Cases
159
+
160
+ - 🔍 Vector database performance benchmarking
161
+ - 📊 Approximate nearest neighbor (ANN) algorithm evaluation
162
+ - 🎯 Retrieval system testing on scientific literature
163
+ - ⚡ Latency and throughput testing for semantic search
164
+ - 📈 Recall@K metric computation
165
+
166
+ ## Limitations
167
+
168
+ - **Domain-Specific**: Optimized for scientific/biomedical text; may not generalize to other domains
169
+ - **Language**: English only
170
+ - **Temporal Coverage**: Limited to papers available in the source dataset
171
+ - **Chunking Strategy**: Long documents are averaged, which may lose fine-grained information
172
+ - **Ground Truth**: Based on cosine similarity with embeddings, not human relevance judgments
173
+
174
+ ## License
175
+
176
+ Apache 2.0 (same as source dataset)
177
+
178
+ ## Citation
179
+
180
+ If you use this dataset, please cite:
181
+ ```bibtex
182
+ @dataset{pubmed_arxiv_embeddings_gemma,
183
+ author = {redcourage},
184
+ title = {PubMed & arXiv Abstract Embeddings for Vector Database Benchmarking},
185
+ year = {2025},
186
+ publisher = {Hugging Face},
187
+ url = {https://huggingface.co/datasets/redcourage/pubmed-arxiv-abstract-embedding-gemma-300m}
188
+ }
189
+ ```
190
+
191
+ ### Source Dataset Citation
192
+ ```bibtex
193
+ @dataset{pubmed_arxiv_abstracts,
194
+ author = {brainchalov},
195
+ title = {PubMed ArXiv Abstracts Data},
196
+ year = {2024},
197
+ publisher = {Hugging Face},
198
+ url = {https://huggingface.co/datasets/brainchalov/pubmed_arxiv_abstracts_data}
199
+ }
200
+ ```
201
+
202
+ ### Embedding Model Citation
203
+ ```bibtex
204
+ @misc{embeddinggemma,
205
+ title={Embedding Gemma},
206
+ author={Google},
207
+ year={2024},
208
+ url={https://huggingface.co/google/embeddinggemma-300m}
209
+ }
210
+ ```
211
+
212
+ ## Acknowledgments
213
+
214
+ - Original dataset: [brainchalov/pubmed_arxiv_abstracts_data](https://huggingface.co/datasets/brainchalov/pubmed_arxiv_abstracts_data)
215
+ - Embedding model: [google/embeddinggemma-300m](https://huggingface.co/google/embeddinggemma-300m)
216
+ - Benchmark framework: [VectorDBBench](https://github.com/zilliztech/VectorDBBench)