Downloads · 30 days
10
5% of all-time downloads
likeyellow/klue-review-star
klue-review-star is a text classification model from likeyellow. Use it when you need a label for a piece of text. The card lists the license as cc-by-nc-sa-4.0.
Successor: klue-review-star-4class — adds a fourth class that rejects non-review input.
Downloads · 30 days
10
5% of all-time downloads
All-time downloads
203
Public
Parameters
111M
443 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors443 MB · 100%
From the Hugging Face model README
Successor: klue-review-star-4class — adds a fourth class that rejects non-review input.
Predicts a 1.0–5.0 star rating from Korean restaurant review text alone, along with a confidence score.
Fine-tuned from klue/bert-base on the KR3 dataset.
In Korea, "rating terrorism" is a recurring problem: users leave positive review text ("굿", "친절해요") while assigning one star, dragging a restaurant's average down. Because the text contains nothing abusive or false, platforms cannot moderate it.
This model removes the separate star input: the rating is derived from the review body, so the two cannot diverge.
KR3 ships categorical labels (0 negative, 1 positive, 2 ambiguous)
rather than the original star values, so direct regression is not possible.
Instead:
[1.0, 5.0, 3.0]1 − H(p) / ln(3), the normalized entropy of the same
distribution, invertedStep 3 costs nothing extra and identifies mixed reviews: text combining praise and complaint produces a spread-out distribution and therefore low confidence. Downstream, this is used to down-weight ambiguous reviews when aggregating a restaurant's average.
import numpy as np
import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
MODEL = "likeyellow/klue-review-star"
ANCHOR = np.array([1.0, 5.0, 3.0]) # [negative, positive, neutral]
tok = AutoTokenizer.from_pretrained(MODEL)
model = AutoModelForSequenceClassification.from_pretrained(MODEL).eval()
def predict(text):
enc = tok(text, truncation=True, max_length=256, return_tensors="pt")
with torch.no_grad():
p = torch.softmax(model(**enc).logits, dim=-1)[0].numpy()
star = float((p * ANCHOR).sum())
ent = float(-(p * np.log(p + 1e-9)).sum())
return round(star, 2), round(1 - ent / np.log(3), 3)
print(predict("굿"))
# (4.7, 0.607)
print(predict("회는 신선한데 주차가 너무 불편했어요"))
# (3.6, 0.15) ← mixed review, low confidence
print(predict("재료가 다 상한 것 같고 직원도 불친절했어요 최악"))
# (1.02, 0.958)
Test set: 15,000 reviews, stratified.
| Metric | Value |
|---|---|
| Accuracy | 0.768 |
| Macro F1 | 0.751 |
| Star MAE | 0.640 |
| Negative recall | 0.846 |
| Neutral recall | 0.626 |
Star MAE is the primary metric: misclassifying positive as neutral is a full error under classification, but only a small error in star terms. MAE reflects what the system is actually for.
beomi/KcELECTRA-base, pretrained on colloquial Korean comment data, was
evaluated on the same split:
| klue/bert-base | KcELECTRA-base | |
|---|---|---|
| Accuracy | 0.768 | 0.755 |
| Star MAE | 0.640 | 0.656 |
| Neutral recall | 0.626 | 0.657 |
| Negative recall | 0.846 | 0.857 |
KcELECTRA is better on minority classes but worse on overall accuracy and
star MAE. Since star accuracy is the objective, klue/bert-base was chosen.
KcELECTRA's validation loss was still decreasing at epoch 2, so it may
overtake with longer training.
[3.01, 0.55, 1.17] to correct 11 / 60 / 28 imbalanceCC BY-NC-SA 4.0, inherited from the KR3 dataset. Non-commercial use only.