OncoLLM-4B

DOI

Rapport technique / Technical report : OncoLLM: adapting MedGemma 4B and 27B to oncology tasks, Pierre Antoine, Zenodo, 2026, DOI 10.5281/zenodo.23134374 (PDF FR et EN / PDF in French and English). Jeu d'évaluation / Evaluation set : OncoLLM-Quiz-Onco-v1.

Français

OncoLLM-4B est un modèle de langage médical, ajusté (fine-tuning) à partir de google/medgemma-4b-it pour des tâches d'oncologie en français et en anglais : extraction de biomarqueurs, réponse au traitement, typage TCGA (type, T, N, M), codage CIM-10 et questions à choix de type MediQAl. Auteur : Pierre Antoine.

Dépôt du modèle complet (poids fusionnés), utilisable directement.

Usage prévu et limites d'usage

  • Modèle de recherche : il n'est pas un dispositif médical, n'a fait l'objet d'aucune validation clinique et ne doit pas servir à décider seul d'une prise en charge. Son usage doit respecter la politique d'usage interdit et les conditions HAI-DEF (voir Licence).
  • Seule la partie texte a été ajustée et évaluée, la partie vision de MedGemma 4B n'a été ni modifiée ni évaluée.
  • Il sait réciter le serment d'Hippocrate (version du Conseil national de l'Ordre des médecins, 2012) et répondre à des questions sur son contenu.

Entraînement

  • Modèle de base : google/medgemma-4b-it. Méthode : LoRA 16 bits, rang 64, alpha 16, taux d'apprentissage 2e-4 décroissant, 2 époques, lot effectif de 16, longueur maximale 4 096 tokens, graine 3407, couches de langage uniquement. Fine-tuning réalisé avec Unsloth. 590 pas d'entraînement.
  • Mélange : 4 718 exemples (jeu d'ajustement du Quiz Onco v1, 4 417 exemples, plus 301 exemples d'identité et de serment, répétés 3 fois et 2 fois).
  • Modèle fusionné en 16 bits (bf16). Fusionné à partir de l'adapter OncoLLM-4B-LoRA avec lora_alpha 32 (échelle 0,5) dans les poids 16 bits de la base : d'après nos mesures, l'adapter agit sous Unsloth avec une échelle effective environ double de lora_alpha / r. Le modèle est stocké en bf16, ce qui fait perdre à l'arrondi de 17 à 37 % des éléments du delta (mesure sur 140 modules). Les résultats ci-dessous sont ceux de ce modèle fusionné ; sa récitation exacte du texte du serment (0/4) est inférieure à celle de l'adapter (4/4).

Données

MediQAl (ANR-MALADES/MediQAl) : questions d'examens médicaux français, tâche Q5 (choix unique, choix multiples). Licence affichée sur la fiche : cc-by-4.0. Splits utilisés : splits officiels train, validation et test, questions d'oncologie uniquement (lexique v2) ; questions ouvertes (oeq) exclues. PARHAF (HealthDataHub/PARHAF, corpus de comptes rendus cliniques fictifs en français) : tâche Q4 (codage CIM-10, pool « General » uniquement). Licences annoncées dans l'article : CC BY 4.0 et Etalab 2.0. PARHAF-biomarkers-annotated et PARHAF-response_to_treatment-annotated (HealthDataHub) : Q1 (biomarqueurs) pour le premier jeu, Q2 (réponse au traitement) pour le second. Licence affichée sur la fiche HF de chacun des deux jeux : cc-by-4.0. PARCOMED (HealthDataHub/PARCOMED) : utilisé pour sonder la couverture oncologique pendant la conception du Quiz (scripts d'exploration) ; non chargé par les scripts qui construisent le Quiz ni par ceux qui entraînent le modèle. Licences affichées sur la fiche : cc-by-4.0 et etalab-2.0. TCGA-Reports (Kefeli et Tatonetti, Patterns 5(3), 2024, doi 10.1016/j.patter.2024.100933 ; dépôt github.com/tatonetti-lab/tcga-path-reports sous licence MIT) : tâche Q3 (type de cancer, T, N, M). Les rapports proviennent du TCGA via le portail GDC, dont les données en accès ouvert sont réutilisables avec mention de la source, sans tentative de réidentification des participants (politique du GDC). Serment d'Hippocrate, version CNOM 2012 : texte tiré du site du Conseil national de l'Ordre des médecins. Quiz Onco v1 : construit par l'auteur à partir des sources ci-dessus.

