Downloads · 30 days
0
Nikhil00781/smolvlm-256m-cxr-vqa
smolvlm-256m-cxr-vqa is a image-text-to-text model from Nikhil00781. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as apache-2.0.
A LoRA fine-tuned version of SmolVLM-256M-Instruct for visual question answering over chest radiographs, trained on frontal + lateral image pairs from the IU X-Ray dataset.
Downloads · 30 days
0
Access
Public
Updated Sep 22, 2026
Parameters
256M
513 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors513 MB · 99%
From the Hugging Face model README
A LoRA fine-tuned version of SmolVLM-256M-Instruct for visual question answering over chest radiographs, trained on frontal + lateral image pairs from the IU X-Ray dataset.
⚠️ Research and educational use only. This model was built as a learning project on a small (~3,800 study) dataset and has not undergone clinical validation. Do not use it for real diagnostic or clinical decision-making. See Limitations below.
Answering natural-language questions about chest X-ray images: yes/no questions about specific findings (e.g., "Is there evidence of cardiomegaly?"), listing visible abnormalities, and open-ended findings/impression summaries — intended for research, experimentation, and educational demonstration of vision-language model fine-tuning.
For open-ended questions (findings/impression), generate with sampling rather than greedy decoding:
model.generate(**inputs, max_new_tokens=100, do_sample=True, temperature=0.7, top_p=0.9)
from transformers import AutoProcessor, AutoModelForImageTextToText
from PIL import Image
import torch
model_id = "your-username/smolvlm-256m-cxr-vqa" # update to your actual repo id
processor = AutoProcessor.from_pretrained(model_id)
processor.image_processor.do_image_splitting = False # important: disable tiling
model = AutoModelForImageTextToText.from_pretrained(model_id, dtype=torch.bfloat16)
frontal = Image.open("frontal.png").convert("RGB")
lateral = Image.open("lateral.png").convert("RGB")
messages = [{
"role": "user",
"content": [
{"type": "image"}, {"type": "image"},
{"type": "text", "text": "What is the impression of this chest x-ray?"},
],
}]
prompt = processor.apply_chat_template(messages, add_generation_prompt=True)
inputs = processor(text=[prompt], images=[[frontal, lateral]], return_tensors="pt")
output = model.generate(**inputs, max_new_tokens=100, do_sample=True, temperature=0.7, top_p=0.9)
answer = processor.batch_decode(output[:, inputs["input_ids"].shape[1]:], skip_special_tokens=True)
print(answer[0])
Derived from IU X-Ray (OpenI), a public collection of chest radiograph studies paired with free-text radiology reports. Question-answer pairs were generated with a rule-based, label-grounded procedure rather than an LLM, to avoid introducing hallucinated ground truth: closed-form questions were generated from structured MeSH-derived finding labels, and open-ended questions used the report's own Findings/Impression text verbatim as the answer. A label-cleaning step removed 13 bare anatomical terms (e.g., "diaphragm," "lung") that had been miscategorized as abnormal findings in the source data. The training set contains 14,574 question-answer pairs from 3,062 studies; data was split by study (not by individual question) to prevent leakage between train/validation/test.
| Hyperparameter | Value |
|---|---|
| LoRA rank / alpha | 16 / 32 |
| Trainable parameters | 11.96M (4.46%) |
| Images per example | 2 (frontal + lateral) |
| Epochs | 3 |
| Effective batch size | 16 (batch 2 × grad. accum. 8) |
| Learning rate | 2e-4, cosine schedule, 3% warmup |
| Precision | bfloat16 |
| Final train / val loss | 0.609 / 0.459 |
Evaluated on a held-out test set of 382 studies (991 yes/no, 134 list, 717 open-ended questions) using sampling-based decoding (temperature 0.7, top-p 0.9) for both this model and the un-fine-tuned baseline, to ensure a fair comparison.
| Metric | This model | Base model (no fine-tuning) |
|---|---|---|
| Yes/no accuracy | 74.9% | 61.3% |
| Yes/no F1 | 0.804 | 0.732 |
| List-question token-F1 | 0.462 | 0.108 |
| Open-ended token-F1 | 0.373 | 0.068 |
| CheXbert micro-F1 (14 conditions) | 0.492 | 0.322 |
| RadGraph-complete F1 | 0.202 | 0.017 |
CheXbert-F1 and RadGraph-F1 are structured, clinically-grounded metrics (rather than plain word-overlap) that specifically check whether a finding's presence, absence, or uncertainty is stated correctly — used here because standard n-gram metrics were found to be blind to negation errors (e.g., scoring "cardiomegaly is present" as nearly identical to its reference "no cardiomegaly is present").
If you use this model, please cite the underlying base model and dataset:
@misc{smolvlm2024,
title={SmolVLM: small yet mighty Vision Language Model},
author={HuggingFaceTB},
year={2024},
howpublished={\url{https://huggingface.co/blog/smolvlm}}
}
@article{demner2016preparing,
title={Preparing a collection of radiology examinations for distribution and retrieval},
author={Demner-Fushman, Dina and Kohli, Marc D and Rosenman, Marc B and Shooshan, Sonya E and Rodriguez, Laritza and Antani, Sameer and Thoma, George R and McDonald, Clement J},
journal={Journal of the American Medical Informatics Association},
volume={23}, number={2}, pages={304--310}, year={2016}
}
See the full project writeup and code at [https://github.com/Nikhil00781/SmolVLM-VQA-Project].