Update README.md
Browse files
README.md
CHANGED
|
@@ -1,18 +1,90 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- text-classification
|
| 5 |
+
- prompt-
|
| 6 |
+
- moderation
|
| 7 |
+
|
| 8 |
+
- transformers
|
| 9 |
+
datasets:
|
| 10 |
+
- VerifiedPrompts/cntxt-class-final
|
| 11 |
+
language:
|
| 12 |
+
- en
|
| 13 |
+
pipeline_tag:
|
| 14 |
+
widget:
|
| 15 |
+
- text: "Write a LinkedIn post about eco-friendly tech
|
| 16 |
+
example_title: Context-rich prompt
|
| 17 |
+
- text: "Write
|
| 18 |
+
|
| 19 |
+
---
|
| 20 |
+
# 📘 Model Card: CNTXT-Filter-Prompt-Opt
|
| 21 |
+
|
| 22 |
+
## 🔍 Model Overview
|
| 23 |
+
**CNTXT-Filter-Prompt-Opt** is a lightweight, high-accuracy text classification model designed to evaluate the **contextual completeness of user prompts** submitted to LLMs.
|
| 24 |
+
It acts as a **gatekeeper** before generation, helping eliminate vague or spam-like input and ensuring only quality prompts proceed to LLM2.
|
| 25 |
+
|
| 26 |
+
- **Base model**: `distilbert-base-uncased`
|
| 27 |
+
- **Trained on**: 200k labeled prompts
|
| 28 |
+
- **Purpose**: Prompt validation, spam filtering, and context enforcement
|
| 29 |
+
|
| 30 |
+
---
|
| 31 |
+
|
| 32 |
+
## 🎯 Intended Use
|
| 33 |
+
|
| 34 |
+
This model is intended for:
|
| 35 |
+
- Pre-processing prompts before LLM2 generation
|
| 36 |
+
- Blocking unclear or context-poor requests
|
| 37 |
+
- Structuring user input pipelines in AI apps, bots, and assistants
|
| 38 |
+
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
## 🔢 Labels
|
| 42 |
+
|
| 43 |
+
The model classifies prompts into 3 categories:
|
| 44 |
+
|
| 45 |
+
| Label | Description |
|
| 46 |
+
|-------|-------------|
|
| 47 |
+
| `has context` | Prompt is clear, actionable, and self-contained |
|
| 48 |
+
| `missing platform, audience, budget, goal` | Prompt lacks structural clarity |
|
| 49 |
+
| `Intent is unclear, Please input more context` | Vague or incoherent prompt |
|
| 50 |
+
|
| 51 |
+
---
|
| 52 |
+
|
| 53 |
+
## 📊 Training Details
|
| 54 |
+
|
| 55 |
+
- **Model**: `distilbert-base-uncased`
|
| 56 |
+
- **Training method**: Hugging Face AutoTrain
|
| 57 |
+
- **Dataset size**: 200,000 prompts (curated, curriculum style)
|
| 58 |
+
- **Epochs**: 3
|
| 59 |
+
- **Batch size**: 8
|
| 60 |
+
- **Max seq length**: 128
|
| 61 |
+
- **Mixed Precision**: `fp16`
|
| 62 |
+
- **LoRA**: ❌ Disabled
|
| 63 |
+
- **Optimizer**: AdamW
|
| 64 |
+
|
| 65 |
+
---
|
| 66 |
+
|
| 67 |
+
## ✅ Evaluation
|
| 68 |
+
|
| 69 |
+
| Metric | Score |
|
| 70 |
+
|--------|-------|
|
| 71 |
+
| Accuracy | 1.0 |
|
| 72 |
+
| F1 (macro/micro/weighted) | 1.0 |
|
| 73 |
+
| Precision / Recall | 1.0 |
|
| 74 |
+
| Validation Loss | 0.0 |
|
| 75 |
+
|
| 76 |
+
The model generalizes extremely well on all validation samples.
|
| 77 |
+
|
| 78 |
+
---
|
| 79 |
+
|
| 80 |
+
## ⚙️ How to Use
|
| 81 |
+
|
| 82 |
+
```python
|
| 83 |
+
from transformers import pipeline
|
| 84 |
+
|
| 85 |
+
classifier = pipeline("text-classification", model="VerifiedPrompts/CNTXT-Filter-Prompt-Opt")
|
| 86 |
+
prompt = "Write a business plan for a freelance app in Canada."
|
| 87 |
+
result = classifier(prompt)
|
| 88 |
+
|
| 89 |
+
print(result)
|
| 90 |
+
# [{'label': 'has context', 'score': 0.98}]
|