IntentGuard — Healthcare & Clinical
Production-ready vertical intent classifier for LLM chatbot guardrails. Classifies user messages as allow, deny, or abstain to keep healthcare chatbots on-topic and compliant.
IntentGuard Model Family
Overview
The Problem
Healthcare chatbots face unique regulatory risks — HIPAA compliance, patient safety, and liability exposure demand that AI assistants stay strictly within clinical domains. Users asking about sports scores, celebrity news, or relationship advice should be blocked, not answered.
The Solution
IntentGuard uses a tiny DeBERTa-v3-xsmall model (22M parameters, 2.5MB quantized) to classify user intent in <30ms on CPU with three-way classification:
- Allow — On-topic healthcare query, pass to the LLM
- Deny — Off-topic, block with a polite redirect
- Abstain — Ambiguous, escalate to secondary classifier or human review
Performance
| Metric | Value |
|---|
| Overall Accuracy | 98.9% |
| Legitimate Block Rate | 0.00% |
| Off-Topic Pass Rate | 0.98% |
| p99 Latency (CPU) | <30ms |
| Model Size (ONNX INT8) | 2.5MB |
| Base Parameters | 22M (DeBERTa-v3-xsmall) |
| Expected Calibration Error | <0.03 |
Model Details
| Property | Value |
|---|
| Architecture | DeBERTa-v3-xsmall (fine-tuned for 3-way classification) |
| Format | ONNX (INT8 quantized) |
| Version | 1.0 |
| Vertical | Healthcare (Clinical & Wellness) |
| GPU Required | No — runs on CPU |
| Publisher | perfecXion.ai |
Core Topics (Allow)
Symptoms, diagnosis, treatment, medications, preventive care, nutrition, mental health, fitness, chronic conditions, surgery, emergency care, health insurance, patient rights, telemedicine
Hard Exclusions (Deny)
Sports, entertainment, cooking, gaming, celebrity gossip, fashion, travel/leisure, fiction writing, relationship advice
Usage
Python (ONNX Runtime)
1import onnxruntime as ort
2from transformers import AutoTokenizer
3import numpy as np
4
5tokenizer = AutoTokenizer.from_pretrained("perfecXion/intentguard-healthcare")
6session = ort.InferenceSession("model.onnx")
7
8text = "What are the symptoms of Type 2 diabetes?"
9inputs = tokenizer(text, return_tensors="np", max_length=128, truncation=True, padding="max_length")
10
11logits = session.run(None, {
12 "input_ids": inputs["input_ids"],
13 "attention_mask": inputs["attention_mask"]
14})[0]
15
16labels = ["allow", "deny", "abstain"]
17prediction = labels[np.argmax(logits)]
18confidence = float(np.max(np.exp(logits) / np.sum(np.exp(logits))))
19
20print(f"Intent: {prediction} (confidence: {confidence:.3f})")
21# Output: Intent: allow (confidence: 0.997)
Docker
1docker pull ghcr.io/perfecxion/intentguard:healthcare-1.0
2docker run -p 8080:8080 ghcr.io/perfecxion/intentguard:healthcare-1.0
3
4curl -X POST http://localhost:8080/v1/classify \
5 -H "Content-Type: application/json" \
6 -d '{"messages": [{"role": "user", "content": "What medications interact with metformin?"}]}'
pip
1pip install intentguard
2
3from intentguard import IntentGuard
4guard = IntentGuard.load("healthcare")
5result = guard.classify("What are the symptoms of Type 2 diabetes?")
6print(result) # Intent(label='allow', confidence=0.997)
Example Classifications
| User Message | Predicted | Confidence | Correct? |
|---|
| "What are the symptoms of Type 2 diabetes?" | allow | 0.997 | ✅ |
| "What medications interact with metformin?" | allow | 0.996 | ✅ |
| "Who won the Super Bowl?" | deny | 0.999 | ✅ |
| "Tell me a joke" | deny | 0.996 | ✅ |
| "Is telemedicine covered by Medicare?" | allow | 0.981 | ✅ |
| "What's the best recipe for pasta?" | deny | 0.998 | ✅ |
Citation
1@misc{thornton2025intentguard,
2 title={IntentGuard: A Production-Grade Vertical Intent Classifier for LLM Guardrails},
3 author={Thornton, Scott},
4 year={2025},
5 publisher={perfecXion.ai},
6 url={https://perfecxion.ai/articles/intentguard-vertical-intent-classifier-llm-guardrails.html},
7 note={Model: https://huggingface.co/perfecXion/intentguard-healthcare}
8}
Quality Metrics
| Metric | Result |
|---|
| Accuracy (Healthcare vertical) | 98.9% |
| Legitimate Block Rate | 0.00% |
| Off-Topic Pass Rate | 0.98% |
| Expected Calibration Error | <0.03 |
| ONNX INT8 Quantization | Validated |
| CPU Inference (p99) | <30ms |
License
Apache 2.0
Links