QLoRA: Efficient Finetuning of Quantized LLMs
Paper
β’
2305.14314
β’
Published
β’
58
Fine-tuned version of Microsoft's Phi-3-mini-4k-instruct using QLoRA (Quantized Low-Rank Adaptation) for industrial IoT anomaly detection and interpretable diagnostics.
This model specializes in analyzing industrial sensor data and network telemetry to detect anomalies, identify potential security threats, and provide actionable insights for industrial automation systems.
Key Features:
| Metric | Value |
|---|---|
| Eval Loss | 2.3992 |
| Token Accuracy | 54.51% |
| Eval Runtime | 81.12s |
| Samples/Second | 14.73 |
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
"YOUR_USERNAME/phi3-industrial-anomaly",
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained(
"YOUR_USERNAME/phi3-industrial-anomaly",
trust_remote_code=True
)
# Prepare input
prompt = """<|user|>
Sensor Readings: Temperature: 95Β°C, Vibration: 5.8 m/s, Pressure: 120 kPa, Flow Rate: 6.2 L/min
<|end|>
<|assistant|>"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
# Generate response
outputs = model.generate(
**inputs,
max_new_tokens=150,
temperature=0.7,
do_sample=True,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
from peft import AutoPeftModelForCausalLM
from transformers import AutoTokenizer
import torch
# Load model with LoRA adapters
model = AutoPeftModelForCausalLM.from_pretrained(
"YOUR_USERNAME/phi3-industrial-anomaly",
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained(
"YOUR_USERNAME/phi3-industrial-anomaly",
trust_remote_code=True
)
Network Security Analysis:
<|user|>
Network Telemetry: Arp.Opcode: 0.0, Icmp.Checksum: 0.0, Suspicious packet patterns detected
<|end|>
<|assistant|>
Sensor Diagnostics:
<|user|>
Sensor Readings: Temperature: 110Β°C, Vibration: 7.2 m/s, Pressure: 85 kPa, Flow Rate: 3.1 L/min
<|end|>
<|assistant|>
If you use this model, please cite:
@misc{phi3-industrial-anomaly-2026,
author = {Your Name},
title = {Phi-3 Mini Fine-tuned for Industrial Anomaly Detection},
year = {2026},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/YOUR_USERNAME/phi3-industrial-anomaly}}
}
This model is released under the MIT License. The base Phi-3 model is subject to Microsoft's Phi-3 license.
For questions, issues, or collaboration opportunities, please open an issue in the repository or contact the model author.
Base model
microsoft/Phi-3-mini-4k-instruct