Downloads ยท 30 days
38
3% of all-time downloads
naazimsnh02/dentalgemma-1.5-4b-it
dentalgemma-1.5-4b-it is a image-text-to-text model from naazimsnh02. 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 transformers. The card lists the license as apache-2.0.
DentalGemma is a domain-adapted extension of MedGemma 1.5 4B IT specialized for dental diagnostics and structured clinical reasoning. The model leverages targeted multimodal fine-tuning to enable detailed interpretatiโฆ
Downloads ยท 30 days
38
3% of all-time downloads
All-time downloads
1.3K
Public
Parameters
5B
29.9 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors9.9 GB ยท 100%
From the Hugging Face model README
DentalGemma is a domain-adapted extension of MedGemma 1.5 4B IT specialized for dental diagnostics and structured clinical reasoning. The model leverages targeted multimodal fine-tuning to enable detailed interpretation of dental imaging and comprehensive oral pathology assessment.
Built for the MedGemma Impact Challenge, DentalGemma demonstrates how medical foundation models can be efficiently adapted to underserved healthcare domains using parameter-efficient fine-tuning.
DentalGemma is a multimodal vision-language model that combines:
The model was fine-tuned using LoRA (Low-Rank Adaptation) in a two-stage training pipeline. Unlike typical QLoRA approaches, this model was trained in full bfloat16 precision on an NVIDIA A100 GPU to maximize diagnostic accuracy and avoid quantization artifacts.
| Capability | Description |
|---|---|
| ๐ธ Clinical Photo Analysis | Analyze clinical dental photographs for cavity detection, oral health assessment, and severity evaluation with compositionally-varied clinical descriptions |
| ๐ฅ Pathology Classification | Classify 6 dental conditions from panoramic X-rays (Healthy, Caries, Impacted Teeth, BDC-BDR, Infection, Fractured Teeth) with differential diagnosis and urgency assessment |
| ๐ Location-Aware Diagnosis | Identify and localize pathological findings in panoramic radiographs using dental region mapping (e.g., "right mandibular region", "anterior maxillary region") |
| ๐ฆท Dentition Assessment | Evaluate dentition completeness, tooth type identification, and anatomical overview from panoramic radiographs with clinical context |
| ๐ Structured Radiographic Reports | Generate systematic dental reports with region-specific findings, differential diagnoses, and clinical recommendations |
| ๐ Clinical Case Analysis | Comprehensive diagnosis, treatment planning, antibiotic considerations, and follow-up scheduling for 98 dental conditions |
All data follows a consistent chat template format (system/user/assistant) with a standardized system prompt emphasizing evidence-based assessment and clinical correlation.
To ensure the highest fidelity in X-ray analysis, we trained the model in native bfloat16 precision without quantization:
bfloat16 (no 4-bit quantization)| Parameter | Value |
|---|---|
| Epochs | 5 (Stopped early at ~4 due to convergence) |
| Batch Size | 1 per device ร 4 gradient accumulation |
| Learning Rate | 5e-5 (linear scheduler) |
| Warmup Ratio | 0.1 |
| Max Sequence Length | 1024 |
| Optimizer | AdamW (fused) |
| Precision | bfloat16 (Full) |
| LoRA Rank | 64 |
| LoRA Alpha | 64 |
| LoRA Dropout | 0.05 |
| Target Modules | All linear layers |
| Max Grad Norm | 1.0 |
| Training Time | ~4 hours |
| Parameter | Value |
|---|---|
| Epochs | 5 (Stopped at ~4 due to convergence) |
| Batch Size | 2 per device ร 4 gradient accumulation |
| Learning Rate | 5e-5 (linear scheduler) |
| Warmup Ratio | 0.1 |
| Max Sequence Length | 1024 |
| Max Grad Norm | 1.0 |
| Step | Training Loss | Validation Loss |
|---|---|---|
| 100 | 1.5756 | 1.3255 |
| 500 | 0.1846 | 0.1917 |
| 1000 | 0.1611 | 0.1665 |
| 1500 | 0.1408 | 0.1628 |
| 2000 | 0.1466 | 0.1612 |
| 2100 | 0.1339 | 0.1585 (Best) |
| 2300 | 0.1150 | 0.1595 |
Note: Training was stopped early after Step 2300 as validation loss began to plateau. The checkpoint from Step 2100 was selected as the optimal VQA model.
Final VQA Metrics:
| Step | Training Loss | Validation Loss |
|---|---|---|
| 100 | 0.2984 | 0.2111 |
| 200 | 0.0594 | 0.0447 |
| 300 | 0.0131 | 0.0331 |
| 400 | 0.0100 | 0.0293 |
| 500 | 0.0045 | 0.0224 (Best) |
| 600 | 0.0068 | 0.0225 |
| 1000 | 0.0018 | 0.0270 |
Note: Training was stopped early after Step 1000 as validation loss began to rise. The checkpoint from Step 500 was selected as the final model.
Final Instruct Metrics:
pip install torch torchvision transformers accelerate pillow bitsandbytes
from transformers import AutoProcessor, AutoModelForImageTextToText
from PIL import Image
import torch
# Load model and processor
model_id = "naazimsnh02/dentalgemma-1.5-4b-it"
model = AutoModelForImageTextToText.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto"
)
processor = AutoProcessor.from_pretrained(model_id)
# Prepare input
image = Image.open("dental_xray.jpg")
messages = [
{
"role": "system",
"content": [{"type": "text", "text": "You are an expert dental clinician and radiologist AI assistant."}]
},
{
"role": "user",
"content": [
{"type": "image", "image": image},
{"type": "text", "text": "Analyze this dental X-ray for any abnormalities."}
]
}
]
# Generate response
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=300, do_sample=False)
generated_ids = outputs[0][inputs["input_ids"].shape[-1]:]
response = processor.decode(generated_ids, skip_special_tokens=True)
print(response)
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
# Load model and tokenizer
model_id = "naazimsnh02/dentalgemma-1.5-4b-it"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto"
)
# Prepare clinical case
messages = [
{
"role": "system",
"content": "You are an expert dental clinician and radiologist AI assistant."
},
{
"role": "user",
"content": "A 35-year-old male presents with severe throbbing pain in the lower right molar region for 3 days. Clinical exam shows deep carious lesion on tooth #46 with tenderness to percussion. Periapical radiograph shows periapical radiolucency. Patient has no significant medical history. What is your assessment and management plan?"
}
]
# Generate response
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True).to(model.device)
outputs = model.generate(inputs, max_new_tokens=512, do_sample=False)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
DentalGemma inherits the architecture from MedGemma 1.5 4B IT:
The LoRA fine-tuning adds trainable adapters (rank 64) to all linear layers. The final model merges these adapters back into the full-precision base weights for optimal inference performance.
The model demonstrates strong performance on:
VQA Training (Stage 1):
Instruct Training (Stage 2):
This model is NOT a substitute for professional dental diagnosis. All AI-generated assessments must be validated by licensed dental professionals before any clinical use. The model is provided "as-is" for research purposes only.
This model was developed for the MedGemma Impact Challenge.
If you use DentalGemma in your research, please cite:
@misc{dentalgemma2026,
title={DentalGemma: Fine-tuning MedGemma for Dental Diagnostics},
author={Syed Naazim Hussain},
year={2026},
publisher={HuggingFace},
howpublished={\url{https://huggingface.co/naazimsnh02/dentalgemma-1.5-4b-it}},
note={MedGemma Impact Challenge submission}
}
Base Model Citation:
@misc{medgemma2024,
title={MedGemma: Medical Foundation Models from Google Health},
author={Google Health AI},
year={2024},
publisher={HuggingFace},
howpublished={\url{https://huggingface.co/google/medgemma-1.5-4b-it}}
}
Challenge Citation:
@misc{medgemma-impact-challenge,
author={Fereshteh Mahvar and Yun Liu and Daniel Golden and others},
title={The MedGemma Impact Challenge},
year={2026},
howpublished={\url{https://kaggle.com/competitions/med-gemma-impact-challenge}}
}
Built for the MedGemma Impact Challenge ๐ฅ
Bringing dental diagnostics into the age of medical foundation models ๐ฆท
</div>