WACV 2027

PathKGen: Pathology Knowledge Assisted MLLM for Explainable Histopathology

Nadun Rajapaksha1,*Sandun Herath1,*Devnith Wijesinghe1,*Isiri Amani Withanawasam1,*Hasindri Watawana2,3Ranga Rodrigo1,†
1University of Moratuwa, Sri Lanka   2Idiap Research Institute, Switzerland   3EPFL, Switzerland
*Equal contribution   †Correspondence: ranga@uom.lk
Whole slide image of lung tissue

Taken from: Lung

Prominentnucleoli Intercellularbridges Keratinization Nuclearpleomorphism Atypicalsquamous cells Vascularinvasion Necrosis Lung SquamousCell Carcinoma
User
What is the diagnosis of this whole slide image?
PathKGen output

Microscopic observation of the pathology slide reveals a moderately differentiated squamous cell carcinoma characterized by sheets of atypical squamous cells with intercellular bridges and keratinization. The tumor cells exhibit moderate nuclear pleomorphism with prominent nucleoli. Mitotic figures are present, indicating a moderate rate of cell division. There is no evidence of vascular invasion or necrosis within the examined tissue. Based on these observations, the diagnosis is squamous cell carcinoma.

Whole Slide Image (WSI) analysis serves as the fundamental method for the clinical diagnosis of cancer in digital histopathology. Recent advances in Multimodal Large Language Models (MLLMs) have enabled state-of-the-art (SOTA) automated histopathology report generation. However, MLLMs reason purely through distributions encoded in their neural parameters, limiting the amount of knowledge and reasoning logic they can contain given the model scale. Their black-box reasoning poses another challenge to the human interpretation of intermediate reasoning.

We address these issues by utilizing knowledge graphs to inject external structured knowledge for MLLMs to reason over, while making this reasoning component visible. We introduce PathKGen, a knowledge graph–assisted MLLM for histopathology report generation with two branches: (1) a visual path that learns visual token inputs using pathology foundation models, and (2) a knowledge path that learns knowledge token inputs by extracting key morphological features of WSIs through querying a pathology-specific knowledge graph.

A comprehensive evaluation on the WSI-Bench dataset shows that PathKGen surpasses previous SOTA methods while revealing diagnostic reasoning as visually intuitive graphs. Due to its modular design, the knowledge path is complementary to vision-aligned MLLMs and can be extended to other applications by curating domain-specific knowledge graphs.

Methodology

Given a WSI, PathKGen runs two parallel paths whose tokens are fed to a Qwen2.5-7B-Instruct MLLM. The model input is a unified prompt P = [v; k; p] of visual tokens, knowledge tokens and the instruction prompt.

PathKGen pipeline A whole slide image is tiled into 512 by 512 patches, encoded by a frozen CONCH patch encoder and a frozen TITAN slide encoder, and projected into visual tokens. The slide embedding goes to an auxiliary classifier that, together with the primary site, predicts a histology class used to retrieve a subgraph from the pathology knowledge graph. The subgraph is converted to text and tokenized into knowledge tokens. Together with the tokenized prompt, visual and knowledge tokens are fed into the Qwen2.5 7B MLLM, which writes the pathology report. Vision encoder Knowledge path Whole slide image 512×512 patches Patch encoderCONCH Slide encoderTITAN ProjectionLayer Visual tokens v k p Tokenize Tokenize Primary site Auxiliary classifier Histology class Pathology Knowledge Graph Slide embeddings Retrieved subgraph
histology: papillary renal cell carcinoma,
growth patterns: papillary pattern,
cytological features: abundant cytoplasm,
background features: foam cells,
has invasive patterns: vascular invasion,
nuclear features: irregular nuclei,
found in: kidney
Prompt: “With the help of the knowledge provided, describe the histology of the Whole Slide Image.” MLLM (Qwen2.5 7B)+ prompt, QLoRA Pathology report frozen trained

Knowledge graph curation

GPT-4o extracts morphological features from WSI-Bench reports; SapBERT links them to UMLS concepts; relations are categorized by semantic type; and pathologists verify the final graph.

