Tasfiya025 commited on
Commit
4259005
·
verified ·
1 Parent(s): df773e1

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +64 -0
README.md ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FinBERT-Multilingual-Intent-and-Sentiment
2
+
3
+ ## Overview
4
+ `FinBERT-Multilingual-Intent-and-Sentiment` is a BERT-based model fine-tuned for joint multi-label classification on financial customer service messages. It is designed to simultaneously classify the **Intent** (e.g., 'Account_Access_Issue', 'Mortgage_Inquiry') and the **Sentiment/Urgency** (e.g., 'Negative', 'Anxious', 'Positive') of a message. The model is trained on a multilingual corpus, supporting English (en), Spanish (es), French (fr), German (de), and Portuguese (pt).
5
+
6
+ The model leverages the robustness of a multilingual BERT base and adapts it specifically for the high-stakes financial domain, making it ideal for automating customer service routing and prioritization.
7
+
8
+ ## Model Architecture
9
+ The model is built upon the **`bert-base-multilingual-cased`** backbone.
10
+ * **Base Model:** BERT (Bidirectional Encoder Representations from Transformers)
11
+ * **Task:** Multi-label Sequence Classification (`BertForSequenceClassification`)
12
+ * **Input Languages:** English, Spanish, French, German, Portuguese
13
+ * **Output:** 8 classification labels (4 Intent labels, 4 Sentiment/Urgency labels). The model is optimized with a Sigmoid activation function and Binary Cross-Entropy Loss to handle independent multi-label prediction.
14
+ * **Max Sequence Length:** 512 tokens
15
+
16
+ ## Intended Use
17
+ * **Automated Customer Service Routing:** Directing messages based on intent (e.g., Fraud alerts go to the security team, Mortgage inquiries go to the loan department).
18
+ * **Prioritization:** Flagging messages with 'Negative' or 'Anxious' sentiment for urgent human intervention.
19
+ * **Financial Market Monitoring:** Analyzing sentiment in multilingual financial news or social media snippets.
20
+ * **Research:** As a strong baseline for transfer learning in related low-resource financial NLP tasks.
21
+
22
+ ## Limitations
23
+ * **Domain Specificity:** The model performs best on messages related to banking, trading, loans, and financial services. Performance degrades on general domain or highly technical domain text (e.g., deep quantitative finance).
24
+ * **Language Scope:** While multilingual, it is limited to the five languages specified in the training set. Performance on other languages is not guaranteed.
25
+ * **Multi-label Ambiguity:** While trained for multi-label, complex messages with mixed intent or complex sarcasm may lead to lower confidence scores.
26
+
27
+ ## Example Code (PyTorch)
28
+
29
+ ```python
30
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
31
+ import torch
32
+
33
+ model_name = "Finance/FinBERT-Multilingual-Intent-and-Sentiment"
34
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
35
+ model = AutoModelForSequenceClassification.from_pretrained(model_name)
36
+
37
+ # Example 1: Spanish Complaint
38
+ text_es = "El virement que hice no ha llegado. Es un servicio terrible."
39
+ # Example 2: English Inquiry
40
+ text_en = "I need to increase my credit card limit before I travel next week."
41
+
42
+ # Process both texts
43
+ inputs = tokenizer([text_es, text_en], return_tensors="pt", padding=True, truncation=True)
44
+ outputs = model(**inputs)
45
+
46
+ # Get predictions
47
+ logits = outputs.logits
48
+ probabilities = torch.sigmoid(logits)
49
+
50
+ # Apply threshold (e.g., 0.5) to get multi-label predictions
51
+ threshold = 0.5
52
+ predictions = (probabilities > threshold).int()
53
+
54
+ # Map predictions back to labels
55
+ labels = model.config.id2label
56
+ predicted_labels = []
57
+ for p in predictions:
58
+ active_labels = [labels[i] for i, val in enumerate(p) if val == 1]
59
+ predicted_labels.append(active_labels)
60
+
61
+ print(f"Spanish Message Labels: {predicted_labels[0]}")
62
+ # Expected output: ['intent: Transfer_Delay_Complaint', 'sentiment: Negative']
63
+ print(f"English Message Labels: {predicted_labels[1]}")
64
+ # Expected output: ['intent: Credit_Limit_Increase_Request', 'sentiment: Neutral']