File size: 1,302 Bytes
cdd7d88 35e3d4a cdd7d88 7f566cb cdd7d88 7f566cb cdd7d88 35e3d4a | 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 48 49 | ---
license: cc-by-4.0
language:
- en
---
# Refusal Classifier Model
A simple NLP model for classifying text responses as either `refusal` or `valid`.
Works on 90% of test cases.
## π§ What It Does
This model predicts whether a given response from an LLM is:
- **refusal** β e.g., "I'm sorry, but I can't help with that."
- **valid** β e.g., "'I can't remember,' she said quietly."
Useful for detecting AI refusals and filtering them during generation.
## π Training Details
- Built using **scikit-learn** with:
- `TfidfVectorizer` (1β2 n-grams, lowercase)
- `LogisticRegression`
- Trained on a small dataset of synthetic labeled examples (1175/1517 refusal/valid pairs)
- Dataset stored in `dataset.jsonl` with format:
```json
{"text": "The capital of France is Paris.", "label": "valid"}
```
## π How to Use
1. Install requirements
``` bash
pip install scikit-learn joblib
```
3. Load the model
``` bash
import joblib
joblib.load("refusal_classifier.pkl")
```
3. Make a prediction
``` python
text = "I'm sorry, but I can't help with that."
label = model.predict([text])[0]
print(label) # "refusal"
```
## π License
Licensed under CC BY 4.0: you may use this commercially or privately, but must include attribution in code or documentation. |