Instructions to use hitheshkaranth/Skanda-0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sam2
How to use hitheshkaranth/Skanda-0 with sam2:
# Use SAM2 with images import torch from sam2.sam2_image_predictor import SAM2ImagePredictor predictor = SAM2ImagePredictor.from_pretrained("hitheshkaranth/Skanda-0") with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16): predictor.set_image(<your_image>) masks, _, _ = predictor.predict(<input_prompts>)# Use SAM2 with videos import torch from sam2.sam2_video_predictor import SAM2VideoPredictor predictor = SAM2VideoPredictor.from_pretrained("hitheshkaranth/Skanda-0") with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16): state = predictor.init_state(<your_video>) # add new prompts and instantly get the output on the same frame frame_idx, object_ids, masks = predictor.add_new_points(state, <your_prompts>) # propagate the prompts to get masklets throughout the video for frame_idx, object_ids, masks in predictor.propagate_in_video(state): ... - Notebooks
- Google Colab
- Kaggle
Skanda-0
Reads chest X-ray, CT and MRI, writes the report, and outlines the findings it reports
Results Β· By disease Β· Limitations Β· How it works Β· Architecture Β· Training Β· Files Β· Memory Β· int8 / int4 Β· Licence
Research use only. Skanda drafts findings for a radiologist to review. It is not a medical device and has not been cleared or approved for clinical use by any regulator.
β¨ At a glance
72%CT finding named rightMedGemma 27B: 49% |
89%MRI finding named rightMedGemma 27B: 42% |
91% Β· 94%lesion-free CT Β· MRI clearedMedGemma 27B: 6% Β· 2% |
4Γ Β· 22Γ Β· 12Γbox precision vs MedGemma 27BX-ray Β· CT Β· MRI |
π Results
All numbers are percentages on held-out test cases. No test patient was seen in training.
| π©» Chest X-ray Β· 111 films | ||||
|---|---|---|---|---|
| Metric | MedGemma 27B | MedGemma + MAIRA-2 | Skanda run 2β | Skanda-0 |
| Abnormal flagged | 90 | 91 | 85 | 84 |
| Normals called normal | 72 | 72 | 83 | 69 |
| Right finding type | 41 | 47 | 37 | 40.5 |
| Box precision | 6 | β | 28 | 25.5 |
| Box recall | 4 | β | 15.5 | 10 |
| π« CT Β· 340 cases | ||||
| Abnormal flagged | 97 | β | 80 | 82 |
| Normals called normal | 6 | β | 88 | 91 |
| Right finding type | 49 | β | 69 | 72 |
| Box precision | 1 | β | 20 | 22 |
| Box recall | 3 | β | 14 | 16 |
| π§ MRI Β· 240 cases | ||||
| Abnormal flagged | 99 | β | 89 | 89 |
| Normals called normal | 2 | β | 97 | 94 |
| Right finding type | 42 | β | 87 | 89 |
| Box precision | 6 | β | 64 | 70 |
| Box recall | 8 | β | 59 | 65 |
Percent, higher is better; bold = best per row. MAIRA-2 reads chest X-rays only, so it has no CT or MRI numbers. β An earlier development checkpoint, shown for comparison; it is not published. Skanda-0 is the run-3 checkpoint.
π‘ What the numbers say
- π«π§ On CT and MRI, Skanda is well ahead of MedGemma.
- It names the right finding 72% / 89% of the time, against 49% / 42% for MedGemma 27B.
- It clears 91% / 94% of lesion-free cases, where MedGemma clears 6% / 2%: it calls nearly every case abnormal.
- π©» On chest X-ray, Skanda-0 is a trade-off against the earlier run 2.
- Finding type rose from 37% to 40.5%, but it clears fewer normals than run 2 (69% vs 83%) and finds fewer boxes (recall 10% vs 15.5%).
- Each X-ray number moves about Β±10 points by chance across 111 films. On the 106 dev films the same checkpoint cleared 74% of normals at 15.5% recall.
- π― Skanda outlines; the baselines write coordinates. MedGemma and MAIRA-2 give boxes only as text. Skanda's box precision is 4Γ MedGemma's on X-ray, 22Γ on CT and 12Γ on MRI.
- π©» On X-ray boxes, MAIRA-2 alone is ahead. Read on the same 111 films in a later benchmark, MAIRA-2 reached box precision 30% and recall 13%, against Skanda's 24.5% and 9.5% (see the quantized builds below). MAIRA-2 is licensed for research use only.
π How it is measured
| Metric | Meaning |
|---|---|
| Abnormal flagged | abnormal cases the model calls abnormal |
| Normals called normal | normal or lesion-free cases the model clears |
| Right finding type | abnormal cases where the model names a ground-truth finding class |
| Box precision / recall | X-ray: a predicted box counts when its centre lies inside a radiologist box of the same class. CT/MRI: box IoU β₯ 0.3 with a radiologist outline, matched one-to-one |
- Chest X-ray: ChestX-Det test films, scored by the Skanda Radiology app's own benchmark. The same runner is used for every model. Skanda's numbers are the mean of two passes.
- CT and MRI: a fixed sample of held-out slices and volumes, with and without lesions. One script scores every model.
- Two reads of the same cases. The table above is from 1 November 2026. The quantized-build table below and the int8 / int4 cards use a later re-read (8 November), with every baseline served at bf16, 8-bit and 4-bit through the same stack. On X-ray the two reads differ by a few points (MedGemma 27B finding type 41% here, 36% there), within the Β±10-point chance range of 111 films; CT and MRI reads of Skanda were identical.
π¦ Detection by disease
How often each model names each kind of finding, on the same held-out cases as the table above.
| Skanda leads | MedGemma leads | |
|---|---|---|
| π©» X-ray | consolidation 78% vs 69% Β· effusion 64% vs 30% (53% fused) Β· cardiomegaly 75% vs 25% Β· diffuse nodule 50% vs 0% | pneumothorax 100% vs 15% Β· atelectasis Β· nodule Β· mass Β· fibrosis Β· emphysema |
| π« CT | lung 92% vs 76% Β· liver 74% vs 57% Β· pancreas 46% vs 0% Β· mediastinum 69% vs 38% | colon 20% vs 13% |
| π§ MRI | brain tumour 96% vs 74% Β· acute stroke 47 of 60 found vs 0 | β |
Groups under about 15 cases (kidney, mediastinum, colon, most rare X-ray labels) are directional only.
π Side by side
β οΈ Limitations
- Rare X-ray findings are weak. Skanda named pneumothorax on 15% of the films that have it (MedGemma 27B: 100%), and trails MedGemma on atelectasis, nodule, mass, fibrosis and emphysema. Do not use it for triage.
- It misses findings. The report often names fewer findings than a film has, and X-ray box recall is about 10%.
- CT outlines can follow enhanced vessels instead of the lesion, and CT box recall is 16%.
- Small, internal test sets. 111 X-ray films (about Β±10 points by chance) and held-out cases from the training sources. There has been no external test set, no reader study and no radiologist review of its reports.
- Template reports. Evidence sentences come from measured masks and fixed templates; severity is a per-class constant.
π§ How it works
- Read. Qwen3-VL looks at the image and writes a JSON report, word by word.
- Point. Every finding's
"mask"field holds a special[SEG]token. The model's last hidden state at that token is its idea of "the thing I am describing now" (the idea comes from LISA). - Outline. A small projector turns that state into a prompt for SAM 2's mask decoder, which draws the outline. Sa2VA had already trained this SAM 2 to take such prompts.
- Score. A linear head on the last prompt token gives p(abnormal) and 13 X-ray class scores. They write a short "likely / possible β¦" hint line before X-ray reports and drive a calibrated gate that can overrule a wrong normal/abnormal call.
- Explain. Every number in a finding's
evidence(side, zone, extent, size in mm, volume in mL, HU) was measured from radiologist masks during training, so the model learns to describe the region it outlines.
Example output
{
"normal": false,
"findings": [
{
"title": "Effusion, right",
"evidence": "Homogeneous opacity at the patient's right costophrenic angle, lower zone, about 18% of the right lung field, rounded upper margin.",
"location": "right lower zone",
"severity": "moderate",
"mask": "[SEG]"
}
],
"impression": "Right pleural effusion."
}
Each "mask": "[SEG]" becomes one outline; a finding's box is its outline's extent.
ποΈ Architecture
| Part | Source | Size | Trained | Licence |
|---|---|---|---|---|
| Vision encoder | Qwen3-VL-30B-A3B-Instruct | ViT, 27 blocks | LoRA on the last 11 blocks + mergers | Apache-2.0 |
| Language model | Qwen3-VL-30B-A3B-Instruct | 48 layers, 128 experts (8 active), 31 B total / ~3 B active | LoRA r=64 on attention q/k/v/o; the [SEG] embedding and output rows |
Apache-2.0 |
| Outline model | SAM 2.1 Hiera-L, weights from Sa2VA-Qwen3-VL-4B | ~224 M | mask decoder and its object score; image encoder frozen | Apache-2.0 |
[SEG] projector |
new | MLP 2048 β 2048 β 256 | from scratch | CC BY-NC 4.0 (this model) |
| Score head | new | linear 2048 β 1 + 13 | from scratch | CC BY-NC 4.0 (this model) |
[SEG]token: id 151669, already inside Qwen3-VL's padded vocabulary. Its input and output rows train at 20Γ the learning rate; every other row's gradient is zeroed, so the rest of the vocabulary is untouched.- Images: up to 1024Β² for both Qwen3-VL and SAM 2. Volumes: 32 evenly spaced slices + the key slice at 320Β² for
Qwen3-VL; SAM 2 decodes each
[SEG]on the slices. CT is rendered from HU as lung / soft-tissue / bone windows in R / G / B; MRI as up to three sequences; patient right on image left. - Code: github.com/Hitheshkaranth/Skanda-0 (
skanda/model.py: model and losses).
ποΈ Training
loss = text cross-entropy (JSON boilerplate tokens Γ 0.3)
+ 2.0 Γ outline BCE + 0.5 Γ outline Dice one per [SEG], against the radiologist mask (3D Dice for volumes)
+ 0.2 Γ object-score BCE does the target mask exist (on this slice)?
+ 0.5 Γ score-head BCE p(abnormal) + 13 X-ray classes; unknown labels skipped
| Stage | Trains | Data | Settings |
|---|---|---|---|
| 0 Β· Connector | projector, SAM 2 mask decoder | "Outline the heart / right lung / liver lesion β¦" β [SEG] |
lr 1e-4 |
| 1 Β· 2D SFT | + LoRA on language model and vision encoder, [SEG] rows |
reports on X-rays and CT/MRI slices, with hint lines | lr 5e-5, r=64 |
| 2 Β· 3D volumes | same | CT/MRI volumes with lesion-free volumes, 40% 2D replay | lr 5e-5 |
| 3 Β· X-ray polish | same | X-ray reports, 15% 3D replay | lr 1.5e-5 |
Batch 1 Γ accumulation 8, AdamW, OneCycle (3% warm-up), grad-clip 1.0, bf16, gradient checkpointing. SAM 2's frozen image encoder runs once into a feature cache (~8 MB per image). Rare findings are drawn more often (inverse square-root class frequency).
Exact recipe of the published Skanda-0
Skanda-0 is the polish checkpoint of the third training run. Its weights went through six training passes in two runs.
Run 2 started from the base models, and run 3 continued from run 2's final checkpoint. Every pass below was kept by the
check.
| # | Run | Stage | Started from | Train data | Epochs | lr | Notes |
|---|---|---|---|---|---|---|---|
| 1 | 2 | 0 Β· connector | Qwen3-VL-30B-A3B + Sa2VA's SAM 2 + new projector and score head | outline prompts: ChestX-Det findings and CheXmask lungs/heart; MSD lesions and organs (brain tumour, heart, liver, prostate, lung, pancreas, hepatic vessel, spleen, colon); ISLES 2022; 3,000 prompts for findings that are absent (empty mask) | 2 | 1e-4 | language model frozen |
| 2 | 2 | 1 Β· 2D SFT | pass 1 | reports: ChestX-Det, NIH ChestX-ray14, MSD, ISLES 2022, DeepLesion, autoPET | 2 | 5e-5 | LoRA r=64 + vision LoRA, [SEG] rows |
| 3 | 2 | 2 Β· 3D | pass 2 | MSD, ISLES and autoPET volumes, with and without lesions; 40% 2D replay of pass 2's data | 3 | 5e-5 | |
| 4 | 3 | 1 Β· 2D SFT | pass 3 | as pass 2, with X-ray targets rebuilt: one finding + [SEG] per radiologist outline, and NIH rare-label films with text-only reports |
1 | 5e-5 | + hint lines (--hints) |
| 5 | 3 | 2 Β· 3D | pass 4 | as pass 3 | 1 | 5e-5 | hints |
| 6 | 3 | 3 Β· X-ray polish | pass 5 | ChestX-Det + NIH reports; 15% replay of the volumes | 1 | 1.5e-5 | hints β Skanda-0 |
After pass 6, the abnormal-score gate (skanda/calibrate.py) and the hint thresholds (skanda/calibrate_hints.py)
were chosen on validation records and dev films and written into skanda_config.json.
The check. After every pass, a score is computed on dev films and validation records, never on test data: 0.35 Γ X-ray balanced accuracy + 0.15 Γ right finding type + 0.15 Γ X-ray box recall + 0.20 Γ CT/MRI balanced accuracy + 0.15 Γ CT/MRI outline recall. A pass is kept when its score is at least the best so far β 0.01. Skanda-0 scored 0.616 (run 2's best: 0.598). An earlier run 1 (3D volumes that all had a lesion, then GRPO) ended with a model that called every X-ray abnormal; run 2's GRPO stage was dropped by this check, and run 3 did not run one.Code, record format and how to train on your own data: github.com/Hitheshkaranth/Skanda-0 (docs/TRAINING.md).
π¦ Files and loading
| File | What it is |
|---|---|
vlm/ |
Merged Qwen3-VL-30B-A3B (bf16 safetensors, 17 shards, LoRA merged) with tokenizer, processor and chat template |
skanda_heads.pt |
SAM 2.1 (image encoder and trained mask decoder), the [SEG] projector and the score head |
skanda_config.json |
[SEG] token id 151669, training arguments, calibrated gate thresholds per modality, hint thresholds |
hint_scores.jsonl |
Score-head outputs the hint thresholds were chosen on (validation and dev only, never test) |
62.6 GB in total (58.3 GiB); see memory and quantization. The model, training and inference code is open source (Apache-2.0): github.com/Hitheshkaranth/Skanda-0.
huggingface-cli download hitheshkaranth/Skanda-0 --local-dir skanda-0 # bf16
huggingface-cli download hitheshkaranth/Skanda-0-int8 --local-dir skanda-0-int8 # int8 build of main
huggingface-cli download hitheshkaranth/Skanda-0-int4 --local-dir skanda-0-int4 # int4 build of main
# in a checkout of github.com/Hitheshkaranth/Skanda-0
from PIL import Image
from skanda.serve import Skanda
sk = Skanda("skanda-0") # vlm/ + skanda_heads.pt + skanda_config.json; int8/int4 load the same way
report, raw_text, finished, n_tokens = sk.read(Image.open("chest.png").convert("RGB"))
python -m skanda.serve --model skanda-0 --port 1234 # the HTTP server the Skanda Radiology app calls
πΎ Memory and quantization
Memory (bf16, measured)
| Size | Notes | |
|---|---|---|
| Download / disk | 62.6 GB | 58.3 GiB: vlm/ 57.9 GiB + skanda_heads.pt 0.43 GiB |
| Inference, steady | ~68 GB | chest X-ray, CT/MRI slices and 32-slice volumes alike; one read at a time |
| Inference, peak | ~93 GB | while loading the checkpoint and on the largest volumes |
Measured on an NVIDIA DGX Spark (GB10, 128 GB unified memory) from node memory during run 3's test evaluation and app benchmark, minus the idle baseline. The server runs in a container capped at 112 GB.
| Hardware | Fits? |
|---|---|
| DGX Spark / GB10, 128 GB unified | β tested: everything here was trained and benchmarked on one |
| 1 Γ 80 GB GPU (A100 / H100 80 GB) | β οΈ expected to fit: 62 GB of weights + activations; not tested |
2 Γ 48 GB GPUs (device_map="auto") |
β οΈ expected to fit; not tested |
| 24β48 GB GPUs | β not at bf16; needs a quantized build (below) |
Quantized builds
Weight-only builds of this checkpoint, with gates re-calibrated per build. Only the language model is
quantized; the SAM 2.1 decoder, [SEG] projector and score head stay bf16. Each build's card has the full benchmark
against MedGemma 27B, MAIRA-2 and MedGemma + MAIRA-2 at the matching precision.
| bf16 (this repo) | int8 | int4 | |
|---|---|---|---|
| Download | 62.6 GB | 32.8 GB | 18.2 GB |
| Method | β | int8 per-row | int4 group-128 |
| π©» X-ray right finding type | 39 | 40.5 | 36 |
| π©» X-ray box precision | 24.5 | 24 | 17.5 |
| π©» X-ray box recall | 9.5 | 8.5 | 8.5 |
| π« CT normals called normal | 91 | 85 | 78 |
| π« CT right finding type | 72 | 72 | 74 |
| π« CT box precision | 22 | 21 | 19 |
| π§ MRI right finding type | 89 | 87 | 80 |
| π§ MRI box recall | 65 | 67 | 49 |
| Loss per token on bf16's own replies | 0.0823 | 0.0824 | 0.1181 |
Percent on the held-out test cases above (bf16 re-read with the same code and calibration as the builds). int8 is effectively lossless and is the recommended smaller build; int4 loses accuracy, most on MRI box recall.
π Licence
CC BY-NC 4.0 (Creative Commons Attribution-NonCommercial 4.0):
free for research and other non-commercial use, with attribution. Commercial use requires written permission from
the author: open a request in this repository's Discussions.
The licence text is in LICENSE; upstream licences and data attributions (Qwen3-VL, Sa2VA, SAM 2 and the
training datasets) are in NOTICE. Research use only; not a medical device.
- Downloads last month
- 137