RareDisGraph-AgenticAI pairs a curated rare disease knowledge graph with a single open-weight language model to prioritize diagnoses from clinical cases β all on your own hardware, no patient data ever leaves the machine.
Fig. 1 β Full pipeline: multimodal evidence extraction β KG-grounded scoring β LLM reranking β ranked diagnostic output.
π Paper Β· ποΈ RareDisGraph KG Β· π Issues Β· βοΈ Contact
- Overview
- Key Features
- System Requirements
- Installation
- Download Required Files
- Configuration
- Running the Pipeline
- Input Formats
- Output Format
- Evaluation
- Privacy & PHI Compliance
- Citation
- Contact
Matching a patient to one of more than 7,000 rare diseases requires weighing phenotype specificity, inheritance patterns, hallmark features, differential-diagnosis rules and family history β all at once. Most software handles only one of these.
RareDisGraph-AgenticAI integrates all of them in a single local pipeline:
- Extract β A set of agents powered by a single open-weight LLM reads the clinical case and extracts HPO terms, family history, demographics and genetic evidence directly from free text. No pre-curated HPO terms required.
- Score β Candidates are scored against RareDisGraph, a MONDO-anchored knowledge graph built from GeneReviews, OMIM and Orphanet (15,817 diseases Β· 387,060 HPO-linked phenotype assertions Β· 67,234 differential-diagnosis edges) using an information-content-weighted composite score that mirrors how a geneticist thinks.
- Rerank β The same LLM audits the top 30 candidates against their RareDisGraph entries, runs pairwise comparisons using the graph's differential-diagnosis edges, and produces a PageRank-aggregated reranked list.
- Output β A ranked top-10 list with a traceable evidence scorecard for each candidate.
| Feature | Description |
|---|---|
| π Fully local | All inference runs on your own GPU β no API calls, no data transmission |
| π PHI-safe | Patient data never leaves your machine |
| π Free-text input | Accepts raw clinical notes directly β no pre-curated HPO terms needed |
| 𧬠Knowledge-graph grounded | Scoring and reranking use RareDisGraph, not unconstrained model knowledge |
| π¨βπ©βπ§ Family history & demographics | Parses pedigree patterns and infers inheritance priors automatically |
| πΌοΈ Multimodal | Optional facial photograph β HPO terms via vision-language model |
| π§ͺ VCF support | Optional genomic variant input adds gene-level evidence |
| β‘ Fast | ~4β5 min per case on a single A100-40GB with Qwen3-8B |
| π Interpretable | Every output includes the graph features and audit notes that drove each rank |
| Component | Qwen3-8B (default) | MedGemma-27B |
|---|---|---|
| GPU | 1Γ A100 40 GB | 1Γ H100 80 GB |
| RAM | 32 GB | 64 GB |
| Python | 3.9+ | 3.9+ |
| CUDA | 11.8+ | 12.1+ |
| OS | Linux (Ubuntu 20.04+) | Linux (Ubuntu 20.04+) |
No quantization is used. Both backbones run at full precision on the stated hardware.
git clone https://github.com/WGLab/RareDisGraph-MultiAgentLLM.git
cd RareDisGraph-MultiAgentLLMpython -m venv venv
source venv/bin/activatepip install -r requirements.txt
pip install -e .If you encounter CUDA version conflicts with vLLM, follow the vLLM installation guide for your specific CUDA version.
# Download the RareDisGraph KG (~2 GB)
wget -O data/RareDisGraph.pkl \
https://github.com/WGLab/RareDisGraph-Extraction/releases/download/v1.0/RareDisGraph.pklThe download link will be live upon publication. Contact us to request early access.
# Human Phenotype Ontology
wget -O data/hp.obo \
https://github.com/obophenotype/human-phenotype-ontology/releases/latest/download/hp.obo
# MONDO disease ontology
wget -O data/mondo.obo \
https://github.com/monarch-initiative/mondo/releases/latest/download/mondo.obols -lh data/
# RareDisGraph.pkl ~2.0 GB
# hp.obo ~200 MB
# mondo.obo ~150 MBCopy the default config and edit as needed:
cp configs/default_config.yaml configs/my_config.yamlKey fields:
model:
backbone: "Qwen/Qwen3-8B" # or "google/medgemma-27b-it"
gpu_memory_utilization: 0.90
max_model_len: 16384
paths:
RareDisGraph_path: "data/RareDisGraph.pkl"
hpo_obo_path: "data/hp.obo"
mondo_obo_path: "data/mondo.obo"
scoring:
graph_blend_weight: 0.65 # 65% KG score + 35% reranked score
top_k_candidates: 100
top_k_rerank: 30
pipeline:
use_family_history: true
use_demographics: true
use_vision: false # set true if facial photos provided
use_vcf: false # set true if VCF providedpython scripts/run_pipeline.py \
--input data/examples/case.txt \
--config configs/my_config.yaml \
--output results/output.jsonpython scripts/run_pipeline.py \
--input data/examples/case.txt \
--image data/examples/face.jpg \
--vcf data/examples/variants.vcf \
--config configs/my_config.yaml \
--output results/output.jsonpython scripts/run_batch.py \
--input_dir data/cohorts/HMS/ \
--config configs/my_config.yaml \
--output_dir results/HMS/ \
--n_workers 4The pipeline accepts several input types. See data/examples/{modality} for templates.
Patient is a 6-year-old male referred for evaluation of global developmental delay, autistic features and seizures. Born to non-consanguineous parents. He sat independently at 12 months and walked at 28 months. No speech. Exam shows microcephaly (HC -2.8 SD), hypotonia and bilateral simian creases. Family history: a maternal cousin has a similar presentation.
HP:0001249; HP:0000729; HP:0001250; HP:0000252; HP:0001290; HP:0000316
Provide a frontal facial photograph. The vision agent converts it into HPO terms automatically and merges them with any text-derived phenotypes before scoring.
python scripts/run_pipeline.py \
--input data/examples/case.txt \
--image data/examples/face.png \
--config configs/my_config.yaml \
--output results/output.jsonA VCF file adds gene-level evidence. The pipeline extracts candidate genes from the variant calls and adds a gene-evidence bonus to candidates whose causal genes overlap.
python scripts/run_pipeline.py \
--input data/examples/case.txt \
--vcf data/examples/variants.vcf \
--config configs/my_config.yaml \
--output results/output.jsonAll input types can be combined. For example, a text note + HPO terms + facial photo + VCF can all be passed together and the pipeline will merge the evidence from each source before scoring.
Each run produces a JSON file with the top-10 ranked diagnoses and a full evidence scorecard per candidate:
{
"patient_id": "CASE_001",
"top_diagnoses": [
{
"rank": 1,
"mondo_id": "MONDO:0010726",
"disease_name": "Angelman syndrome",
"gene": "UBE3A",
"kg_score": 0.847,
"final_score": 0.891,
"scorecard": {
"matching_phenotypes": ["HP:0001249", "HP:0000729", "HP:0001250"],
"hallmark_match": "HP:0000729 (autistic features) β HIGH SPECIFICITY",
"missing_hallmarks": [],
"contradictions": [],
"audit_note": "Strong match on autistic features and seizures. No contradictions.",
"pairwise_wins": 8,
"pairwise_losses": 1
}
}
],
"pipeline_metadata": {
"backbone": "Qwen/Qwen3-8B",
"kg_version": "v1.0",
"runtime_seconds": 287,
"not_found": false
}
}This system was designed for use with real patient data in clinical environments:
- β No API calls β every LLM step runs on your local GPU
- β No telemetry β no usage data is collected or transmitted
- β No cloud storage β all inputs and outputs stay on your machine
- β Suitable for PHI β compatible with HIPAA-conscious deployment on institutional hardware
You are responsible for ensuring your computational environment meets your institution's data-governance requirements before processing real patient data.
If you use RareDisGraph-MultiAgentLLM in your research, please cite:
@article{nguyen2025RareDisGraph,
title = {A locally deployable multi-agent system for rare disease
prioritization using a curated knowledge graph and
open-weight language models},
author = {Nguyen, Quan M. and Wang, Kai},
journal = {Under review},
year = {2026},
note = {Under review},
url = {https://github.com/WGLab/RareDisGraph-MultiAgentLLM}
}Also cite the RareDisGraph knowledge graph:
@software{RareDisGraph2025,
author = {Nguyen, Quan Minh and Wang, Kai},
title = {RareDisGraph: A MONDO-anchored rare disease knowledge graph
integrating GeneReviews, OMIM and Orphanet},
year = {2025},
url = {https://github.com/WGLab/RareDisGraph-Extraction}
}For questions, bug reports or collaboration inquiries:
| Name | Role | |
|---|---|---|
| Quan Minh Nguyen | Lead developer Β· PhD Student, University of Pennsylvania | nguyenqm@chop.edu |
| Kai Wang | Principal Investigator Β· Children's Hospital of Philadelphia | wangk@chop.edu |
For bugs and feature requests please open a GitHub Issue.
