portfolio-intent
Classifies a visitor's question on my portfolio site into one of 8 topics, so the chat only retrieves the profile section it needs before calling the LLM.
Labels: about, skills, experience, education, projects, contact, greeting, off_topic
Data
Hand-written questions in Thai and English: 356 for training, 80 held out for testing (10 per label, written separately from the training set, no overlapping text).
Training
Fine-tuned intfloat/multilingual-e5-small, 30 epochs, learning rate 0.0001, batch size 16, max length 64, on a single RTX 2050. I first tried xlm-roberta-base (88.75% test accuracy, 1.1 GB); the smaller e5 model scored higher and fits in 512 MB of RAM when served.
Results (held-out test set)
- Accuracy: 95.00% (PyTorch), 95.00% for the int8 ONNX file in
onnx/that the site actually serves - Macro F1: 94.91%
Confusion matrix (rows = true label, columns = predicted):
| true \ pred | about | skills | experience | education | projects | contact | greeting | off_topic |
|---|---|---|---|---|---|---|---|---|
| about | 8 | 0 | 0 | 0 | 1 | 0 | 0 | 1 |
| skills | 0 | 10 | 0 | 0 | 0 | 0 | 0 | 0 |
| experience | 0 | 0 | 10 | 0 | 0 | 0 | 0 | 0 |
| education | 0 | 0 | 0 | 10 | 0 | 0 | 0 | 0 |
| projects | 0 | 2 | 0 | 0 | 8 | 0 | 0 | 0 |
| contact | 0 | 0 | 0 | 0 | 0 | 10 | 0 | 0 |
| greeting | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 0 |
| off_topic | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 10 |
Known weaknesses
The test set is small (80 questions), so these numbers are rough. I added training examples after looking at the first model's test errors (written fresh, not copied), and compared two base models on the same test set, so the reported accuracy is somewhat optimistic. Remaining errors: project questions that name a technology ("ResNet vs EfficientNet") labelled skills, and "elevator pitch" labelled off_topic. In the site's chat, off_topic does not block a question: it still goes to the LLM, which decides whether to decline.
Use
from transformers import pipeline
clf = pipeline("text-classification", model="KhanisonKNS/portfolio-intent")
clf("มีผลงานอะไรบ้าง") # [{'label': 'projects', 'score': 0.98}]
The onnx/ folder holds an int8 version (119 MB) served with onnxruntime, one text per request.
- Downloads last month
- 18
Model tree for KhanisonKNS/portfolio-intent
Base model
intfloat/multilingual-e5-small