Downloads · 30 days
0
MonikaDvorackova/llm-response-quality-classifier
llm-response-quality-classifier is a text classification model from MonikaDvorackova. Use it when you need a label for a piece of text. It is set up for scikit-learn. The card lists the license as apache-2.0.
A lightweight text classifier for experimental classification of LLM responses as strong or weak.
Downloads · 30 days
0
Access
Public
Updated Aug 15, 2026
Repo size
80.2 KB
Likes
0
Public
Click a slice to open those files.
.joblib36.1 KB · 78%
From the Hugging Face model README
A lightweight text classifier for experimental classification of LLM responses as strong or weak.
The project demonstrates a complete small-scale machine learning workflow:
Dataset → feature extraction → model training → cross-validation → model artifact → inference
The classifier is intended as an educational and engineering demonstration rather than a production LLM quality evaluator.
The classifier uses:
The final model is trained on all available examples after cross-validation.
The model was trained on the public dataset:
MonikaDvorackova/llm-response-evaluation-examples
The training version contains 200 synthetic prompt-response examples:
strongweakDomains include:
The examples are synthetic and manually designed for experimentation.
They are not production LLM traffic and should not be interpreted as representative of real-world model behaviour.
Two cross-validation strategies were examined.
Random stratified 5-fold cross-validation produced:
| Metric | Score |
|---|---|
| Accuracy | 1.000 |
| Macro F1 | 1.000 |
| Weighted F1 | 1.000 |
These results should be interpreted cautiously.
The synthetic dataset contains related response constructions and recurring linguistic patterns. Random stratified splitting can therefore place structurally similar examples in both training and validation folds.
For this reason, the random cross-validation result is likely optimistic and is not treated as evidence of real-world generalization.
A stricter evaluation was performed using the example domain as the grouping variable.
This prevents examples from the same domain from appearing in both the training and validation portions of an individual fold.
The model therefore has to classify examples from held-out domains.
Results:
| Metric | Score |
|---|---|
| Accuracy | 0.970 |
| Macro precision | 0.972 |
| Macro recall | 0.970 |
| Macro F1 | 0.970 |
Class-level results:
| Class | Precision | Recall | F1 | Support |
|---|---|---|---|---|
| strong | 1.000 | 0.940 | 0.969 | 100 |
| weak | 0.943 | 1.000 | 0.971 | 100 |
Confusion matrix:
predicted strong predicted weak
94 6
0 100
The grouped evaluation is considered more informative than the random stratified evaluation for this dataset.
However, it still evaluates generalization only across the synthetic domains represented by the dataset. It does not establish performance on independently collected real-world LLM responses.
The repository contains train.py, which defines the training pipeline and evaluation procedure.
Core model configuration:
TfidfVectorizer(
ngram_range=(1, 2),
lowercase=True,
min_df=2,
max_df=0.95,
sublinear_tf=True,
)
LogisticRegression(
max_iter=2000,
class_weight="balanced",
random_state=42,
)
The serialized trained pipeline is provided as:
model.joblib
Install the required dependencies:
pip install scikit-learn joblib
Example:
import joblib
model = joblib.load("model.joblib")
prompt = "Why should an ML system be monitored after deployment?"
response = (
"Production conditions may differ from development conditions. "
"Monitoring can help detect data drift, performance degradation, "
"incidents and unexpected behaviour."
)
text = f"PROMPT: {prompt}\nRESPONSE: {response}"
prediction = model.predict([text])[0]
probabilities = model.predict_proba([text])[0]
print("Prediction:", prediction)
print(
dict(
zip(
model.classes_,
probabilities,
)
)
)
This model is suitable for:
It may also be useful as a simple baseline when comparing deterministic text classifiers with more sophisticated evaluation approaches.
This model has substantial limitations.
The training dataset is small and synthetic.
The classifier may learn stylistic or lexical patterns associated with how the examples were constructed rather than general concepts of response quality.
The labels strong and weak are simplified experimental annotations.
The model does not independently determine:
A high classification probability must not be interpreted as a calibrated probability that an LLM response is objectively good or correct.
The reported evaluation results should not be extrapolated to production LLM traffic.
Possible extensions include:
The repository contains:
train.py — training and evaluation pipelinerequirements.txt — Python dependenciesmodel.joblib — serialized trained modelThe associated public dataset documents the data used for training.
Apache-2.0