fabriceyhc/Ministral-DrugDetector-14B-All9
09
Ministral-DrugDetector-14B-All9
A LoRA fine-tune of Ministral-3-14B-Instruct-2512 for multi-class substance use detection in clinical notes. Given a medical note, the model predicts illicit or harmful use across 9 substance classes and classifies each as current, historical, or unknown — all in a single forward pass.
Substances Detected
Output Format
Methamphetamine Illicit Use: True/False/Unknown
Fentanyl Illicit Use: True/False/Unknown
Injection Drug Use: True/False/Unknown
Heroin Illicit Use: True/False/Unknown
Prescription Opioid Misuse: True/False/Unknown
Cocaine Illicit Use: True/False/Unknown
Alcohol Harmful Use: True/False/Unknown
Cannabis Illicit Use: True/False/Unknown
Benzodiazepine Misuse: True/False/Unknown
Methamphetamine Temporal Status: Current/Historical/Unknown/N/A
Fentanyl Temporal Status: Current/Historical/Unknown/N/A
Injection Drug Use Temporal Status: Current/Historical/Unknown/N/A
Heroin Temporal Status: Current/Historical/Unknown/N/A
Prescription Opioid Temporal Status: Current/Historical/Unknown/N/A
Cocaine Temporal Status: Current/Historical/Unknown/N/A
Alcohol Temporal Status: Current/Historical/Unknown/N/A
Cannabis Temporal Status: Current/Historical/Unknown/N/A
Benzodiazepine Temporal Status: Current/Historical/Unknown/N/APerformance (held-out test set, n=187 clinical notes)
Illicit Use Detection (F1, positive class = True)
Temporal Classification (accuracy among True cases)
Training
- Base model:
mistralai/Ministral-3-14B-Instruct-2512 - Method: LoRA (r=16, alpha=32, dropout=0.05, targets: q/k/v/o_proj)
- Training data: 495 manually annotated clinical notes (UCLA Health, de-identified)
- Epochs: 3 | Batch size: 1 (grad accum 2) | LR: 2e-4
- Trainable parameters: 22.8M (0.16% of 14B)
- Hardware: 1× NVIDIA RTX A6000 (48GB)
Usage
from transformers import AutoTokenizer
from peft import PeftModel
import torch
try:
from transformers import Mistral3ForConditionalGeneration
model = Mistral3ForConditionalGeneration.from_pretrained(
"mistralai/Ministral-3-14B-Instruct-2512",
torch_dtype=torch.bfloat16, device_map="auto"
)
except ImportError:
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained(
"mistralai/Ministral-3-14B-Instruct-2512",
torch_dtype=torch.bfloat16, device_map="auto"
)
model = PeftModel.from_pretrained(model, "fabriceyhc/Ministral-DrugDetector-14B-All9")
model.eval()
tokenizer = AutoTokenizer.from_pretrained("fabriceyhc/Ministral-DrugDetector-14B-All9")
note = "Patient presents with polysubstance use disorder. History of IV heroin use, now on MAT. Recent urine tox positive for methamphetamine."
prompt = f"""<s>[INST] ### Task Description:
Please carefully review the following medical note and identify illicit or harmful substance use.
### The medical note to evaluate:
{note}
### Answer:
[/INST]"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
output = model.generate(**inputs, max_new_tokens=300, do_sample=False)
print(tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))Intended Use
Designed for NLP annotation of de-identified clinical notes in research settings. Not intended for clinical decision-making.
Framework versions
- PEFT 0.18.1