Évaluation

Quiz Onco v1, jeu d'évaluation de 9 tâches publié sur Hugging Face, sur un sous-ensemble déterministe de 150 éléments au plus par tâche et par division. Précision, sauf Q3 M (F1 macro, la classe majoritaire pèse 94 %). Les effectifs de Q2 (19 et 23) sont trop faibles pour conclure.

Tâche Métrique Modèle de base (val / test) OncoLLM-4B (val / test)
Q1 biomarqueurs précision 0,871 / 0,818 0,931 / 0,975
Q2 réponse au traitement (n=19 / 23) précision 0,737 / 0,435 0,842 / 0,652
Q3 TCGA type précision 0,747 / 0,807 0,987 / 0,967
Q3 TCGA T précision 0,700 / 0,760 0,780 / 0,833
Q3 TCGA N précision 0,853 / 0,820 0,907 / 0,933
Q3 TCGA M F1 macro 0,405 / 0,480 0,799 / 0,850
Q4 codage CIM-10, code exact précision 0,097 / 0,047 0,376 / 0,271
Q4 CIM-10, catégorie à 3 caractères précision 0,290 / 0,224 0,796 / 0,765
Q5 MediQAl choix unique précision 0,513 / 0,187 0,633 / 0,213
Q5 MediQAl choix multiples précision 0,178 / 0,067 0,262 / 0,107

Serment et identité (jeu de test interne) : identité 13/14 ; texte complet du serment 0/4 ; questions sur le contenu, formulations non vues 10/24.

Limites connues : la division test de Q5 est nettement plus difficile que la division validation, sans explication établie à ce jour ; les intervalles de confiance et les comparaisons appariées figurent dans le rapport technique publié sur Zenodo (DOI 10.5281/zenodo.23134374).

Utilisation

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

repo = "Grujowmi/OncoLLM-4B"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype=torch.bfloat16, device_map="auto")
messages = [{"role": "user", "content": "Qui es-tu ?"}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt", return_dict=True).to(model.device)
out = model.generate(**inputs, max_new_tokens=100, do_sample=False)
print(tok.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))

Licence

Ce modèle est un dérivé de MedGemma, fourni selon les Health AI Developer Foundations Terms of Use. En l'utilisant ou en le redistribuant, vous acceptez de respecter les restrictions d'usage de la section 3.2 de ces conditions et la politique d'usage interdit, et vous devez les inclure dans tout accord régissant l'usage ou la distribution de ce modèle ou de ses dérivés. Voir aussi le fichier NOTICE. Une autorisation réglementaire de santé peut être requise selon l'usage.

Remerciements : Google (MedGemma), Unsloth, Hugging Face.

English

OncoLLM-4B is a medical language model fine-tuned from google/medgemma-4b-it for oncology tasks in French and English: biomarker extraction, treatment response, TCGA typing (type, T, N, M), ICD-10 coding and MediQAl-style multiple-choice questions. Author: Pierre Antoine.

Repository of the full model (merged weights), ready to use.

Intended use and limits

  • Research model: it is not a medical device, has had no clinical validation, and must not be used on its own to decide patient care. Use must comply with the prohibited use policy and the HAI-DEF terms (see License).
  • Only the text part was fine-tuned and evaluated, the vision part of MedGemma 4B was neither modified nor evaluated.
  • It can recite the Hippocratic Oath (version of the French Medical Council, 2012) and answer questions about its content.

Training

  • Base model: google/medgemma-4b-it. Method: 16-bit LoRA, rank 64, alpha 16, learning rate 2e-4 with linear decay, 2 epochs, effective batch size 16, maximum length 4,096 tokens, seed 3407, language layers only. Fine-tuned with Unsloth. 590 training steps.
  • Mixture: 4,718 examples (Quiz Onco v1 fine-tuning split, 4,417 examples, plus 301 identity and oath examples, repeated 3 and 2 times).
  • Merged 16-bit (bf16) model. Merged from the OncoLLM-4B-LoRA adapter with lora_alpha 32 (scale 0.5) into the 16-bit base weights: according to our measurements, the adapter acts under Unsloth with an effective scale about twice lora_alpha / r. The model is stored in bf16, which loses 17 to 37% of the delta elements to rounding (measured on 140 modules). The results below are those of this merged model; its exact recitation of the oath text (0/4) is lower than the adapter's (4/4).

