File size: 1,495 Bytes
89d0d00
 
fb62a11
 
89d0d00
 
fb62a11
89d0d00
 
fb62a11
 
 
 
 
 
 
89d0d00
 
fb62a11
 
 
 
 
 
 
7912365
fb62a11
 
 
 
 
 
 
 
 
 
 
 
 
7912365
fb62a11
 
 
 
 
 
7912365
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
title: Hybrid Comment Moderation
emoji: πŸ’¬
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: "5.34.0"
app_file: app.py
pinned: false
license: mit
tags:
  - content-moderation
  - hybrid-ai
  - distilbert
  - qwen
  - cs541
---

# πŸ’¬ Hybrid Comment Moderation

**CS541 AI Final Project β€” Stevens Institute of Technology**

A two-stage content moderation pipeline that routes comments intelligently:

1. **Stage 1 β€” ML Classifier** (DistilBERT, CPU, ~7 ms): handles confident predictions instantly.
2. **Stage 2 β€” LLM Reviewer** (Qwen2.5-14B-Instruct, NF4, GPU, ~1–2 s): reviews only ambiguous comments.

## Tabs

| Tab | Description |
|:----|:------------|
| πŸ” **Live Demo** | Type a comment, pick a strategy, see the verdict |
| πŸ“Š **Evaluation** | Pre-computed metrics on 100 balanced Civil Comments samples |
| πŸ—οΈ **Architecture** | Pipeline diagram and design rationale |

## Usage

- **ML-only** works for everyone (CPU, no sign-in needed).
- **Hybrid** and **LLM-only** require a free HuggingFace account for ZeroGPU access.
- First LLM call loads the 14B model (~30–40 s); subsequent calls take ~1–2 s.

## Reference

- Textbook: *Understanding Deep Learning* by Simon J.D. Prince
- Dataset: [google/civil_comments](https://huggingface.co/datasets/google/civil_comments)
- ML model: [martin-ha/toxic-comment-model](https://huggingface.co/martin-ha/toxic-comment-model)
- LLM: [Qwen/Qwen2.5-14B-Instruct](https://huggingface.co/Qwen/Qwen2.5-14B-Instruct)