Downloads · 30 days
0
david125tran/fraud-qLoRA-adapter
fraud-qLoRA-adapter is a machine learning model from david125tran. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
This model is a QLoRA-fine-tuned version of microsoft/Phi-3-mini-4k-instruct, trained to classify credit-card transactions as fraudulent (1) or legitimate (0) using textual prompts generated from tabular data.
Downloads · 30 days
0
Access
Public
Updated Nov 10, 2025
Repo size
496 MB
Likes
0
Public
Click a slice to open those files.
.safetensors162 MB · 91%
From the Hugging Face model README
This model is a QLoRA-fine-tuned version of microsoft/Phi-3-mini-4k-instruct, trained to classify credit-card transactions as fraudulent (1) or legitimate (0) using textual prompts generated from tabular data.
The goal was to teach an LLM to handle highly imbalanced binary classification, where fraud cases are extremely rare.
microsoft/Phi-3-mini-4k-instructEach row of the credit-card dataset was converted into a natural-language prompt describing the transaction.
Original fraud ratio: ~0.17%
Upsampled frauds to ~10% for fine-tuning to avoid majority-class collapse.
| Metric | Score |
|---|---|
| Accuracy | 0.993 |
| Precision | 0.273 |
| Recall | 0.923 ✅ |
| F1 Score | 0.421 |
~0.55 (expected — LLM classification logits not calibrated)
Key Takeaway:
Baseline model detected 0 fraud cases (accuracy illusion).
Fine-tuning + class balancing enabled real fraud detection with high recall.
⚠️ Production financial fraud systems
⚠️ Real-world credit scoring or loan decisions
⚠️ Any high-stakes decision without calibration + supervision
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
tok = AutoTokenizer.from_pretrained("YOUR_USERNAME/YOUR_MODEL_NAME")
model = AutoModelForCausalLM.from_pretrained("YOUR_USERNAME/YOUR_MODEL_NAME")
pipe = pipeline("text-generation", model=model, tokenizer=tok)
prompt = "Transaction: amount=$650.23, time=12:45pm, category=electronics, location=NY. Should we flag it as fraud?"
print(pipe(prompt, max_new_tokens=2, do_sample=False))