LUMEN-rag-data / README.md
mohamedkhaledmk7's picture
Update README.md
f2ac821 verified
|
Raw History Blame Contribute Delete
9.47 kB
metadata
license: other
license_name: see-source-terms
task_categories:
  - text-retrieval
  - question-answering
language:
  - en
tags:
  - biomedical
  - pubmed
  - retrieval-augmented-generation
  - oncology
  - embeddings
  - benchmark
size_categories:
  - 10K<n<100K

LUMEN RAG Data

A chunked biomedical passage corpus with aligned precomputed embeddings and relevance judgments, built as the retrieval layer for LUMEN, the AI service behind the MediLink healthcare platform.

The corpus covers oncology literature drawn from PubMed and PMC, chunked for retrieval and paired with dense vectors from a biomedical bi-encoder. It ships with pooled relevance judgments for 30 queries, so retrieval quality can be measured on it directly. It's published so the retrieval stage of the system is reproducible without re-running ingestion or re-encoding 77K passages.

Files

File Size Contents
SpubMedBERT_chunks.json 60.2 MB 77,649 chunk records with metadata
embeddings_spubmedbert.npy 116 MB float16 array, shape (77649, 768)
qrels/lumen_qrels.tsv 9.6 kB Relevance judgments, TREC format
qrels/lumen_queries.jsonl 3.2 kB 30 queries with intent tags
qrels/lumen_pool.json 9.5 kB Pool composition and judging config

The corpus and embedding files are aligned row for row. Row i of the .npy is the embedding of chunk i in the JSON. Any filtering has to be applied to both together.

Schema

Field Type Description
text string Chunk text, 41–14,500 characters
pmid string PubMed identifier of the source article
pmcid string PMC identifier, empty when the article isn't in PMC
title string Source article title
keyword string Ingestion query that retrieved the article (13 classes)
source string Origin of the text, e.g. full_text (6 classes)
chunk_type string general or symptom

Topic distribution

The corpus was built by querying PubMed with 13 keyword strings. Five account for most of its mass:

Chunks Ingestion keyword
13,656 melanoma diagnosis clinical features
13,489 skin cancer types symptoms treatment
13,287 squamous cell carcinoma symptoms
12,852 multiple myeloma diagnosis signs
12,825 basal cell carcinoma signs symptoms
4,337 melanoma prevention UV protection
6,738 eight lower frequency keyword variants

Chunks are stored in ingestion order, so passages on the same topic occupy contiguous index ranges.

Embeddings

  • Model: pritamdeka/S-PubMedBert-MS-MARCO
  • Dimension: 768
  • Dtype: float16. Cast to float32 before matrix operations; float16 matmul is slow on CPU and loses precision at this scale
  • Normalization: vectors are stored unnormalized; L2 normalize before cosine similarity

Usage

import json
import numpy as np
from huggingface_hub import hf_hub_download

REPO = "mohamedkhaledmk7/LUMEN-rag-data"

chunks_path = hf_hub_download(REPO, "SpubMedBERT_chunks.json", repo_type="dataset")
embed_path  = hf_hub_download(REPO, "embeddings_spubmedbert.npy", repo_type="dataset")

with open(chunks_path) as f:
    chunks = json.load(f)

E = np.load(embed_path).astype("float32")
E /= np.linalg.norm(E, axis=1, keepdims=True) + 1e-12

assert E.shape[0] == len(chunks), "chunks and embeddings are misaligned"

Retrieval with the same encoder:

from sentence_transformers import SentenceTransformer

encoder = SentenceTransformer("pritamdeka/S-PubMedBert-MS-MARCO")
q = encoder.encode(["What is the ABCDE rule for melanoma detection?"],
                   normalize_embeddings=True)

scores = (q @ E.T)[0]
for i in np.argsort(-scores)[:5]:
    print(f"{scores[i]:.3f}  {chunks[i]['title'][:70]}")

Exact search over 77K vectors is a single dot product, no vector database required. The production system uses Weaviate for hybrid BM25 + dense retrieval, but that's a serving choice, not a requirement of the data.

Evaluation labels (qrels/)

Relevance judgments for 30 oncology queries, so nDCG, Recall@K, and MRR can be computed on this corpus the same way they're computed on labeled benchmarks like BEIR.

