Image-Text-to-Text
Transformers
English
qwen3_5
medical-imaging
pathology
histopathology
whole-slide-imaging
vision-language
nv-reason-pathwsi
nvidia
conversational
Instructions to use nvidia/NV-Reason-PathWSI with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nvidia/NV-Reason-PathWSI with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="nvidia/NV-Reason-PathWSI") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("nvidia/NV-Reason-PathWSI") model = AutoModelForMultimodalLM.from_pretrained("nvidia/NV-Reason-PathWSI", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nvidia/NV-Reason-PathWSI with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nvidia/NV-Reason-PathWSI" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nvidia/NV-Reason-PathWSI", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/nvidia/NV-Reason-PathWSI
- SGLang
How to use nvidia/NV-Reason-PathWSI with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "nvidia/NV-Reason-PathWSI" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nvidia/NV-Reason-PathWSI", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "nvidia/NV-Reason-PathWSI" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nvidia/NV-Reason-PathWSI", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use nvidia/NV-Reason-PathWSI with Docker Model Runner:
docker model run hf.co/nvidia/NV-Reason-PathWSI
File size: 16,207 Bytes
e319d73 2fdf7d7 e319d73 2fdf7d7 38649a8 2fdf7d7 e319d73 2fdf7d7 38649a8 2fdf7d7 38649a8 2fdf7d7 31a7072 2fdf7d7 31a7072 2fdf7d7 9486171 2fdf7d7 38649a8 2fdf7d7 38649a8 2fdf7d7 31a7072 2fdf7d7 31a7072 2fdf7d7 31a7072 2fdf7d7 31a7072 2fdf7d7 31a7072 2fdf7d7 31a7072 2fdf7d7 31a7072 2fdf7d7 31a7072 2fdf7d7 31a7072 2fdf7d7 31a7072 2fdf7d7 31a7072 2fdf7d7 31a7072 2fdf7d7 31a7072 2fdf7d7 31a7072 2fdf7d7 31a7072 2fdf7d7 31a7072 2fdf7d7 31a7072 2fdf7d7 31a7072 2fdf7d7 31a7072 2fdf7d7 31a7072 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | ---
library_name: transformers
license: openmdw-1.1
license_name: openmdw-1.1
license_link: https://huggingface.co/nvidia/NV-Reason-PathWSI/blob/main/LICENSE
language:
- en
pipeline_tag: image-text-to-text
base_model:
- Qwen/Qwen3.5-4B
base_model_relation: finetune
tags:
- medical-imaging
- pathology
- histopathology
- whole-slide-imaging
- vision-language
- nv-reason-pathwsi
- nvidia
---
# NV-Reason-PathWSI
[](https://huggingface.co/nvidia/NV-Reason-PathWSI)
[](https://github.com/NVIDIA-Medtech/NV-Reason-PathWSI)
[](LICENSE)
NV-Reason-PathWSI is a 2D vision-language model (VLM) for pathology whole-slide image (WSI) analysis. It combines a 2D vision encoder (Vision Transformer (ViT)) with a language model and is designed for pathology report generation, general question answering, and multi-step reasoning across digitized histopathology slides.
Whole-slide images encode clinically important morphology across gigapixel-scale tissue regions, yet most vision-language systems either operate on isolated tiles without slide-level context or compress slide-level features before language decoding. The 2D vision encoder converts tiled histopathology image regions into visual tokens. All tokens and their corresponding 2D positions are passed to the language model without spatial downsampling, while 2D positional encoding preserves their spatial relationships within the large language model (LLM). Input whole-slide images are tiled into image regions before processing.
The model was trained end-to-end using Supervised Fine-Tuning (SFT) and Group Relative Policy Optimization (GRPO) on a curated dataset of structured question-answering (QA) examples derived from whole-slide images. The training corpus integrates standardized pathology reports, abnormality-focused QA, multi-turn interactions, and pathologist-authored reasoning collected from expert whole-slide image interpretations. These expert annotations also guide the generation of report-grounded synthetic reasoning data for SFT, while GRPO uses verifiable rewards over pathology finding sets.
This model is ready for commercial or non-commercial use.
> **Note:** Model weights are not included in this repository pending publication of the accompanying paper. This page provides the model card, configuration, and tokenizer; the weights will be released upon paper publication.
## Installation
Python 3.11+ and a CUDA-capable PyTorch installation are recommended.
```bash
python -m pip install -r https://huggingface.co/nvidia/NV-Reason-PathWSI/resolve/main/requirements.txt
```
## Quick Start
```python
import torch
from transformers import AutoModelForImageTextToText, AutoProcessor
model_id = "nvidia/NV-Reason-PathWSI"
image_path = "path/to/patch.jpg"
model = AutoModelForImageTextToText.from_pretrained(
model_id,
dtype=torch.bfloat16,
).eval().to("cuda")
processor = AutoProcessor.from_pretrained(model_id)
def generate_response(image_path, prompt_text, enable_thinking=False, max_new_tokens=2048):
messages = [
{
"role": "user",
"content": [
{"type": "image"},
{"type": "text", "text": prompt_text},
],
}
]
prompt = processor.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=enable_thinking,
)
inputs = processor(
text=prompt, images=[image_path], return_tensors="pt"
).to(model.device)
with torch.inference_mode():
generated_ids = model.generate(
**inputs,
max_new_tokens=max_new_tokens,
do_sample=False,
use_cache=True,
)
new_tokens = generated_ids[:, inputs.input_ids.shape[1]:]
return processor.batch_decode(
new_tokens, skip_special_tokens=True, clean_up_tokenization_spaces=False
)[0]
# Open-ended description
print(generate_response(image_path, "Describe the histopathological features visible in this image."))
# Multiple-choice with a concise answer (thinking off)
print(generate_response(image_path, "Which feature is present? A) ... B) ... C) ... D) ...", enable_thinking=False))
# Reasoning mode
print(generate_response(image_path, "Reason step by step about the likely diagnosis.", enable_thinking=True))
```
The model loads with stock Transformers as standard `Qwen3_5ForConditionalGeneration` weights; `trust_remote_code` is not required. The chat template supports `enable_thinking`.
## License/Terms of Use
Use of this model is governed by the [OpenMDW-1.1 License](LICENSE).
### Deployment Geography
Global
### Use Case
Pathologists, medical students, and medical researchers would be expected to use this model for histopathology slide report generation, question answering, and reviewable AI-generated reasoning analyses in research and educational settings.
**Important Medical AI Considerations:**
This model is designed for research and educational purposes only and should not be used for clinical diagnosis or treatment decisions. All outputs should be reviewed by qualified medical professionals. The model is intended to support medical education and research, not replace clinical judgment.
### Release Date
Huggingface 11/28/2026 via https://huggingface.co/nvidia/NV-Reason-PathWSI
## Reference(s)
[1] Wang S, Wu R, Herndon C, et al. "Pathology-CoT: Learning Visual Chain-of-Thought Agent from Expert Whole Slide Image Diagnosis Behavior." arXiv:2510.04587, 2025. https://arxiv.org/abs/2510.04587
[2] Sun Y, Zhang Y, Si Y, et al. "PathGen-1.6M: 1.6 Million Pathology Image-text Pairs Generation through Multi-agent Collaboration." arXiv:2407.00203, 2024. https://arxiv.org/abs/2407.00203
## Model Architecture
**Architecture Type:** Transformer (Vision-Language Model)<br>
**Network Architecture:** 2D vision encoder (ViT) coupled to a Qwen3.5-4B language model, with 2D positional encoding<br>
**Task:** Vision-Language (report generation, question answering, and reasoning)<br>
**Base Model:** [Qwen3.5-4B](https://huggingface.co/Qwen/Qwen3.5-4B)<br>
**Number of model parameters:** 4.54B total (4,539,265,536 parameters, bf16)
This model was developed by training end-to-end with Supervised Fine-Tuning (SFT) and Group Relative Policy Optimization (GRPO).
**Hugging Face integration:**
- `AutoModelForImageTextToText` + `AutoProcessor`, no remote code
- Chat template supports `enable_thinking`
## Input
**Input Type(s):** Image, Text<br>
**Input Format(s):** Whole-slide images (.svs, .tif/.tiff, .ndpi) or extracted histopathology tiles (.png, .jpg), Text prompts (string)<br>
**Input Parameters:** Image: Two-Dimensional (2D); Text: One-Dimensional (1D)<br>
**Other Properties Related to Input:** Accepts digitized histopathology slides (routine hematoxylin and eosin (H&E) and/or special stains). Whole-slide images are tiled into 2D image regions before encoding. Input image sizes are flexible, from 224 x 224 pixels up to 4K resolution. Text length limits follow the NV-Reason-CT configuration: generation is capped at 2,048 new tokens, with prompt length bounded by the Qwen3.5-4B context window. Accepts natural language prompts for medical queries, follow-up questions, and reasoning requests.
### Input Specifications
- **Medical Images:** Digitized whole-slide histopathology images and extracted image tiles (flexible input size from 224 x 224 pixels up to 4K resolution)
- **Text Prompts:** Natural language requests for pathology reports, answers to questions, or detailed reasoning analyses
- **Interactive Dialogue:** Support for follow-up questions and clarification requests
## Output
**Output Type(s):** Text<br>
**Output Format:** String<br>
**Output Parameters:** One-Dimensional (1D) natural language reports, answers, and reasoning analyses<br>
**Other Properties Related to Output:** Outputs contain structured reasoning showing step-by-step medical analysis, followed by a concise answer. This format enables transparency in the model's reasoning process and supports educational use cases. Reasoning output can be disabled for concise answers.
Our AI models are designed and/or optimized to run on NVIDIA GPU-accelerated systems. By leveraging NVIDIA's hardware (e.g. GPU cores) and software frameworks (e.g., CUDA libraries), the model achieves faster training and inference times compared to CPU-only solutions.
## Software Integration
**Runtime Engine(s):**
* PyTorch
* Transformers
**Supported Hardware Microarchitecture Compatibility:**
* NVIDIA Ampere
* NVIDIA Hopper
* NVIDIA Lovelace
**Supported Operating System(s):**
* Linux
The integration of foundation and fine-tuned models into AI systems requires additional testing using use-case-specific data to ensure safe and effective deployment. Following the V-model methodology, iterative testing and validation at both unit and system levels are essential to mitigate risks, meet technical and functional requirements, and ensure compliance with safety and ethical standards before deployment.
## Model Version(s)
0.1 - Initial release version for pathology WSI reasoning and interpretation with structured thinking output
This model can be integrated into AI systems through the PyTorch and Transformers runtimes on NVIDIA GPU-accelerated systems. Integration requires additional use-case-specific testing and validation, following the V-model methodology described under Software Integration, before the model is deployed in any AI system.
## Training and Evaluation Datasets
### Dataset Overview
The model was trained on a curated dataset of structured question answering (QA) examples derived from whole-slide images, integrating public pathology datasets with paired reports, abnormality labels, and expert-authored reasoning.
**Total Size:** Hundreds of thousands of structured QA examples derived from tens of thousands of whole-slide images; less than a million images and less than a billion text tokens in total.
**Total Number of Datasets:** 32 (31 public TCGA datasets used for training and validation, plus 1 independent external test set used for testing).
**Partition Percentages:** Training and validation partitions are derived from the 31 TCGA datasets (the majority of the data); testing is performed on an independent external test set that is fully disjoint from all training and validation data.
**Time Period:** 2000-2025.
**Data Processing:** Whole-slide images are tiled into image regions; standardized pathology reports, abnormality-focused QA, multi-turn interactions, and pathologist-authored reasoning are converted into structured QA examples; de-identification is applied to all source data before use.
**Harmful Data Mitigation:** All TCGA source data is de-identified by the data provider; additional Protected Health Information (PHI) scrubbing and review are applied before use. Data is limited to de-identified histopathology images and accompanying medical text for research use. Users are responsible for ensuring that whole-slide images and associated patient data are properly de-identified and handled in accordance with applicable privacy requirements.
### Public Datasets
- **The Cancer Genome Atlas (TCGA):** 31 TCGA cancer-type datasets (identified by TCGA project codes), providing whole-slide histopathology images with paired pathology annotations. Link: https://portal.gdc.cancer.gov/projects/TCGA. Period of collection: 2000-2025. All TCGA source data is de-identified.
### Private Datasets
- **Independent external test set (clinical evaluation benchmark):** 579 whole-slide histopathology images with accompanying text, used for evaluation and testing only; fully disjoint from all TCGA training and validation data.
- **Providing parties:** external clinical collaborating institutions; not distributed by NVIDIA.
- **Number of data points / size per modality:** 579 whole-slide images (image modality) with paired natural-language text.
- **Nature of content:** de-identified patient histopathology data.
- **Unique identifiers/links:** not publicly available (held-out test collection).
- **Period of collection:** 2000-2025.
### Self-Sourced Synthetic Data
Report-grounded synthetic reasoning examples generated for supervised fine-tuning, derived from expert pathologist annotations of TCGA whole-slide images. Data points: included within the hundreds of thousands of structured QA training examples. Size per modality: synthetic text (reasoning chains and QA) paired with source histopathology image regions. Generation methods: expert-guided generation grounded in paired pathology reports, with review under expert guidance. AI models/systems used: internal data-generation pipelines guided by expert-authored reasoning.
## Training Dataset
**Data Modality:**
* Image
* Text
**Image Training Data Size:**
* Less than a Million Images
**Text Training Data Size:**
* Less than a Billion Tokens
**Data Collection Method by dataset:**
* Hybrid: Manually-Collected, Automatic/Sensors
**Labeling Method by dataset:**
* Hybrid: Manually-Labeled, Synthetic
**Properties:** Data count: hundreds of thousands of structured QA examples derived from tens of thousands of whole-slide images across the 31 TCGA datasets. Modalities: histopathology whole-slide images (image) and natural-language text (reports, question answering, and reasoning). Nature of content: de-identified public (TCGA) patient data with human-authored and synthetic annotations. Linguistic characteristics: English-language medical text. Time period: 2000-2025.
## Testing Dataset
**Data Modality:**
* Image
* Text
**Data Collection Method by dataset:**
* Hybrid: Manually-Collected, Automatic/Sensors
**Labeling Method by dataset:**
* Hybrid: Manually-Labeled, Synthetic
**Properties:** Data count: 579 whole-slide images (independent external test set), fully disjoint from the 31 TCGA training datasets. Modalities: histopathology whole-slide images (image) and natural-language text. Nature of content: held-out, de-identified patient data with human and synthetic annotations. Linguistic characteristics: English-language medical text. Time period: 2000-2025.
## Evaluation Dataset
**Data Modality:**
* Image
* Text
**Data Collection Method by dataset:**
* Hybrid: Manually-Collected, Automatic/Sensors
**Labeling Method by dataset:**
* Hybrid: Manually-Labeled, Synthetic
**Properties:** Data count: 579 whole-slide images from the independent external test set (clinical evaluation benchmark), fully disjoint from the 31 TCGA training datasets. Modalities: histopathology whole-slide images (image) and natural-language text. Nature of content: held-out, de-identified patient data with human and synthetic annotations. Linguistic characteristics: English-language medical text. Time period: 2000-2025.
## Inference
**Acceleration Engine:** PyTorch, Transformers<br>
**Test Hardware:**
* NVIDIA Hopper H100
* NVIDIA Lovelace L40S
## Ethical Considerations
NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. Developers should work with their internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse.
Please make sure you have proper rights and permissions for all input image and video content; if image or video includes people, personal health information, or intellectual property, the image or video generated will not blur or maintain proportions of image subjects included.
For more detailed information on ethical considerations for this model, please see the [Model Card++ Bias, Explainability, Safety & Security, and Privacy Subcards](https://github.com/NVIDIA-Medtech/NV-Reason-PathWSI/blob/main/MODEL_CARD_SUBCARDS.md).
Please report model quality, risk, security vulnerabilities or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/).
|