Intent classifier v1
blue-machines/Intent-classifier-v1 is a sentence-level 7-class intent classifier.
- Base:
microsoft/Multilingual-MiniLM-L12-H384
- Deploy artifact:
model.onnx โ dynamic INT8 including embeddings (~113 MB)
- Input: a single bare utterance (no
[user] / [assistant] tags)
- Max length: 96
Intent labels
| id |
label |
| 0 |
provide_info |
| 1 |
affirm |
| 2 |
deny |
| 3 |
correction |
| 4 |
question |
| 5 |
clarify_request |
| 6 |
unclear |
Files
| File |
Role |
model.onnx |
Deploy โ INT8 ONNX (~113 MB; embeddings + MatMul quantized; GeGLU head FP32) |
model_int8.onnx |
Same INT8 graph (explicit name) |
model_fp32.onnx |
FP32 ONNX reference |
model.safetensors |
PyTorch weights (checkpoint-2400) |
tokenizer.json / tokenizer_config.json |
XLM-R / MiniLM tokenizer |
label_map.json |
label โ id |
config.json |
Transformer config |
export_metadata.json |
export provenance |
sample200_int8_eval.json |
200-sample INT8 eval snapshot |
Metrics (approximate)
| Split |
Accuracy |
Notes |
| Full test (train-time eval, FP32) |
~0.837 |
checkpoint-2400 |
| 200-sample INT8 (seed=1) all |
0.86 |
natural domain mix |
| 200-sample INT8 Muthoot |
0.8057553956834532 |
|
| 200-sample INT8 synthetic |
0.9836065573770492 |
|
Hard-fail fine-tunes after this checkpoint degraded accuracy โ do not use hardft weights.
Inference
import json
from pathlib import Path
import numpy as np
import onnxruntime as ort
from transformers import AutoTokenizer
MODEL_DIR = Path(".")
MAX_LEN = 96
LABELS = [
"provide_info", "affirm", "deny", "correction",
"question", "clarify_request", "unclear",
]
tokenizer = AutoTokenizer.from_pretrained(MODEL_DIR)
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.unk_token
session = ort.InferenceSession(
str(MODEL_DIR / "model.onnx"),
providers=["CPUExecutionProvider"],
)
def predict_intent(sentence: str) -> dict:
enc = tokenizer(
sentence,
return_tensors="np",
truncation=True,
max_length=MAX_LEN,
padding=True,
)
feed = {
"input_ids": enc["input_ids"].astype(np.int64),
"attention_mask": enc["attention_mask"].astype(np.int64),
}
logits = session.run(None, feed)[0][0]
x = logits.astype(np.float64)
x = x - x.max()
probs = np.exp(x); probs = probs / probs.sum()
pred_id = int(probs.argmax())
return {
"intent": LABELS[pred_id],
"confidence": float(probs.max()),
"probs": {LABELS[i]: float(probs[i]) for i in range(7)},
}
print(predict_intent("Haan, ye sahi hai. Proceed karo."))
Notes
- Intent-only (no LID / LSD).
- Trained on expanded sentence-direct data (synthetic + Muthoot), with Muthoot-upweighted continue-FT.
- Prefer this INT8 deploy over the earlier MatMul-only INT8 export (~389 MB).