Downloads · 30 days
5
8% of all-time downloads
fabriceyhc/Ministral-DrugDetector-14B-MFI
Ministral-DrugDetector-14B-MFI is a text generation model from fabriceyhc. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
Ministral-DrugDetector-14B-MFI is a LoRA fine-tuned model for detecting illicit drug use in clinical notes. It is based on mistralai/Ministral-3-14B-Instruct-2512 (14B parameters).
Downloads · 30 days
5
8% of all-time downloads
All-time downloads
62
Public
Repo size
2.3 GB
Likes
1
Public
Click a slice to open those files.
.pt1.5 GB · 55%
From the Hugging Face model README
Ministral-DrugDetector-14B-MFI is a LoRA fine-tuned model for detecting illicit drug use in clinical notes. It is based on mistralai/Ministral-3-14B-Instruct-2512 (14B parameters).
The model performs multi-task classification, predicting:
Ranked 1st out of 3 models in our evaluation (Macro F1: 0.940)
| Drug | F1 | Precision | Recall |
|---|---|---|---|
| Methamphetamine | 0.931 | 0.904 | 0.959 |
| Fentanyl | 0.969 | 1.000 | 0.939 |
| Injection Drug Use | 0.921 | 0.967 | 0.879 |
| Macro Average | 0.940 |
| Drug | Accuracy |
|---|---|
| Methamphetamine | 0.723 |
| Fentanyl | 0.710 |
| Injection Drug Use | 0.679 |
| Average | 0.704 |
| Model | Size | Macro F1 | Temporal Acc |
|---|---|---|---|
| Ministral-DrugDetector-14B-MFI | 14B | 0.940 | 0.704 |
| Llama-DrugDetector-8B-MFI-v2 | 8B | 0.876 | 0.533 |
| MediPhi-DrugDetector-MFI | 3.8B | 0.863 | 0.502 |
from transformers import Mistral3ForConditionalGeneration, MistralCommonBackend
from peft import PeftModel
import torch
# Load base model
base_model = "mistralai/Ministral-3-14B-Instruct-2512"
model = Mistral3ForConditionalGeneration.from_pretrained(
base_model,
torch_dtype=torch.bfloat16,
device_map="auto"
)
# Load LoRA adapter
model = PeftModel.from_pretrained(model, "fabriceyhc/Ministral-DrugDetector-14B-MFI")
# Load tokenizer
tokenizer = MistralCommonBackend.from_pretrained("fabriceyhc/Ministral-DrugDetector-14B-MFI")
# Task instruction
task_instruction = """### Task Description:
Please carefully review the following medical note and identify illicit drug use.
**CRITICAL RULES:**
1. **Positive drug test -> ALWAYS ILLICIT** (unless in medication list)
2. **PMH/History of use -> ILLICIT** (even if historical)
3. **Substance use disorder -> ILLICIT**
4. **Patient self-reports (endorses, reports, admits) -> ILLICIT**
5. **Prescribed/medical use -> NOT ILLICIT**
**Drugs to identify:**
- **Methamphetamine**: Illicit amphetamine use (not prescribed Adderall)
- **Fentanyl**: Illicit fentanyl use (not prescribed patches/procedural)
- **Injection Drug Use**: IV drug use (IVDU, IVDA)
**Temporal Classification:**
- **Current**: Present tense, recent use, positive test
- **Historical**: Past tense, "history of", "former user"
- **Unknown**: Timeframe unclear
### Desired Format:
Methamphetamine Illicit Use: <True/False/Unknown>
Fentanyl Illicit Use: <True/False/Unknown>
Injection Drug Use: <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>"""
# Example note
note_text = "Patient reports using meth daily for the past 2 weeks. Denies IV drug use."
# Format prompt
prompt = f"""<s>[INST] {task_instruction}
### The medical note to evaluate:
{note_text}
### Answer: [/INST]"""
# Generate
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=200,
do_sample=False,
pad_token_id=tokenizer.eos_token_id
)
# Decode
result = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
print(result)
Methamphetamine Illicit Use: True
Fentanyl Illicit Use: False
Injection Drug Use: False
Methamphetamine Temporal Status: Current
Fentanyl Temporal Status: N/A
Injection Drug Use Temporal Status: N/A
Recommended:
Not Recommended:
@misc{ministral-drugdetector-14b-mfi-2025,
author = {Hanna-Chang, Fabrice},
title = {Ministral-DrugDetector-14B-MFI},
year = {2025},
publisher = {HuggingFace},
url = {https://huggingface.co/fabriceyhc/Ministral-DrugDetector-14B-MFI}
}
APACHE-2.0