# nvidia-medtech/nv-reason-ct architecture

> Architecture diagram of the GitHub repository nvidia-medtech/nv-reason-ct, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nvidia-medtech/nv-reason-ct
- Repository: https://github.com/nvidia-medtech/nv-reason-ct

## Overview

NV-Reason-CT provides example inference and fine-tuning workflows for a hosted generative 3D CT vision-language model; model weights, architecture, and processor implementation live in the external Hugging Face package. Inference accepts a NIfTI volume and prompt, then returns generated text. Training examples cover supervised fine-tuning and GRPO, including region-aware label and reward logic. The graph reflects the README and shown source excerpts; implementation details of the remote model and unsampled training code are not inferred.

Main entry points: [`train/vlm_grpo_train.py`](https://github.com/nvidia-medtech/nv-reason-ct/blob/main/train/vlm_grpo_train.py) (GRPO entrypoint), [`inference.py`](https://github.com/nvidia-medtech/nv-reason-ct/blob/main/inference.py) (Inference CLI), [`train/vlm_sft_train.py`](https://github.com/nvidia-medtech/nv-reason-ct/blob/main/train/vlm_sft_train.py) (SFT entrypoint), [`train/vlm_rewards.py`](https://github.com/nvidia-medtech/nv-reason-ct/blob/main/train/vlm_rewards.py) (Reward functions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inference["Inference"]
  node_inference_cli["Inference CLI<br/>[inference.py]"]
  node_remote_model["NV-Reason-CT package"]
  node_generated_text["Generated response"]
end

subgraph group_sft["Supervised tuning"]
  node_sft_entry["SFT entrypoint<br/>[vlm_sft_train.py]"]
  node_sft_records["SFT records"]
  node_sft_config["SFT configuration"]
  node_save_callback["Processor save callback<br/>[vlm_callbacks.py]"]
end

subgraph group_grpo["Policy optimization"]
  node_grpo_entry["GRPO entrypoint<br/>[vlm_grpo_train.py]"]
  node_grpo_trainer["3D GRPO trainer"]
  node_grpo_records["GRPO records"]
  node_grpo_config["GRPO configuration"]
end

subgraph group_domain["CT evaluation"]
  node_rewards["Reward functions<br/>[vlm_rewards.py]"]
  node_ct_labels["CT label schemas<br/>[vlm_labels.py]"]
end

node_user(("Clinician or researcher"))
node_ct_volume["NIfTI CT volume"]

node_user -->|"runs"| node_inference_cli
node_ct_volume -->|"provides scan"| node_inference_cli
node_inference_cli -->|"loads model and processor"| node_remote_model
node_inference_cli -->|"submits CT and prompt"| node_remote_model
node_remote_model -->|"generates response"| node_generated_text
node_sft_records -->|"loads records"| node_sft_entry
node_sft_config -->|"configures run"| node_sft_entry
node_sft_entry -->|"loads model and processor"| node_remote_model
node_sft_entry -->|"uses callback"| node_save_callback
node_grpo_records -->|"loads records"| node_grpo_entry
node_grpo_config -->|"configures run"| node_grpo_entry
node_grpo_entry -->|"loads model and processor"| node_remote_model
node_grpo_entry -->|"constructs trainer"| node_grpo_trainer
node_grpo_entry -->|"selects reward functions"| node_rewards
node_grpo_entry -->|"uses save helper"| node_save_callback
node_rewards -->|"uses label schemas"| node_ct_labels

click node_inference_cli "https://github.com/nvidia-medtech/nv-reason-ct/blob/main/inference.py"
click node_sft_entry "https://github.com/nvidia-medtech/nv-reason-ct/blob/main/train/vlm_sft_train.py"
click node_sft_records "https://github.com/nvidia-medtech/nv-reason-ct/tree/main/datalists"
click node_sft_config "https://github.com/nvidia-medtech/nv-reason-ct/tree/main/configs"
click node_save_callback "https://github.com/nvidia-medtech/nv-reason-ct/blob/main/train/vlm_callbacks.py"
click node_grpo_entry "https://github.com/nvidia-medtech/nv-reason-ct/blob/main/train/vlm_grpo_train.py"
click node_grpo_trainer "https://github.com/nvidia-medtech/nv-reason-ct/blob/main/train/vlm_grpo_trainer.py"
click node_grpo_records "https://github.com/nvidia-medtech/nv-reason-ct/tree/main/datalists"
click node_grpo_config "https://github.com/nvidia-medtech/nv-reason-ct/tree/main/configs"
click node_rewards "https://github.com/nvidia-medtech/nv-reason-ct/blob/main/train/vlm_rewards.py"
click node_ct_labels "https://github.com/nvidia-medtech/nv-reason-ct/blob/main/train/vlm_labels.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_inference_cli,node_remote_model,node_generated_text toneBlue
class node_sft_entry,node_sft_records,node_sft_config,node_save_callback toneAmber
class node_grpo_entry,node_grpo_trainer,node_grpo_records,node_grpo_config toneMint
class node_rewards,node_ct_labels toneRose
class node_user,node_ct_volume toneIndigo
```

## Components

### Inference

- [Inference CLI](https://github.com/nvidia-medtech/nv-reason-ct/blob/main/inference.py): `inference.py`
- **NV-Reason-CT package**
- **Generated response**

### Supervised tuning

- [SFT entrypoint](https://github.com/nvidia-medtech/nv-reason-ct/blob/main/train/vlm_sft_train.py): `train/vlm_sft_train.py`
- [SFT records](https://github.com/nvidia-medtech/nv-reason-ct/tree/main/datalists): `datalists`
- [SFT configuration](https://github.com/nvidia-medtech/nv-reason-ct/tree/main/configs): `configs`
- [Processor save callback](https://github.com/nvidia-medtech/nv-reason-ct/blob/main/train/vlm_callbacks.py): `train/vlm_callbacks.py`

### Policy optimization

- [GRPO entrypoint](https://github.com/nvidia-medtech/nv-reason-ct/blob/main/train/vlm_grpo_train.py): `train/vlm_grpo_train.py`
- [3D GRPO trainer](https://github.com/nvidia-medtech/nv-reason-ct/blob/main/train/vlm_grpo_trainer.py): `train/vlm_grpo_trainer.py`
- [GRPO records](https://github.com/nvidia-medtech/nv-reason-ct/tree/main/datalists): `datalists`
- [GRPO configuration](https://github.com/nvidia-medtech/nv-reason-ct/tree/main/configs): `configs`

### CT evaluation

- [Reward functions](https://github.com/nvidia-medtech/nv-reason-ct/blob/main/train/vlm_rewards.py): `train/vlm_rewards.py`
- [CT label schemas](https://github.com/nvidia-medtech/nv-reason-ct/blob/main/train/vlm_labels.py): `train/vlm_labels.py`

### Other components

- **Clinician or researcher**
- **NIfTI CT volume**

## Connections

- Clinician or researcher → Inference CLI: runs (evidence: `README.md`)
- NIfTI CT volume → Inference CLI: provides scan (evidence: `inference.py`)
- Inference CLI → NV-Reason-CT package: loads model and processor (evidence: `inference.py`)
- Inference CLI → NV-Reason-CT package: submits CT and prompt (evidence: `inference.py`)
- NV-Reason-CT package → Generated response: generates response
- SFT records → SFT entrypoint: loads records (evidence: `train/vlm_sft_train.py`)
- SFT configuration → SFT entrypoint: configures run (evidence: `README.md`)
- SFT entrypoint → NV-Reason-CT package: loads model and processor (evidence: `train/vlm_sft_train.py`)
- SFT entrypoint → Processor save callback: uses callback (evidence: `train/vlm_sft_train.py`)
- GRPO records → GRPO entrypoint: loads records (evidence: `train/vlm_grpo_train.py`)
- GRPO configuration → GRPO entrypoint: configures run (evidence: `README.md`)
- GRPO entrypoint → NV-Reason-CT package: loads model and processor (evidence: `train/vlm_grpo_train.py`)
- GRPO entrypoint → 3D GRPO trainer: constructs trainer (evidence: `train/vlm_grpo_train.py`)
- GRPO entrypoint → Reward functions: selects reward functions (evidence: `train/vlm_grpo_train.py`)
- GRPO entrypoint → Processor save callback: uses save helper (evidence: `train/vlm_grpo_train.py`)
- Reward functions → CT label schemas: uses label schemas (evidence: `train/vlm_rewards.py`)
