Instructions to use seawer/clario-gemma-4-e4b-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use seawer/clario-gemma-4-e4b-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("google/gemma-4-E4B-it") model = PeftModel.from_pretrained(base_model, "seawer/clario-gemma-4-e4b-lora") - Notebooks
- Google Colab
- Kaggle
Clario: Gemma 4 E4B LoRA for symptom-diary extraction
A LoRA adapter for google/gemma-4-E4B-it that reads a patient's diary note, written in plain English or Italian, and returns the symptoms in it as structured JSON: each term with the exact words it came from, mapped to the Human Phenotype Ontology (HPO), with negation, family history, severity and onset hints.
It is the patient-side model of Clario, a private symptom diary with a clinic review console, built for the lablab.ai AMD Developer Hackathon (Track 2, Health). The output is input for a clinician's review. It is not a diagnosis and must not be used as one.
Results
Entity F1 on the same 100 held-out synthetic diary rows from the test split of clario-synth-v3. "After resolver" applies Clario's ontology check (clario.extract.resolve_hpo) to every model's output before scoring.
| Model | F1 after resolver | Raw F1 |
|---|---|---|
| This adapter on Gemma 4 E4B (vLLM) | 0.693 | 0.607 |
| Gemma 4 31B IT (AMD Token Factory) | 0.471 | 0.048 |
| Gemma 4 E4B IT, no fine-tune | 0.356 | 0.002 |
Result files with model, backend, date and n are in the repository under eval/results/.
Training
- Data: clario-synth-v3, 2,392 training rows of synthetic diaries written by Gemma 4 31B IT through the AMD Token Factory API, with gold labels by construction. No real patient data.
- Method: bf16 LoRA on the language model's attention and MLP layers (vision and audio towers untouched), r 16, alpha 16, dropout 0.05, learning rate 2e-4, 3 epochs. The checkpoint was chosen on validation F1 after resolver from a sweep over r 16/32 and lr 1e-4/2e-4.
- Hardware: one NVIDIA L40S on Modal.
- Prompt: the system prompt in
train/prompt.pyof the repository, with the diary as the only user turn. Use the same prompt at inference.
Use
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base = AutoModelForCausalLM.from_pretrained("google/gemma-4-E4B-it", torch_dtype="bfloat16", device_map="auto")
model = PeftModel.from_pretrained(base, "seawer/clario-gemma-4-e4b-lora")
tok = AutoTokenizer.from_pretrained("seawer/clario-gemma-4-e4b-lora")
For serving, merge the adapter into the base weights and run it with vLLM, as the Clario demo does.
Limits
- Trained and evaluated on synthetic diaries only. Real patient writing will differ.
- English and Italian only.
- Every extracted term needs a person's review; the Clario app sends unsure terms to the clinician.
- Use is subject to the Gemma terms of use.
- Downloads last month
- 23