manjt commited on
Commit
b8e38e8
·
verified ·
1 Parent(s): a4eb4a4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +6 -5
README.md CHANGED
@@ -15,15 +15,14 @@ tags:
15
  - social
16
  ---
17
  # **Toxic Comment Classification with Transformer Optimization**
18
-
19
  This project demonstrates a high-performance pipeline for classifying toxic comments using a **binary classification** approach. The models were trained and evaluated using the **Jigsaw Toxic Comment Classification** dataset, specifically leveraging the domain-specific **Toxic-BERT** model as a primary architecture.
20
- ---
21
  ## **Project Overview**
22
  * **Objective**: To build an efficient **binary toxicity classifier** using state-of-the-art NLP models.
23
  * **Model Type**: Binary classification (Toxic vs. Non-Toxic).
24
  * **Dataset**: Jigsaw Toxic Comment Classification Challenge.
25
  * **Scope**: Includes data visualization, model benchmarking, and size reduction for deployment.
26
- ---
27
  ## **Technical Workflow**
28
  ### **1. Data Preprocessing & EDA**
29
  * **Labeling**: Multi-label categories (toxic, severe_toxic, obscene, threat, insult, identity_hate) were condensed into a single **binary 'is_toxic' label**.
@@ -35,14 +34,16 @@ The project evaluated 15 different embedding sets across two categories:
35
  * **Light Models**: Includes DistilBERT, MiniLM, ALBERT, and ELECTRA-Small.
36
  * **Heavy Models**: Includes BERT, RoBERTa, DeBERTa, XLNet, and domain-specific models like **Toxic-BERT** and HateBERT.
37
  ### **3. Model Performance Results**
38
- Models were evaluated using Logistic Regression (LR), Support Vector Machines (SVM), and Random Forest (RF).
39
 
 
40
  | Embedding | LR_AUC | LinearSVM_ACC | RBF_AUC | RF_ACC |
41
  | :--- | :--- | :--- | :--- | :--- |
42
  | **Toxic-BERT_transformer_emb** | 0.997022 | 0.979531 | 0.991532 | 0.979375 |
43
  | **HateBERT_transformer_emb** | 0.967701 | 0.901875 | 0.965530 | 0.852344 |
44
  | **DistilBERT_transformer_emb** | 0.967614 | 0.898906 | 0.967362 | 0.878125 |
45
  ---
 
46
  ## **Optimization Techniques**
47
  ### **4. Dynamic Quantization**
48
  To optimize the teacher model (Toxic-BERT) for CPU inference, dynamic quantization was applied to convert weights from FP32 to INT8.
@@ -53,7 +54,7 @@ A smaller student model (**DistilBERT**) was trained to mimic the behavior of th
53
  * **Loss Function**: A custom **Binary Knowledge Distillation** loss was used, combining Kullback-Leibler (KL) divergence for soft teacher probabilities and Cross-Entropy for hard labels.
54
  * **Student Performance**: Reached a **Validation AUC of 0.9866** after 5 training epochs.
55
  * **Final Footprint**: The student model is **267.86 MB**, significantly more portable than the original **438.03 MB** teacher model.
56
- ---
57
  ## **Requirements**
58
  * `torch`
59
  * `transformers`
 
15
  - social
16
  ---
17
  # **Toxic Comment Classification with Transformer Optimization**
 
18
  This project demonstrates a high-performance pipeline for classifying toxic comments using a **binary classification** approach. The models were trained and evaluated using the **Jigsaw Toxic Comment Classification** dataset, specifically leveraging the domain-specific **Toxic-BERT** model as a primary architecture.
19
+
20
  ## **Project Overview**
21
  * **Objective**: To build an efficient **binary toxicity classifier** using state-of-the-art NLP models.
22
  * **Model Type**: Binary classification (Toxic vs. Non-Toxic).
23
  * **Dataset**: Jigsaw Toxic Comment Classification Challenge.
24
  * **Scope**: Includes data visualization, model benchmarking, and size reduction for deployment.
25
+
26
  ## **Technical Workflow**
27
  ### **1. Data Preprocessing & EDA**
28
  * **Labeling**: Multi-label categories (toxic, severe_toxic, obscene, threat, insult, identity_hate) were condensed into a single **binary 'is_toxic' label**.
 
34
  * **Light Models**: Includes DistilBERT, MiniLM, ALBERT, and ELECTRA-Small.
35
  * **Heavy Models**: Includes BERT, RoBERTa, DeBERTa, XLNet, and domain-specific models like **Toxic-BERT** and HateBERT.
36
  ### **3. Model Performance Results**
37
+ Models were evaluated using Logistic Regression (LR), Support Vector Machines (SVM), and Random Forest (RF)
38
 
39
+ ---
40
  | Embedding | LR_AUC | LinearSVM_ACC | RBF_AUC | RF_ACC |
41
  | :--- | :--- | :--- | :--- | :--- |
42
  | **Toxic-BERT_transformer_emb** | 0.997022 | 0.979531 | 0.991532 | 0.979375 |
43
  | **HateBERT_transformer_emb** | 0.967701 | 0.901875 | 0.965530 | 0.852344 |
44
  | **DistilBERT_transformer_emb** | 0.967614 | 0.898906 | 0.967362 | 0.878125 |
45
  ---
46
+
47
  ## **Optimization Techniques**
48
  ### **4. Dynamic Quantization**
49
  To optimize the teacher model (Toxic-BERT) for CPU inference, dynamic quantization was applied to convert weights from FP32 to INT8.
 
54
  * **Loss Function**: A custom **Binary Knowledge Distillation** loss was used, combining Kullback-Leibler (KL) divergence for soft teacher probabilities and Cross-Entropy for hard labels.
55
  * **Student Performance**: Reached a **Validation AUC of 0.9866** after 5 training epochs.
56
  * **Final Footprint**: The student model is **267.86 MB**, significantly more portable than the original **438.03 MB** teacher model.
57
+
58
  ## **Requirements**
59
  * `torch`
60
  * `transformers`