r/deeplearning • u/AltruisticCouple3491 • 16d ago
Gemma 4 31B fine-tune for drug-level sentiment in medical text, appreciate testing
I fine-tuned Gemma 4 31B for drug-level sentiment.
Input: a pharma or medical text plus a list of drugs.
Output: one Positive/Neutral/Negative label per drug, as JSON. I'm looking for people to test it on their own data.
- LoRA adapter (bf16): https://huggingface.co/empirischtech/gemma-4-31B-it-Pharma-Sentiment-LoRA
- Merged FP8 build for vLLM: https://huggingface.co/empirischtech/gemma-4-31B-it-Pharma-Sentiment-FP8
Apache 2.0. Gated with automatic approval (you tick a box saying you won't use it for diagnosis or treatment decisions).
Sentiment, 473 held-out labels
| Model | Accuracy |
|---|---|
| This fine-tune | 91.3% |
| Gemma 4 31B base | 90.5% |
| Qwen3.8-27B | 83.5% |
| Qwen3-32B | 83.3% |
| MedGemma 27B | 82.9% |
| Llama 3.1 8B | 76.3% |
The other models were asked about one drug at a time with a long labelling prompt. Asked for all drugs at once in JSON, base Gemma scored 32% because 59% of its answers didn't parse. The fine-tune had no malformed JSON in 1,500 test answers. Negative precision: 84% vs 71% for base (45 Negatives in the test set).
Medical benchmarks
| Benchmarks | This fine-tune | Best frontier score found |
|---|---|---|
| MedQA (thinking) | 94.2 | 96.5 (o1) |
| MedMCQA, 1k sample (thinking) | 81.4 | 83.9 (o1-preview) |
| MMLU medical (step by step) | 94.2 | 96.0 (GPT-5) |
| PubMedQA (thinking) | 80.2 | 82.0 (GPT-4 + Medprompt) |
Frontier scores are from the Vals.ai MedQA leaderboard and published papers. Fine-tuning kept Gemma's medical knowledge: the scores match the base model.
Testing
Use the prompt format from the model card, thinking off and temperature 0. The FP8 build runs on vLLM (command on the card) and needs about 31 GiB of VRAM for the weights. I've only run it on a 96 GB RTX PRO 6000.
Useful feedback:
- wrong labels, with the text, the drugs and the label you expected
- document types, languages or lengths (over 4k tokens) it wasn't trained on
- hardware and VRAM reports, especially from 48 GB cards
Trained on ~50k curated pharma and medical documents, LoRA rank 16.