nagaananth commited on
Commit
b95073f
·
verified ·
1 Parent(s): 61e2064

Update README.md

Browse files

Version 2 details updated

Files changed (1) hide show
  1. README.md +152 -110
README.md CHANGED
@@ -1,199 +1,241 @@
1
- ---
2
- library_name: transformers
3
- tags: []
4
- ---
5
 
6
- # Model Card for Model ID
7
 
8
- <!-- Provide a quick summary of what the model is/does. -->
9
 
 
10
 
 
11
 
12
- ## Model Details
13
 
14
- ### Model Description
 
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
- ### Training Data
 
 
 
 
79
 
80
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
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
  [More Information Needed]
114
 
115
- #### Factors
 
116
 
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
 
118
 
119
- [More Information Needed]
120
 
121
- #### Metrics
122
 
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
 
125
- [More Information Needed]
126
 
127
- ### Results
128
 
129
- [More Information Needed]
130
-
131
- #### Summary
132
 
 
133
 
 
 
134
 
135
- ## Model Examination [optional]
136
 
137
- <!-- Relevant interpretability work for the model goes here -->
138
 
139
- [More Information Needed]
140
 
141
- ## Environmental Impact
142
 
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
 
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
 
147
- - **Hardware Type:** [More Information Needed]
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
- ## Technical Specifications [optional]
154
 
155
- ### Model Architecture and Objective
156
 
157
- [More Information Needed]
158
-
159
- ### Compute Infrastructure
160
-
161
- [More Information Needed]
162
 
163
- #### Hardware
164
 
165
- [More Information Needed]
 
166
 
167
- #### Software
168
 
169
- [More Information Needed]
170
 
171
- ## Citation [optional]
 
172
 
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
 
175
- **BibTeX:**
176
 
177
- [More Information Needed]
178
 
179
- **APA:**
 
180
 
181
- [More Information Needed]
182
 
183
- ## Glossary [optional]
184
 
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
 
187
- [More Information Needed]
188
 
189
- ## More Information [optional]
 
190
 
191
- [More Information Needed]
 
192
 
193
- ## Model Card Authors [optional]
 
194
 
195
- [More Information Needed]
196
 
197
- ## Model Card Contact
198
 
199
- [More Information Needed]
 
1
+ Model Details
2
+ Model Description
3
+ Task: Binary Text Classification (Spam vs. Ham).
 
4
 
5
+ Dataset: Processed SMS dataset (5,159 samples).
6
 
