Instructions to use segestic/MediliteQA-phi3.5-mini-all-med with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use segestic/MediliteQA-phi3.5-mini-all-med with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="segestic/MediliteQA-phi3.5-mini-all-med", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("segestic/MediliteQA-phi3.5-mini-all-med", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("segestic/MediliteQA-phi3.5-mini-all-med", trust_remote_code=True, 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use segestic/MediliteQA-phi3.5-mini-all-med with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "segestic/MediliteQA-phi3.5-mini-all-med" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "segestic/MediliteQA-phi3.5-mini-all-med", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/segestic/MediliteQA-phi3.5-mini-all-med
- SGLang
How to use segestic/MediliteQA-phi3.5-mini-all-med 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 "segestic/MediliteQA-phi3.5-mini-all-med" \ --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": "segestic/MediliteQA-phi3.5-mini-all-med", "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 "segestic/MediliteQA-phi3.5-mini-all-med" \ --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": "segestic/MediliteQA-phi3.5-mini-all-med", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use segestic/MediliteQA-phi3.5-mini-all-med with Docker Model Runner:
docker model run hf.co/segestic/MediliteQA-phi3.5-mini-all-med
MediLITE-QA
MediLITE-QA is a 3.8B-parameter medical multiple-choice question-answering model designed to run on a consumer-laptop CPU without a GPU or cloud connection. It was obtained by fine-tuning Phi-3.5-mini-instruct with QLoRA and merging the adapter into the base weights. This repository holds the merged model in Transformers format. The model is described in:
Odewole, O.O.; Başaran, S. MediLITE-QA: Energy-Efficient Medical Question Answering with a Quantized Domain-Specific Language Model on a Commodity Laptop CPU. Sustainability 2026, 18(21), 11245. https://doi.org/10.3390/su182111245
For research use only. The model is not a medical device and must not be used to inform patient care.
Model family
| Artifact | Repository |
|---|---|
| Merged model (this repository) | segestic/MediliteQA-phi3.5-mini-all-med |
| LoRA adapter | segestic/phi3.5-mini-4k-qlora-medical-seg-vall_med |
| GGUF quantizations (CPU inference) | segestic/MediLITE-QA-GGUF |
Code and evaluation logs: https://github.com/segestic/Medilite-QA
Intended use
Research on resource-efficient medical language models, including the accuracy, latency, memory, and energy trade-offs of quantized models on commodity CPUs. Clinical decision support and patient-facing applications are out of scope.
How to use
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "segestic/MediliteQA-phi3.5-mini-all-med"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype=torch.float16, device_map="auto")
question = "..."
choices = {"A": "...", "B": "...", "C": "...", "D": "..."}
options = "\n".join(f"{k}. {v}" for k, v in choices.items())
messages = [{"role": "user", "content": f"{question}\n\n Input: {options}"}]
inputs = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, return_tensors="pt", return_dict=True
).to(model.device)
with torch.no_grad():
out = model.generate(**inputs, max_new_tokens=4, do_sample=False)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
The model answers multiple-choice questions with a single letter; use the prompt layout above for best results.
Training
QLoRA fine-tuning of Phi-3.5-mini-instruct on 393,000 records (about 104.5 million tokens) from the training splits of three public datasets:
| Dataset | Share of corpus tokens |
|---|---|
| PubMedQA (PQA-A subset) | 86.06% |
| MedMCQA | 11.46% |
| MedQA-USMLE-4-options | 2.49% |
| Setting | Value |
|---|---|
| LoRA | r = 32, alpha = 256, dropout 0.10; q/k/v/o, gate, up, and down projections |
| Learning rate / schedule | 2e-4, linear |
| Batch size | 4 per device × 8 gradient-accumulation steps (effective 32) |
| Epochs / sequence length | 3 / 512 tokens |
| Precision / hardware | fp16 mixed precision / 1 × NVIDIA Quadro RTX 4000 |
The complete configuration is given in Appendix A of the paper.
Evaluation
Zero-shot accuracy (%) averaged over nine medical benchmarks (7,045 items), scored with lm-evaluation-harness;
brackets show bootstrap 95% confidence intervals. Per-benchmark results are in the paper.
| Model | Average accuracy |
|---|---|
| MediLITE-QA (fp16) | 72.79 [70.95, 74.66] |
| MediLITE-QA (Q4_K_M GGUF) | 71.87 [70.05, 73.76] |
| Phi-3.5-mini-instruct (base) | 68.73 [66.75, 70.62] |
| OpenBioLLM-8B | 72.09 [70.22, 73.94] |
| LLaMA 3 8B | 70.52 [68.65, 72.37] |
Fine-tuning improved average accuracy by 4.06 percentage points over the base model (95% CI 2.40 to 5.70). The average was not significantly different from that of OpenBioLLM-8B.
Efficiency on a consumer-laptop CPU
Q4_K_M GGUF file (2.39 GB), llama-cpp-python, 4 threads, no GPU; Intel Core i5-1135G7 with 6.96 GiB RAM.
| Metric | Value |
|---|---|
| Steady-state time to first token | 1.34 s |
| Time per output token | 117 ms (8.19 tokens/s) |
| Peak resident memory (2,000-token context) | 4,403 MiB (61.8% of RAM) |
| CPU-package energy | 3.17 J per generated token |
The 7–8B open models measured on the same hardware used 1.56–1.98× more CPU energy per token.
Limitations
- Not clinically validated. An exploratory blinded review by five clinicians found clinical correctness below that of a frontier reference model, and some responses were flagged for potential harm.
- Output format. The model is trained to answer with a single letter and follows free-form, explanation-style instructions less reliably.
- Training data. Sources are exam-style questions and English-language abstracts and may under-represent other regions and populations.
- Hardware scope. Efficiency results come from one consumer-laptop CPU and should not be assumed to transfer to other devices.
Environmental impact
Fine-tuning used one NVIDIA Quadro RTX 4000 for 1,136.6 h; GPU-board energy was approximately 139 kWh, estimated from logged power telemetry.
Citation
@article{odewole2026medilite,
author = {Odewole, Olusegun Oladele and Başaran, Seren},
title = {MediLITE-QA: Energy-Efficient Medical Question Answering with a Quantized
Domain-Specific Language Model on a Commodity Laptop CPU},
journal = {Sustainability},
volume = {18},
number = {21},
pages = {11245},
year = {2026},
doi = {10.3390/su182111245}
}
- Downloads last month
- 45
Model tree for segestic/MediliteQA-phi3.5-mini-all-med
Base model
microsoft/Phi-3.5-mini-instruct