Gemma Jewelry Assistant - Intent & Emotion Classifier
This is an ONNX-optimized multi-task classification model used in the AI Jewelry Showroom project. It analyzes user queries during a jewelry shopping conversation and predicts both the user's intent and emotion simultaneously to enhance Agentic Retrieval-Augmented Generation (RAG) routing.
Model Details
- Architecture: Transformer-based text classifier (multi-task head for Intent and Emotion)
- Format: ONNX (
.onnx and .onnx.data format for >2GB weight externalization)
- Language: English
- Use Case: Conversational e-commerce assistant ("Gemma")
Intended Use
This model is designed to be used in real-time chat environments to route queries and adapt the assistant's tone.
Predicted Intents (10 classes):
browse, search, compare, ask_detail, objection_price, objection_trust, ready_to_buy, ask_education, greeting, farewell
Predicted Emotions (6 classes):
excited, hesitant, confused, confident, frustrated, neutral
Performance & Metrics
The model was fine-tuned and evaluated on a custom dataset of jewelry shopping conversations:
- Intent Classification Accuracy: 89.46% (Macro F1: 84.49%)
- Emotion Classification Accuracy: 82.77% (Macro F1: 60.76%)
- Best parameters during training: Learning Rate: 3e-5, Epochs: 5, Batch Size: 32
Usage (ONNX Runtime)
Since the model uses external data (intent_emotion_classifier.onnx.data), ensure both the .onnx and .onnx.data files are downloaded into the same directory before loading.
1import onnxruntime as ort
2import numpy as np
3
4# 1. Initialize session
5session_options = ort.SessionOptions()
6
7# 2. Load the model. Ensure the .onnx.data file is in the same folder!
8session = ort.InferenceSession("intent_emotion_classifier.onnx", session_options)
9
10# 3. Prepare inputs (e.g., from a tokenizer)
11# inputs = {
12# "input_ids": np.array([[...]], dtype=np.int64),
13# "attention_mask": np.array([[...]], dtype=np.int64)
14# }
15
16# 4. Run inference
17# intent_logits, emotion_logits = session.run(["intent_logits", "emotion_logits"], inputs)
Training Data
The model was trained on synthetic high-end retail conversations regarding jewelry. It covers scenarios like negotiating price (objection_price), comparing gems (compare), and asking about gemological properties (ask_education).