How they were built. Five retrieval configurations (dense only, MedCPT cross-encoder, and Cohere rerank-v3.5 / v4.0-fast / v4.0-pro) each contributed their top 10 per query over a shared top 100 candidate set. The union of all five, about 732 unique passages, roughly 25 per query after deduplication, was judged on a 0 to 3 relevance scale. Pooling from all five systems equally matters here: a pool drawn from a single reranker would score that reranker highly by construction.

Judging. Claude Haiku (claude-haiku-4-5-20251001), graded 0 to 3, following TREC assessment practice. The judge saw only a query and a passage, never which system retrieved it or at what rank. Pool order was shuffled per query too, so position carried no signal either.

Grade Meaning Share
3 Directly and substantially answers the query 33.1%
2 Partially answers the query 32.1%
1 On topic but doesn't answer the query 26.4%
0 Off topic 8.5%

Following BEIR convention, lumen_qrels.tsv only contains positive judgments. A (query, passage) pair that's absent from the file is non-relevant. The full judged pool, including grade-0 passages, is recorded in lumen_pool.json.

Reliability. A random 10% sample was re-judged across four independent runs: exact agreement 67 to 70%, within one grade agreement 98 to 100%. Disagreement is confined to adjacent grades. The judge separates relevant from irrelevant reliably, with some remaining uncertainty on the partial versus full answer boundary.

Loading:

from collections import defaultdict
from huggingface_hub import hf_hub_download

path = hf_hub_download(REPO, "qrels/lumen_qrels.tsv", repo_type="dataset")

qrels = defaultdict(dict)
with open(path) as f:
    next(f)                                   # header
    for line in f:
        qid, did, score = line.rstrip("\n").split("\t")
        qrels[qid][did] = int(score)          # did indexes into chunks / E

corpus-id is the integer row index into SpubMedBERT_chunks.json and the .npy, not a PMID.

Known properties of these labels

  • LLM generated, not human. Weaker evidence than a hand-annotated benchmark like NFCorpus. Report results on this dataset separately from human-labeled benchmarks rather than averaging the two together.
  • Pooling bias. A relevant passage that no pooled system ranked in its top 10 was never judged, and counts as non-relevant. Recall measured against these qrels only reflects what these five systems found. A sixth system evaluated later is mildly disadvantaged if it surfaces something all five missed. This is inherent to pooled evaluation, not specific to this dataset.
  • Queries are corpus derived. They were written against the corpus's known topic distribution, so nearly all of them are answerable. Absolute scores run higher than they would on real production traffic, where some questions have no good answer. System comparisons stay valid though, since every system faces the same conditions.
  • One query is a known hard case. LQ011 ("histological subtypes of cutaneous squamous cell carcinoma") draws half its pool from grade 0 passages spread across the full corpus index range. The corpus's squamous cell keyword is symptom oriented and carries little histopathology content. It's kept in deliberately, as a case where retrieval genuinely fails.

How it was used

In LUMEN, this corpus is served through Weaviate with intent aware hybrid retrieval (BM25 blended with dense, alpha = 0.60 by default and varied per query intent), followed by cross-encoder reranking with ncbi/MedCPT-Cross-Encoder and citation grounded generation.

Limitations

  • Scope. Oncology focused, driven by the 13 ingestion keywords. It's not a general biomedical corpus and will retrieve poorly outside its topics.
  • Keyword match drift. Ingestion matched on keyword strings, so some articles are topical false positives: oesophageal squamous cell carcinoma, hepatocellular carcinoma, CAR-T for rheumatoid arthritis. These act as genuine distractors in retrieval evaluation.
  • Chunk boundaries. Chunks are contiguous spans and some begin mid-sentence, carrying a trailing fragment of the previous chunk.
  • Not clinical guidance. Research literature, retrieved by keyword, not reviewed for clinical accuracy or currency. Not suitable for medical decision-making.

Licensing

Content is derived from PubMed abstracts and PMC articles. Terms vary per article: the PMC Open Access Subset carries per-article Creative Commons or similar licenses, while other PMC content is more restricted. Consult the terms for the underlying articles via the pmid / pmcid fields before redistributing or using commercially.

Citation

@misc{khaled2026lumen,
  title  = {LUMEN RAG Data: A Biomedical Passage Corpus with Aligned Embeddings
            and Pooled Relevance Judgments},
  author = {Mohamed Khaled},
  year   = {2026},
  url    = {https://huggingface.co/datasets/mohamedkhaledmk7/LUMEN-rag-data}
}