Data

MediQAl (ANR-MALADES/MediQAl): French medical exam questions, task Q5 (single answer, multiple answers). License shown on the dataset page: cc-by-4.0. Splits used: official train, validation and test splits, oncology questions only (lexicon v2); open-ended questions (oeq) excluded. PARHAF (HealthDataHub/PARHAF, corpus of fictional French clinical reports): task Q4 (ICD-10 coding, "General" pool only). Licenses announced in the paper: CC BY 4.0 and Etalab 2.0. PARHAF-biomarkers-annotated and PARHAF-response_to_treatment-annotated (HealthDataHub): Q1 (biomarkers) for the first dataset, Q2 (treatment response) for the second. License shown on the HF page of each of the two datasets: cc-by-4.0. PARCOMED (HealthDataHub/PARCOMED): used to probe oncology coverage while designing the Quiz (exploration scripts); not loaded by the scripts that build the Quiz nor by those that train the model. Licenses shown on the dataset page: cc-by-4.0 and etalab-2.0. TCGA-Reports (Kefeli and Tatonetti, Patterns 5(3), 2024, doi 10.1016/j.patter.2024.100933; repository github.com/tatonetti-lab/tcga-path-reports under the MIT license): task Q3 (cancer type, T, N, M). The reports come from TCGA through the GDC portal, whose open-access data can be reused with attribution of the source and without attempting to re-identify participants (GDC policy). Hippocratic Oath, CNOM 2012 version: text taken from the website of the French National Medical Council (Conseil national de l'Ordre des médecins). Quiz Onco v1: built by the author from the sources above.

Evaluation

Quiz Onco v1, a 9-task evaluation set published on Hugging Face, on a deterministic subset of at most 150 items per task and split. Accuracy, except Q3 M (macro F1, the majority class is 94%). Q2 sample sizes (19 and 23) are too small to conclude.

Task Metric Base model (val / test) OncoLLM-4B (val / test)
Q1 biomarkers accuracy 0.871 / 0.818 0.931 / 0.975
Q2 treatment response (n=19 / 23) accuracy 0.737 / 0.435 0.842 / 0.652
Q3 TCGA type accuracy 0.747 / 0.807 0.987 / 0.967
Q3 TCGA T accuracy 0.700 / 0.760 0.780 / 0.833
Q3 TCGA N accuracy 0.853 / 0.820 0.907 / 0.933
Q3 TCGA M macro F1 0.405 / 0.480 0.799 / 0.850
Q4 ICD-10 coding, exact code accuracy 0.097 / 0.047 0.376 / 0.271
Q4 ICD-10, 3-character category accuracy 0.290 / 0.224 0.796 / 0.765
Q5 MediQAl single answer accuracy 0.513 / 0.187 0.633 / 0.213
Q5 MediQAl multiple answers accuracy 0.178 / 0.067 0.262 / 0.107

Oath and identity (internal test set): identity 13/14; full oath text 0/4; content questions, unseen phrasings 10/24.

Known limitation: the Q5 test split is much harder than the validation split, with no established explanation yet; confidence intervals and paired comparisons are given in the technical report published on Zenodo (DOI 10.5281/zenodo.23134374).

Usage

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

repo = "Grujowmi/OncoLLM-4B"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype=torch.bfloat16, device_map="auto")
messages = [{"role": "user", "content": "Qui es-tu ?"}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt", return_dict=True).to(model.device)
out = model.generate(**inputs, max_new_tokens=100, do_sample=False)
print(tok.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))

License

This model is a derivative of MedGemma, provided under the Health AI Developer Foundations Terms of Use. By using or redistributing it you agree to comply with the use restrictions in Section 3.2 of those terms and the prohibited use policy, and you must include them in any agreement governing the use or distribution of this model or its derivatives. See also the NOTICE file. Health regulatory authorization may be required depending on the use.

Acknowledgements: Google (MedGemma), Unsloth, Hugging Face.

Citation

@misc{antoine2026oncollm,
  author    = {Antoine, Pierre},
  title     = {OncoLLM: adapting MedGemma 4B and 27B to oncology tasks},
  year      = {2026},
  publisher = {Zenodo},
  doi       = {10.5281/zenodo.23134374},
  url       = {https://zenodo.org/records/23134374}
}
Downloads last month
8
Safetensors
Model size
4B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Grujowmi/OncoLLM-4B

Finetuned
(629)
this model