Knowledge graph curation: pathologist-authored reports, key descriptors and terms extracted from them, matching to UMLS concepts, and assigning relations to connect them into the graph.

Qualitative Results & Explainability

The retrieved subgraph is shown next to each generated report. Features supported by the slide are green, features with no evidence are red, and the predicted histology is blue. The model also learns connections absent from the graph (isolated green nodes) and uses negation, where absent features serve as diagnostic evidence.

Taken from:

Drag nodes to rearrange them or the background to pan. Click the graph, then scroll to zoom. Hover a phrase or node to link them.

Quantitative Results & Evaluation

1. Report generation on WSI-Bench

PathKGen outperforms existing WSI MLLMs on most metrics, including a 9.09% relative gain in the LLM-as-a-Judge WSI-Precision.

ModelB-1B-2B-3B-4R-LMW-P
GPT-4o0.2020.0690.0300.0160.1320.1670.067
Quilt-LLaVA0.3340.1700.0930.0570.2460.2910.324
MI-Gen0.4030.3060.2480.2090.4460.4070.310
HistGen0.4060.3070.2480.2080.4480.4160.300
WSI-Agents0.4440.3080.2310.1830.4480.4720.440
WSI-LLaVA0.4800.3580.2870.2400.4900.4650.380
PathKGen (Ours)0.5120.3890.3160.2610.5190.4850.480

B: BLEU, R-L: ROUGE-L, M: METEOR, W-P: WSI-Precision. BERTScore F1: 0.9081 (RoBERTa-large) vs. 0.9068 for WSI-LLaVA.

2. Ablation: what does the knowledge path add?

Knowledge-path inputB-1B-2B-3B-4R-LMW-P
None0.49220.37450.30630.25480.51850.47300.4661
Predicted histology (H)0.50200.38050.30880.25580.51740.47890.4570
Primary site (PS) only0.49590.37730.30720.25490.51420.47500.4480
PathKGen (H + PS + MF)0.51220.38850.31540.26110.51940.48490.4802

B: BLEU, R-L: ROUGE-L, M: METEOR, W-P: WSI-Precision, H: predicted histology, PS: primary site, MF: morphological features.

3. Parameter efficiency

Adding the knowledge path lets smaller models approach larger ones. Scaling the model still gives the biggest gain, but external knowledge helps at every scale.

MethodB-1B-2B-3B-4R-LMW-P
V path only (7B)0.49220.37450.30630.25480.51850.47300.4661
V + K path (1.5B)0.47920.36070.29300.24260.50400.45620.4290
V + K path (3B)0.49500.37230.30110.24840.50820.47190.4428
V + K path (7B), PathKGen0.51220.38850.31540.26110.51940.48490.4802

B: BLEU, R-L: ROUGE-L, M: METEOR, W-P: WSI-Precision, V: Vision, K: Knowledge. Values in parentheses are model parameter sizes in billions.

4. Does the model really use the knowledge?

Counterfactual interventions at inference time show it does: an oracle histology anchor slightly helps, while a random wrong anchor sharply degrades WSI-Precision.

InterventionWSI-Precision
Predicted histology anchor (default)0.4802
Oracle histology anchor0.4830
Random-wrong histology anchor0.2540

Curated Pathology Knowledge Graph

The graph has 177 nodes and 317 edges across 31 histology classes. It is sparse yet cohesive (density 0.01, average out-degree 1.79). Relations fall into six categories: cytological feature (71), growth pattern (69), nuclear feature (57), invasion pattern (50), background feature (42) and found in (28).

Hover a node to highlight it and its neighbours (click to keep it selected). Use Names to show or hide all node names; zoom in to reveal more. Drag nodes to rearrange them or the background to pan. Click the graph, then scroll to zoom. Click a legend item to hide that relation type.

BibTeX

@article{rajapaksha2026pathkgen,
  title={PathKGen: Pathology Knowledge Assisted MLLM for Explainable Histopathology},
  author={Rajapaksha, Nadun and Herath, Sandun and Wijesinghe, Devnith and Withanawasam, Isiri Amani and Watawana, Hasindri and Rodrigo, Ranga},
  journal={arXiv preprint arXiv:2610.33691},
  year={2026}
}