update README.md file
Browse files
README.md
CHANGED
|
@@ -3,197 +3,193 @@ library_name: transformers
|
|
| 3 |
tags: []
|
| 4 |
---
|
| 5 |
|
| 6 |
-
#
|
| 7 |
|
| 8 |
-
|
| 9 |
|
|
|
|
| 10 |
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
<!-- Provide a longer summary of what this model is. -->
|
| 17 |
-
|
| 18 |
-
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
| 19 |
-
|
| 20 |
-
- **Developed by:** [More Information Needed]
|
| 21 |
-
- **Funded by [optional]:** [More Information Needed]
|
| 22 |
-
- **Shared by [optional]:** [More Information Needed]
|
| 23 |
-
- **Model type:** [More Information Needed]
|
| 24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 25 |
-
- **License:** [More Information Needed]
|
| 26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
-
|
| 28 |
-
### Model Sources [optional]
|
| 29 |
-
|
| 30 |
-
<!-- Provide the basic links for the model. -->
|
| 31 |
-
|
| 32 |
-
- **Repository:** [More Information Needed]
|
| 33 |
-
- **Paper [optional]:** [More Information Needed]
|
| 34 |
-
- **Demo [optional]:** [More Information Needed]
|
| 35 |
-
|
| 36 |
-
## Uses
|
| 37 |
-
|
| 38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 39 |
-
|
| 40 |
-
### Direct Use
|
| 41 |
-
|
| 42 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 43 |
-
|
| 44 |
-
[More Information Needed]
|
| 45 |
-
|
| 46 |
-
### Downstream Use [optional]
|
| 47 |
-
|
| 48 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 49 |
-
|
| 50 |
-
[More Information Needed]
|
| 51 |
-
|
| 52 |
-
### Out-of-Scope Use
|
| 53 |
-
|
| 54 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 55 |
-
|
| 56 |
-
[More Information Needed]
|
| 57 |
-
|
| 58 |
-
## Bias, Risks, and Limitations
|
| 59 |
-
|
| 60 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 61 |
-
|
| 62 |
-
[More Information Needed]
|
| 63 |
-
|
| 64 |
-
### Recommendations
|
| 65 |
-
|
| 66 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 67 |
-
|
| 68 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 69 |
-
|
| 70 |
-
## How to Get Started with the Model
|
| 71 |
-
|
| 72 |
-
Use the code below to get started with the model.
|
| 73 |
-
|
| 74 |
-
[More Information Needed]
|
| 75 |
-
|
| 76 |
-
## Training Details
|
| 77 |
|
| 78 |
-
|
| 79 |
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
[More Information Needed]
|
| 83 |
-
|
| 84 |
-
### Training Procedure
|
| 85 |
-
|
| 86 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 87 |
-
|
| 88 |
-
#### Preprocessing [optional]
|
| 89 |
-
|
| 90 |
-
[More Information Needed]
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
#### Training Hyperparameters
|
| 94 |
-
|
| 95 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 96 |
-
|
| 97 |
-
#### Speeds, Sizes, Times [optional]
|
| 98 |
-
|
| 99 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 100 |
-
|
| 101 |
-
[More Information Needed]
|
| 102 |
-
|
| 103 |
-
## Evaluation
|
| 104 |
-
|
| 105 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 106 |
-
|
| 107 |
-
### Testing Data, Factors & Metrics
|
| 108 |
-
|
| 109 |
-
#### Testing Data
|
| 110 |
-
|
| 111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
| 112 |
|
| 113 |
-
|
| 114 |
|
| 115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
-
|
| 118 |
|
| 119 |
-
|
| 120 |
|
| 121 |
-
|
| 122 |
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
-
|
| 126 |
|
| 127 |
-
|
| 128 |
|
| 129 |
-
|
| 130 |
|
| 131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
|
|
|
| 133 |
|
|
|
|
| 134 |
|
| 135 |
-
##
|
| 136 |
|
| 137 |
-
|
| 138 |
|
| 139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
|
| 141 |
-
|
| 142 |
|
| 143 |
-
|
| 144 |
|
| 145 |
-
|
|
|
|
|
|
|
|
|
|
| 146 |
|
| 147 |
-
|
| 148 |
-
- **Hours used:** [More Information Needed]
|
| 149 |
-
- **Cloud Provider:** [More Information Needed]
|
| 150 |
-
- **Compute Region:** [More Information Needed]
|
| 151 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
|
| 153 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
|
| 155 |
-
|
| 156 |
|
| 157 |
-
|
| 158 |
|
| 159 |
-
|
| 160 |
|
| 161 |
-
|
|
|
|
|
|
|
|
|
|
| 162 |
|
| 163 |
-
|
| 164 |
|
| 165 |
-
|
| 166 |
|
| 167 |
-
|
| 168 |
|
| 169 |
-
|
| 170 |
|
| 171 |
-
|
|
|
|
| 172 |
|
| 173 |
-
|
|
|
|
|
|
|
|
|
|
| 174 |
|
| 175 |
-
|
| 176 |
|
| 177 |
-
|
| 178 |
|
| 179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
|
| 181 |
-
|
| 182 |
|
| 183 |
-
##
|
| 184 |
|
| 185 |
-
|
| 186 |
|
| 187 |
-
|
| 188 |
|
| 189 |
-
##
|
| 190 |
|
| 191 |
-
|
| 192 |
|
| 193 |
-
|
| 194 |
|
| 195 |
-
|
| 196 |
|
| 197 |
-
|
| 198 |
|
| 199 |
-
[
|
|
|
|
|
|
|
|
|
| 3 |
tags: []
|
| 4 |
---
|
| 5 |
|
| 6 |
+
# MagicSupport Intent Classifier (BERT Fine-Tuned)
|
| 7 |
|
| 8 |
+
## Overview
|
| 9 |
|
| 10 |
+
This model is a fine-tuned `bert-base-uncased` model for multi-class intent classification in customer support environments.
|
| 11 |
|
| 12 |
+
It is optimized for:
|
| 13 |
|
| 14 |
+
* Fast inference
|
| 15 |
+
* High accuracy
|
| 16 |
+
* Low deployment cost
|
| 17 |
+
* Production-ready intent routing for support systems
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
+
The model is designed for the MagicSupport platform but is generalizable to structured customer support intent detection tasks.
|
| 20 |
|
| 21 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
+
## Model Details
|
| 24 |
|
| 25 |
+
* Base Model: `bert-base-uncased`
|
| 26 |
+
* Architecture: `BertForSequenceClassification`
|
| 27 |
+
* Task: Multi-class intent classification
|
| 28 |
+
* Number of Intents: 28
|
| 29 |
+
* Training Dataset: `bitext/Bitext-customer-support-llm-chatbot-training-dataset`
|
| 30 |
+
* Loss: CrossEntropy with class weights
|
| 31 |
+
* Framework: Hugging Face Transformers (PyTorch)
|
| 32 |
|
| 33 |
+
---
|
| 34 |
|
| 35 |
+
## Performance
|
| 36 |
|
| 37 |
+
### Validation Metrics (Epoch 5)
|
| 38 |
|
| 39 |
+
* Accuracy: **0.9983**
|
| 40 |
+
* F1 Micro: **0.9983**
|
| 41 |
+
* F1 Macro: **0.9983**
|
| 42 |
+
* Validation Loss: **0.0087**
|
| 43 |
|
| 44 |
+
The model demonstrates strong generalization and stable convergence across 5 epochs.
|
| 45 |
|
| 46 |
+
---
|
| 47 |
|
| 48 |
+
## Example Predictions
|
| 49 |
|
| 50 |
+
| Query | Predicted Intent | Confidence |
|
| 51 |
+
| ------------------------------------- | ---------------- | ---------- |
|
| 52 |
+
| I want to cancel my order | cancel_order | 0.999 |
|
| 53 |
+
| How do I track my shipment | delivery_options | 0.997 |
|
| 54 |
+
| I need a refund for my purchase | get_refund | 0.999 |
|
| 55 |
+
| I forgot my password | recover_password | 0.999 |
|
| 56 |
+
| I have a complaint about your service | complaint | 0.996 |
|
| 57 |
+
| hello | FALLBACK | 0.999 |
|
| 58 |
|
| 59 |
+
The model also correctly identifies low-information inputs and maps them to a fallback intent.
|
| 60 |
|
| 61 |
+
---
|
| 62 |
|
| 63 |
+
## Intended Use
|
| 64 |
|
| 65 |
+
This model is intended for:
|
| 66 |
|
| 67 |
+
* Customer support intent classification
|
| 68 |
+
* Chatbot routing
|
| 69 |
+
* Support ticket categorization
|
| 70 |
+
* Voice-to-intent pipelines (after STT)
|
| 71 |
+
* Pre-routing before LLM or RAG systems
|
| 72 |
|
| 73 |
+
Typical production flow:
|
| 74 |
|
| 75 |
+
User Query → BERT Intent Classifier → Route to:
|
| 76 |
|
| 77 |
+
* Knowledge Base Retrieval
|
| 78 |
+
* Ticketing System
|
| 79 |
+
* Escalation to Human
|
| 80 |
+
* Fallback LLM
|
| 81 |
|
| 82 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
+
## Example Usage
|
| 85 |
+
|
| 86 |
+
```python
|
| 87 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 88 |
+
import torch
|
| 89 |
+
|
| 90 |
+
# Load model and tokenizer from HuggingFace Hub
|
| 91 |
+
model_name = "your-username/magicSupport-intent-classifier"
|
| 92 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 93 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 94 |
+
|
| 95 |
+
# Set device
|
| 96 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 97 |
+
model.to(device)
|
| 98 |
+
model.eval()
|
| 99 |
+
|
| 100 |
+
# Prediction function
|
| 101 |
+
def predict_intent(text, confidence_threshold=0.75):
|
| 102 |
+
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=64)
|
| 103 |
+
inputs = {k: v.to(device) for k, v in inputs.items()}
|
| 104 |
+
|
| 105 |
+
with torch.no_grad():
|
| 106 |
+
outputs = model(**inputs)
|
| 107 |
+
logits = outputs.logits
|
| 108 |
+
probs = torch.softmax(logits, dim=-1)
|
| 109 |
+
confidence, prediction = torch.max(probs, dim=-1)
|
| 110 |
+
|
| 111 |
+
predicted_intent = model.config.id2label[prediction.item()]
|
| 112 |
+
confidence_score = confidence.item()
|
| 113 |
+
|
| 114 |
+
# Apply confidence threshold
|
| 115 |
+
if confidence_score < confidence_threshold:
|
| 116 |
+
predicted_intent = "FALLBACK"
|
| 117 |
+
|
| 118 |
+
return {
|
| 119 |
+
"intent": predicted_intent,
|
| 120 |
+
"confidence": confidence_score
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
# Example usage
|
| 124 |
+
queries = [
|
| 125 |
+
"I want to cancel my order",
|
| 126 |
+
"How do I track my package",
|
| 127 |
+
"I need a refund",
|
| 128 |
+
"hello there"
|
| 129 |
+
]
|
| 130 |
+
|
| 131 |
+
for query in queries:
|
| 132 |
+
result = predict_intent(query)
|
| 133 |
+
print(f"Query: {query}")
|
| 134 |
+
print(f"Intent: {result['intent']}")
|
| 135 |
+
print(f"Confidence: {result['confidence']:.3f}\n")
|
| 136 |
+
```
|
| 137 |
|
| 138 |
+
---
|
| 139 |
|
| 140 |
+
## Design Decisions
|
| 141 |
|
| 142 |
+
* BERT selected over larger LLMs for:
|
| 143 |
|
| 144 |
+
* Low latency
|
| 145 |
+
* Cost efficiency
|
| 146 |
+
* Predictable inference
|
| 147 |
+
* Edge deployability
|
| 148 |
|
| 149 |
+
* Class weighting applied to mitigate dataset imbalance.
|
| 150 |
|
| 151 |
+
* High confidence outputs indicate strong separation between intent classes.
|
| 152 |
|
| 153 |
+
---
|
| 154 |
|
| 155 |
+
## Known Limitations
|
| 156 |
|
| 157 |
+
* Designed for structured customer support queries.
|
| 158 |
+
* May struggle with:
|
| 159 |
|
| 160 |
+
* Highly conversational multi-turn context
|
| 161 |
+
* Extremely domain-specific enterprise terminology
|
| 162 |
+
* Heavy slang or multilingual input
|
| 163 |
+
* Not trained for open-domain conversation.
|
| 164 |
|
| 165 |
+
---
|
| 166 |
|
| 167 |
+
## Future Improvements
|
| 168 |
|
| 169 |
+
* Add MagicSupport real production data for domain adaptation.
|
| 170 |
+
* Add hierarchical intent structure.
|
| 171 |
+
* Introduce confidence threshold calibration.
|
| 172 |
+
* Add OOD (Out-of-Distribution) detection.
|
| 173 |
+
* Quantized inference version for edge deployment.
|
| 174 |
|
| 175 |
+
---
|
| 176 |
|
| 177 |
+
## License
|
| 178 |
|
| 179 |
+
Specify your intended license here (e.g., MIT, Apache-2.0).
|
| 180 |
|
| 181 |
+
---
|
| 182 |
|
| 183 |
+
## Citation
|
| 184 |
|
| 185 |
+
If using this model in research or production, please cite appropriately.
|
| 186 |
|
| 187 |
+
---
|
| 188 |
|
| 189 |
+
## Model Card Author
|
| 190 |
|
| 191 |
+
For any inquiries or support, please reach out to:
|
| 192 |
|
| 193 |
+
* **Author:** [Abhishek Singh](https://github.com/SinghIsWriting/)
|
| 194 |
+
* **LinkedIn:** [My LinkedIn Profile](https://www.linkedin.com/in/abhishek-singh-bba2662a9)
|
| 195 |
+
* **Portfolio:** [Abhishek Singh Portfolio](https://portfolio-abhishek-singh-nine.vercel.app/)
|