finemed-fr / README.md
nbara's picture
Update README.md (#2)
44e02c6
|
Raw
History Blame Contribute Delete
15.8 kB
metadata
pretty_name: FineMed-fr
language:
  - fr
license:
  - odc-by
  - cc-by-sa-4.0
task_categories:
  - fill-mask
  - text-generation
size_categories:
  - 10M<n<100M
tags:
  - medical
  - healthcare
  - biomedical
  - clinical
  - french
  - pretraining
  - data-filtering
  - fineweb-2
  - finepdfs
  - finewiki
configs:
  - config_name: fineweb-2
    default: true
    data_files:
      - split: train
        path: data/fineweb-2/*.parquet
  - config_name: finepdfs
    data_files:
      - split: train
        path: data/finepdfs/*.parquet
  - config_name: finewiki
    data_files:
      - split: train
        path: data/finewiki/*.parquet

FineMed-fr

FineMed-fr: A large-scale French medical corpus annotated along multiple quality axes

🤗 Blog | 📄 Paper | 💻 Code | 🌐 FineMed | 🩺 DoctoBERT

📚 Introduction

FineMed-fr is a large, openly available corpus of French medical text for language-model pretraining: 21.1M documents and 19.2B words of real-world medical writing, annotated along several quality axes.

The corpus is drawn from three heterogeneous open-web sources (FineWeb-2, FinePDFs, and FineWiki), which together provide the scale, source diversity, and stylistic range that curated medical corpora often lack. We keep only the French medical content, then label every surviving document along three axes:

  • Subdomain: which of 15 medical subdomains the document belongs to, separating biomedical and clinical writing (e.g. scientific papers, clinical guidelines) from consumer-facing material (e.g. wellness blogs, commercial health pages).
  • Educational quality: how instructive the document is for medical education, scored 0–5 on an additive rubric adapted from FineWeb-Edu.
  • Medical-term density: the richness of medical terminology, measured as the fraction of characters that fall inside extracted medical-term spans.

We release the corpus unfiltered so you can set your own thresholds on the annotation columns to fit your task.

🆕 What's New

  • v1.0 (2026-06): first release.

🚀 How to Use

from datasets import load_dataset

ds = load_dataset("doctolib-lab/finemed-fr", split="train")  # fineweb-2 (default)
ds = load_dataset("doctolib-lab/finemed-fr", "finepdfs", split="train")
ds = load_dataset("doctolib-lab/finemed-fr", "finewiki", split="train")

Because the corpus is released unfiltered, downstream filtering is left to the user. For example, to retain only high-quality, term-dense documents:

filtered = ds.filter(
    lambda x: x["edu_quality_normalized_score"] >= 4 and x["medical_entity_density"] >= 0.10,
    num_proc=8,
)

🔧 Curation Pipeline

The three source corpora have already undergone standard LLM-pretraining curation upstream (language ID, heuristic quality filtering, deduplication), which we inherit as a quality baseline. Beyond this baseline, we apply two further steps:

  1. Medical prefiltering. Medical content constitutes only a small fraction of each source and is further diluted by commercial pages. We run a multilingual domain classifier (a DeBERTa-v3 covering 26 domains) over the first 512 tokens of each document and retain only those whose top-1 predicted label is Health, reducing each source to 5.3% of FineWeb-2, 7.7% of FinePDFs, and 1.5% of FineWiki (by document).

  2. Multi-axis annotation. Every retained document is then labeled by three dedicated lightweight annotators, each fine-tuned via two-stage knowledge distillation from LLM teachers (a smaller teacher providing high-volume supervision, followed by a larger teacher providing high-quality supervision):

    Distilling each annotator from its LLM teachers, rather than applying an LLM directly across the full corpus, reduces annotation cost by roughly an order of magnitude.

Subdomain. health_domain_classification_best_class is one of these 15 values:

subdomain description
Clinical cases & vignettes Single-patient narratives: presentation, evaluation, management, outcomes; case-based teaching.
Clinical guidelines & pathways Non-patient-specific recommendations, algorithms, and standards; named guidelines or consensus statements.
Patient education & lifestyle Consumer-facing explanations and how-to advice on prevention, self-care, symptoms, diet, fitness, mental well-being.
Wellness, supplements & CAM Botanicals, vitamins, supplements, complementary or alternative therapies outside mainstream clinical guidance.
Public health, policy & programs Population surveillance, epidemiology, screening, laws and regulation, financing and insurance, community guidance.
Commercial & promotional Marketing or sales content: pricing, booking, calls-to-action, affiliate/SEO, comparative ads, testimonials.
Drugs, trials & regulation Drug development and evaluation: clinical trials, approvals and labels, PK/PD, safety monitoring, pharmacovigilance.
Biomedical & mechanistic science Experimental or preclinical research: labs, omics, pathways, cell/animal models, assays, mechanisms.
Medical devices, diagnostics & imaging Device or modality descriptions and clinical use; diagnostics, wearables, sensors, imaging.
Health IT, telemedicine & operations EHR/EMR, data standards, interoperability, analytics, telemedicine, workflow, staffing, procurement, logistics.
Occupational health & safety Workplace hazards, exposures, PPE, training, and compliance with occupational regulations.
Health workforce education & training Professional curricula, CME, certification, simulation, residency/fellowship information.
Health services & facilities Neutral descriptions of care-delivery models, service lines, facility capabilities, long-term/residential care.
Other health Health-related content that is unclear or insufficient to classify under the other subdomains.
Others Not clearly health-related, too brief, or lacking detail (e.g. navigation/boilerplate).

Medical-term classes. medical_entities groups the extracted terms under these 8 keys (taxonomy adapted from UMLS):

class covers
disease disease, syndrome, infection, cancer, injury, symptom, clinical finding, mental disorder
drug prescription medication, vaccine, therapeutic compound, drug class, contrast agent
body_part organ, tissue, bone, muscle, blood vessel, nerve, cell, body fluid, anatomical region
medical_procedure surgery, diagnostic test, medical examination, laboratory test, imaging procedure
molecular_marker gene, protein, enzyme, receptor, genetic variant, biochemical analyte
clinical_device surgical tool, implant, prosthetic, diagnostic scanner, monitoring equipment
vital_function heart rate, blood pressure, respiratory rate, temperature, oxygen saturation
living_beings bacterium, virus, fungus, parasite, pathogen, model organism

Educational quality. edu_quality_normalized_score runs from 0 (not useful) to 5 (excellent) for medical education; edu_quality_score is the raw value before rounding. The exact rubric used to prompt the LLM annotators is in edu_quality_annotation_prompt.txt.

📊 Dataset Statistics

Each source is provided as a separate config. Per-source statistics:

config source documents words median words/doc
fineweb-2 FineWeb-2 (fra_Latn) 18,888,234 12.03 B 346
finepdfs FinePDFs (fra_Latn) 2,137,275 7.16 B 766
finewiki FineWiki (frwiki) 38,620 26.55 M 283
total 21,064,129 19.21 B 369

Annotation values vary substantially across subdomains. Distribution of educational-quality scores across the 15 subdomains:

Educational quality by subdomain

Distribution of medical-term density across the same subdomains:

Medical-term density by subdomain

Per-source versions of both plots are available in assets/.

📋 Data Fields

All configs share these columns:

column type description
text string document text
id string source document id (matches the id in the source dataset)
url string source URL
num_words int64 whitespace word count
domain_classification_best_class / _best_score / _scores string / double / list prefilter domain classifier output (the medical subset is Health)
health_domain_classification_best_class / _best_score / _scores string / double / list 15-class medical-subdomain classifier output
edu_quality_score / edu_quality_normalized_score double / int64 educational-quality scorer (FineWeb-Edu rubric adapted to medicine); raw score and its 0–5 rounded form
medical_entities struct extracted medical terms grouped into 8 classes; each class is a deduplicated list of surface strings
medical_entity_density float fraction of characters covered by those terms, measured over the document's middle 512-token window (or the whole document when it is shorter than 512 tokens)

Source-specific provenance columns:

  • fineweb-2: dump, date, file_path, language, language_score, language_script, minhash_cluster_size, top_langs
  • finepdfs: dump, date, file_path, offset, token_count, language, page_average_lid, page_average_lid_score, full_doc_lid, full_doc_lid_score, per_page_languages, is_truncated, extractor, page_ends
  • finewiki: wikiname, page_id, title, date_modified, in_language, wikidata_id, bytes_html, wikitext, version, infoboxes, has_math

Example record. A full fineweb-2 row (provenance columns differ for the other configs):

{
  "text": "Attention L'actualité thérapeutique sur le VIH évolue rapidement ... Pneumopathie bactérienne chez les patients infectés par le VIH ...",
  "id": "<urn:uuid:2cc73ad5-d0ae-483c-8b59-78147734bcb8>",
  "dump": "CC-MAIN-2014-10",
  "url": "http://www.actions-traitements.org/spip.php?article1961",
  "date": "2014-03-10T06:59:32Z",
  "file_path": "s3://commoncrawl/crawl-data/CC-MAIN-2014-10/segments/.../CC-MAIN-...-00091-....warc.gz",
  "language": "fra",
  "language_score": 0.9974,
  "language_script": "Latn",
  "minhash_cluster_size": 7,
  "top_langs": "{}",
  "domain_classification_scores": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
  "domain_classification_best_class": "Health",
  "domain_classification_best_score": 1.0,
  "num_words": 600,
  "health_domain_classification_scores": [0.0092, 0.0349, 0.832, 0.0, 0.0267, 0.0, 0.0001, 0.0001, 0.0001, 0.0, 0.0001, 0.0, 0.0043, 0.0933, 0.0],
  "health_domain_classification_best_class": "Clinical guidelines & pathways",
  "health_domain_classification_best_score": 0.832,
  "edu_quality_score": 4.75,
  "edu_quality_normalized_score": 5,
  "medical_entities": {
    "disease": ["pneumonie", "méningites", "fièvre", "sida", "..."],
    "drug": ["traitement antirétroviral"],
    "body_part": [], "medical_procedure": [], "molecular_marker": [],
    "clinical_device": [], "vital_function": [],
    "living_beings": ["Streptococcus pneumoniae", "Klebsiella pneumoniae", "VIH", "..."]
  },
  "medical_entity_density": 0.242
}

(a real FineWeb-2 row; text, file_path, and entity lists trimmed for display)

⚖️ Licensing

FineMed-fr inherits the licenses of its source datasets:

  • fineweb-2 and finepdfs: ODC-BY 1.0 (as in the upstream FineWeb releases)
  • finewiki: CC BY-SA 4.0 (derived from Wikipedia)

⚠️ Considerations

FineMed-fr consists of public text from the web, PDFs, and Wikipedia, restricted to medical content. As real-world web data, it may contain personal information, and medical pages may reference protected health information. All such content was already publicly accessible, and we did not remove or mask it. The corpus has not been clinically validated and does not constitute medical advice. Users handling personal or health data should perform de-identification before use.

🏛️ Acknowledgments

This work was granted access to the HPC resources of IDRIS (Jean Zay) under the allocations 2025-AD011016291 and 2026-A0200617487 made by GENCI.