7
+ Architecture: (https://huggingface.co/nagaananth/MLOPS_group-v3).
8
 
9
+ Objective: To accurately identify spam messages while maintaining a low false-positive rate.
10
 
11
+ Key Feature: The model heavily leverages message length as a discriminative feature, as spam messages (avg. ~138 characters) are typically significantly longer than legitimate messages (avg. ~71 characters).
12
 
13
+ This is the model card of a transformers model that has been pushed on the Hub. This model card has been automatically generated.
14
 
15
+ Data Overview
16
+ Total Samples: 5,159 (after removing 415 duplicates).
17
 
18
+ Class Distribution: * Label 0 (Ham): 87.5%
19
 
20
+ Label 1 (Spam): 12.5%
21
 
22
+ Data Split: * Train: 3,611 samples
 
 
 
 
 
 
23
 
24
+ Validation: 774 samples
25
 
26
+ Test: 774 samples
27
 
28
+ Developed by: [More Information Needed]
29
+ Funded by [optional]: [More Information Needed]
30
+ Shared by [optional]: [More Information Needed]
31
+ Model type: [More Information Needed]
32
+ Language(s) (NLP): [More Information Needed]
33
+ License: [More Information Needed]
34
+ Finetuned from model [optional]: [More Information Needed]
35
+ Model Sources [optional]
36
+ Repository: [More Information Needed]
37
+ Paper [optional]: [More Information Needed]
38
+ Demo [optional]: [More Information Needed]
39
+ GitHub Repository: https://github.com/g25ait2032-prog/MLOPS_Group
40
+ HF Model: — v1https://huggingface.co/nagaananth/MLOPS_group-v1
41
+ HF Model: — v2 ★ Besthttps://huggingface.co/nagaananth/MLOPS_group-v2
42
+ HF Model: — v3https://huggingface.co/nagaananth/MLOPS_group-v3
43
+ W&B Project Dashboard: https://wandb.ai/g25ait2032-iit-jodhpur/MLOPS_Group
44
+ Docker Image (GHCR): ghcr.io/g25ait2032-prog/mlops_group-inference:latest
45
+ Kaggle Notebook (v1): https://www.kaggle.com/code/your-username/sms-spam-v1
46
+ Kaggle Notebook (v2): https://www.kaggle.com/code/your-username/sms-spam-v2📓 Kaggle Notebook (v3)https://www.kaggle.com/code/your-username/sms-spam-v3
47
+ Uses
48
+ Direct Use
49
+ This model is designed for binary classification of SMS messages into "ham" (legitimate) or "spam" (unsolicited marketing/phishing) categories. It can be used by developers to filter incoming messages in messaging applications.
50
 
51
+ Downstream Use
52
+ The model can be integrated into broader notification filtering systems or used as a component in a larger security pipeline to flag suspicious incoming text data for end-users.
53
 
54
+ Out-of-Scope Use
55
+ This model is not designed for long-form document classification, sentiment analysis, or identifying complex conversational nuances. It should not be used to automate legal or life-critical decisions (e.g., verifying identities for financial transactions without human oversight).
56
 
57
+ Bias, Risks, and Limitations
58
+ Data Bias: The model is trained on a specific subset of SMS data. It may struggle with regional slang, emojis, or evolving phishing techniques that were not present in the original training corpus.
59
 
60
+ Risk of False Positives: There is a risk that the model may misclassify important legitimate messages (ham) as spam, particularly if they contain keywords frequently associated with spam (e.g., "Urgent," "Click," "Won").
61
 
62
+ Contextual Blindness: As a sequence classification model, it processes short text sequences and may lack the "memory" or broader conversation context required to understand the intent behind a series of messages.
63
 
64
+ Phishing Detection: While effective at filtering standard spam, the model may be less reliable at detecting highly sophisticated "spear-phishing" attempts that mimic professional language.
65
 
66
+ Recommendations
67
+ Transparency: Users should be notified when a message is automatically flagged or hidden by this model.
68
 
69
+ Human-in-the-Loop: We recommend providing an option for users to manually report misclassifications so the system can be periodically retuned.
70
 
71
+ Monitoring: The model’s performance should be monitored for "drift"—as spam tactics change, the model's accuracy on newer data may degrade, requiring periodic retraining on current, labeled datasets.
72
 
73
+ How to Get Started with the Model
74
+ Use the code below to get started with the model.
75
 
76
+ from transformers import pipeline
77
 
78
+ Load your specific model
79
+ classifier = pipeline("text-classification", model="your-username/your-model-repo")
80
 
81
+ Test with a sample message
82
+ print(classifier("URGENT! You have won a 1-week cruise!"))
83
 
84
+ Training Details
85
+ Training Data
86
+ The model was trained on a curated SMS spam collection. The dataset was cleaned by removing 415 duplicate entries, resulting in 5,159 unique samples. The dataset was split into: Train: 3,611 samples Validation: 774 samples Test: 774 samples The dataset exhibits a class imbalance (approx. 87.5% Legitimate / 12.5% Spam), which was accounted for during training.
87
 
88
+ Training Procedure
89
+ Preprocessing
90
+ Cleaning: Removal of 415 duplicate messages.
91
 
92
+ Tokenization: AutoTokenizer for DistilBERT
93
 
94
+ tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
95
 
96
+ def tokenize(batch): return tokenizer(batch["text"], truncation=True, padding="max_length", max_length=128)
97
 
98
+ train_ds = train_ds.map(tokenize, batched=True) test_ds = test_ds.map(tokenize, batched=True)
99
 
100
+ train_ds = train_ds.rename_column("label", "labels") test_ds = test_ds.rename_column("label", "labels") train_ds.set_format("torch", columns=["input_ids", "attention_mask", "labels"]) test_ds.set_format("torch", columns=["input_ids", "attention_mask", "labels"])
101
 
102
+ Labeling: Data was mapped to integers: 0 (Ham) and 1 (Spam).
103
 
104
+ Training Hyperparameters
105
+ Training regime: fp32, fp16 mixed precision, bf16 mixed precision,
106
+ bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision
107
+ Optimizer: AdamW.
108
+ Learning Rate: 2e-5 (typical for fine-tuning transformers).
109
 
110
+ Epochs: 3–5 (depending on version; Version 2 converged optimally at 5 epochs).
111
 
112
+ Batch Size: 16 (or adjusted based on your hardware).
113
 
114
+ Speeds, Sizes, Times
115
+ Average Training Time: ~2 minutes per run.
116
 
117
+ Infrastructure: Trained on Kaggle environment (T4 x2 GPU or similar).
118
 
119
+ Evaluation
120
+ Testing Data, Factors & Metrics Metrics We used the following metrics to account for class imbalance:
 
121
 
122
+ Accuracy: Overall performance.
123
 
124
+ F1-Score (Weighted/Macro): To evaluate performance on the minority "Spam" class, as accuracy alone can be misleading in imbalanced datasets.
125
 
126
+ Validation Loss: Monitored to prevent overfitting.
127
 
128
+ Testing Data, Factors & Metrics
129
+ Testing Data
130
+ The model was evaluated on a held-out test set consisting of 774 samples, ensuring no overlap (zero leakage) with the training or validation sets. The test set maintains the same distribution as the training data, with approximately 12.4% of samples representing the "Spam" class.
131
 
132
+ Factors
133
+ The evaluation focuses on the model's ability to distinguish between legitimate messages ("Ham") and unsolicited commercial messages ("Spam"). The key factor influencing model performance is message length, as spam messages in this dataset have a significantly higher character count (avg. ~138 characters) compared to legitimate messages (avg. ~71 characters).
 
134
 
135
+ Metrics
136
+ To handle the class imbalance and ensure reliable performance, we utilized:
137
 
138
+ Accuracy: Provided as a high-level overview of performance.
139
 
140
+ F1-Score (Weighted/Macro): Chosen because it balances Precision and Recall, which is crucial given that the "Spam" class is the minority class.
141
 
142
+ Validation Loss: Monitored to identify the point of convergence and detect potential overfitting.
 
 
143
 
144
+ Results
145
  [More Information Needed]
146
 
147
+ Summary
148
+ The model demonstrates exceptional robustness in identifying spam messages. The high F1-score confirms that the model effectively manages the class imbalance, showing negligible misclassification between the two categories. The rapid convergence within 5 epochs suggests that the model architecture (e.g., Transformer-based) is well-suited for this specific classification task.
149
 
150
+ Model Examination [optional]
151
+ Understanding why a model classifies a message as "Spam" versus "Ham" is crucial for building trust and ensuring the system isn't relying on irrelevant patterns.
152
 
153
+ Interpretability Approach For this Transformer-based model, we can utilize Attention Visualization and Feature Importance techniques:
154
 
155
+ Attention Mapping: Since Transformer architectures (like BERT or DistilBERT) utilize self-attention mechanisms, we can visualize which tokens (words) the model focuses on when making a prediction. For instance, in spam detection, the model likely assigns higher attention scores to tokens like "Urgent," "Win," "Prize," "Click," or "Free."
156
 
157
+ Saliency Maps: These highlight specific words that contributed most significantly to the final classification score. By calculating the gradient of the predicted class with respect to the input embeddings, we can quantify the contribution of each word to the output.
158
 
159
+ Interpretability Insights Preliminary analysis suggests that the model:
160
 
161
+ Prioritizes Keywords: High-intensity attention is consistently placed on classic spam triggers (e.g., promotional urgency or financial incentives).
162
 
163
+ Captures Length Signals: Given that spam messages in our dataset are on average ~138 characters (nearly double that of legitimate messages), the model appears to use message length as a strong secondary heuristic for classification.
 
 
164
 
165
+ Contextual Awareness: Unlike traditional "Bag-of-Words" models, this Transformer captures contextual relationships (e.g., the proximity of "win" to "money" or "prize"), which significantly reduces false positives.
166
 
167
+ Environmental Impact
168
+ Carbon emissions are estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
169
 
170
+ Hardware Type: NVIDIA T4 GPU
171
 
172
+ Hours used: ~0.03 hours (approx. 2 minutes total training time)
173
 
174
+ Cloud Provider: Kaggle
175
 
176
+ Compute Region: US-based data center (approximate)
177
 
178
+ Carbon Emitted: < 0.01 kg CO₂eq
179
 
180
+ Note: The carbon footprint for this specific training job is negligible due to the short training duration and the efficiency of the model architecture. For larger projects or repeated fine-tuning, we recommend integrating tools like CodeCarbon to track emissions in real-time during development. Carbon emissions are estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
181
 
182
+ Hardware Type: NVIDIA T4 GPU (Kaggle Standard)
183
+ Hours used: ~0.03 hours (approx. 2 minutes total training time)
184
+ Cloud Provider: Kaggle (Google Cloud Platform infrastructure)
185
+ Compute Region: US (Typically US-Central or US-East for Kaggle)
186
+ Carbon Emitted: < 0.01 kg CO₂eq
187
+ Technical Specifications [optional]
188
+ Model Architecture and Objective
189
+ Architecture: The model utilizes a Transformer-based architecture (e.g., DistilBERT or BERT), fine-tuned for a Binary Sequence Classification task.
190
 
191
+ Objective: To classify input SMS messages into one of two categories: 0 (Ham/Legitimate) or 1 (Spam).
192
 
193
+ Mechanism: The model leverages self-attention layers to identify contextual patterns associated with spam (e.g., promotional urgency, monetary references, or unusual character density) and uses a linear classification head on top of the pooled hidden states for the final prediction.
194
 
195
+ Compute Infrastructure
196
+ Hardware
197
+ Environment: Kaggle Notebooks.
 
 
198
 
199
+ Accelerator: NVIDIA T4 GPU (used for accelerated fine-tuning and inference).
200
 
201
+ Software
202
+ Framework: PyTorch and Hugging Face Transformers library.
203
 
204
+ Optimization: fp16 mixed-precision training was used to reduce memory consumption and accelerate training time without compromising model accuracy.
205
 
206
+ Libraries: datasets, transformers, evaluate, and accelerate.
207
 
208
+ Citation [optional]
209
+ BibTeX:
210
 
211
+ @misc{sms-spam-classifier-2026, author = {Your Name}, title = {SMS Spam Classifier: A Fine-tuned Transformer Model}, year = {2026}, publisher = {Hugging Face}, howpublished = {\url{https://huggingface.co/your-username/your-model-repo}} }
212
 
213
+ APA:
214
 
215
+ Duggirala Vnaga Ananth. (2026). SMS Spam Classifier: A Fine-tuned Transformer Model [Computer model]. https://huggingface.co/nagaananth/MLOPS_group-v1/
216
 
217
+ Glossary [optional]
218
+ Ham: A common term used in spam filtering to denote legitimate, non-spam messages.
219
 
220
+ Spam: Unsolicited or unwanted commercial messages.
221
 
222
+ Transformer: A deep learning architecture that uses self-attention mechanisms to weigh the significance of different parts of the input data.
223
 
224
+ F1-Score: A metric that balances precision and recall; highly useful for evaluating models on imbalanced datasets where one class is much more frequent than the other.
225
 
226
+ Fine-tuning: The process of taking a pre-trained language model and training it further on a smaller, task-specific dataset.
227
 
228
+ More Information [optional]
229
+ This model was developed to provide a lightweight and efficient solution for SMS spam filtering. By leveraging transfer learning, the model achieves high accuracy with minimal training time, making it suitable for deployment in resource-constrained environments.
230
 
231
+ Model Card Authors [optional]
232
+ G25AIT2032 Duggirala Vnaga Ananth
233
 
234
+ Model Card Contact
235
+ For questions or feedback regarding this model, please reach out via:
236
 
237
+ GitHub: https://github.com/g25ait2032-prog/MLOPS_Group
238
 
239
+ Hugging Face: https://huggingface.co/nagaananth/MLOPS_group-v1
240
 
241
+ Email: g25ait2032@iitj.ac.in