Hebrew Grocery Item Classifier v2
Fine-tuned multilingual-MiniLMv2-L6-mnli-xnli
for classifying Hebrew grocery shopping list items into 12 supermarket categories.
This is an improved version over v1 with a larger, more diverse training set and targeted augmentation for weak classes.
finetune code at https://github.com/davidit17/shopping_list_bot
What's new in v2
- Larger dataset — 3043 total items (2434 train / 609 test), up from ~600 in v1
- 4 training sources — manual lists, Excel grocery data, Gemini-labelled web data, and a ChatGPT-labelled set
- Synthetic augmentation — rule-based Hebrew item generator to balance under-represented categories
- Weak-class booster — extra hand-curated examples for משקאות, קפואים וסלטים, and רטבים וממרחים
- Per-class F1 tracking — evaluation now reports per-category F1 to surface weak spots
Categories
מוצרי חלב וביצים
ירקות ופירות
לחם מאפים ודגנים
חטיפים ומתוקים
ניקיון טיפוח וחד פעמי
משקאות
מוצרים לאפייה
בשר ודגים
קפואים וסלטים
יבשים
רטבים וממרחים
אחר
Usage
from transformers import pipeline
classifier = pipeline(
"text-classification",
model=f"davidit17/minilm-grocery-hebrew-v2",
)
items = ["גבינה צהובה", "עגבניות שרי", "שמפו", "קוקה קולה", "חזה עוף"]
for item in items:
result = classifier(item)[0]
print(item, "→", result["label"], f"({result['score']:.2f})")
With confidence threshold (recommended)
CONFIDENCE_THRESHOLD = 0.5
def predict(text: str) -> str:
result = classifier(text)[0]
return result["label"] if result["score"] >= CONFIDENCE_THRESHOLD else "אחר"
Training
Data sources
Evaluation
Overall
Per-class F1 (fine-tuned v2)
Limitations
- Primarily covers Israeli supermarket conventions and Hebrew product naming.
- Brand-specific or very niche items may fall back to
אחר.
- Low-confidence predictions (score < 0.5) should be treated as
אחר.
- Synthetic training examples may not fully reflect natural shopping list variation.
- The
אחר category is a catch-all and may have lower precision than domain-specific categories.