Instructions to use mkurman/med-gemma-3-270m-it with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mkurman/med-gemma-3-270m-it with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mkurman/med-gemma-3-270m-it") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mkurman/med-gemma-3-270m-it") model = AutoModelForCausalLM.from_pretrained("mkurman/med-gemma-3-270m-it", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mkurman/med-gemma-3-270m-it with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mkurman/med-gemma-3-270m-it" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mkurman/med-gemma-3-270m-it", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mkurman/med-gemma-3-270m-it
- SGLang
How to use mkurman/med-gemma-3-270m-it 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 "mkurman/med-gemma-3-270m-it" \ --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": "mkurman/med-gemma-3-270m-it", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "mkurman/med-gemma-3-270m-it" \ --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": "mkurman/med-gemma-3-270m-it", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use mkurman/med-gemma-3-270m-it with Docker Model Runner:
docker model run hf.co/mkurman/med-gemma-3-270m-it
Access Gemma on Hugging Face
This repository is publicly accessible, but you have to accept the conditions to access its files and content.
To access Gemma on Hugging Face, you’re required to review and agree to Google’s usage license. To do this, please ensure you’re logged in to Hugging Face and click below. Requests are processed immediately.
Log in or Sign Up to review the conditions and access this model content.
mkurman/med-gemma-3-270m-it
A small, instruction-tuned medical Q&A model built on google/gemma-3-270m-it, fine-tuned on synthetic multi-domain medical question–answer datasets.
Model Details
- Base model:
google/gemma-3-270m-it - Architecture: Decoder-only transformer (Gemma 3, ~270M params)
- Author: Mariusz Kurman
- Task: Instruction-following for medical Q&A
- License: Inherits terms from the Gemma license (please review the base model’s license before use)
Intended Use & Limitations
- Intended use: Educational and research exploration of small medical Q&A models; prototyping pipelines where latency and footprint matter.
- Out of scope / Limitations: Not a medical device. Not for real-world clinical decision-making, triage, or patient care. May generate incorrect, outdated, or fabricated content. Always verify with authoritative sources.
Training Data
- Sources: Multiple synthetic medical Q&A datasets from the author’s internal collection, spanning major disciplines (e.g., internal medicine, neurology, cardiology, OB-GYN, emergency medicine).
- Notes: Synthetic data may contain inaccuracies or distributional quirks; no PHI included.
Training Procedure (summary)
- Objective: Supervised fine-tuning (SFT) on instruction–response pairs.
- Formatting: Instruction (question / task) → short, direct or long deep answer; mixture of single and multi-turn examples.
- Evaluation: Light, qualitative checks on held-out synthetic prompts; no formal benchmark claimed.
Prompting
The model generally responds well to concise instructions.
Gemma-style
<start_of_turn>user
List three red flags for subarachnoid hemorrhage.
<end_of_turn>
<start_of_turn>model
Quickstart (Transformers)
from transformers import AutoTokenizer, AutoModelForCausalLM, TextStreamer
import torch
model_id = "mkurman/med-gemma-3-270m-it"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float32,
device_map="auto"
)
tokens = tokenizer.apply_chat_template([{'role': 'user', 'content': 'Outline initial management steps for suspected anaphylaxis'}], add_generation_prompt=True, return_tensors='pt')
outputs = model.generate(
input_ids=tokens,
max_new_tokens=1024,
use_cache=True,
do_sample=False,
repetition_penalty=1.1,
streamer=TextStreamer(tokenizer, skip_prompt=False),
eos_token_id=tokenizer.eos_token_id
)
Responsible Use
- Do not use for health advice, diagnosis, or treatment decisions.
- Validate all outputs with peer-reviewed guidelines or licensed clinicians.
- Consider adding guardrails (e.g., refusal templates for patient-specific advice).
Known Gaps
- Small parameter count limits depth and factual recall.
- No formal external medical benchmark reporting yet.
- May be sensitive to prompt phrasing; keep instructions short and specific.
Citation
If you use this model, please cite:
@misc{med_gemma_3_270m_it_2025,
title = {mkurman/med-gemma-3-270m-it},
author = {Kurman, Mariusz},
year = {2025},
url = {https://huggingface.co/mkurman/med-gemma-3-270m-it}
}
Changelog
- 2025-09-08: Initial release.
Questions or feedback? Open an issue or discussion on the model page.
- Downloads last month
- -