FoodExtract: Fine-Tuned Gemma 3 4B

A fine-tuned version of google/gemma-3-4b-it trained to extract food and drink items from raw text.

What It Does

Given any text input, this model outputs a structured extraction:
food_or_drink: 1
tags: fi, di
foods: eggs, bacon, toast
drinks: orange juice
If the input contains no food or drink items:
food_or_drink: 0
tags:
foods:
drinks:

Tag Reference

Tag Meaning
np nutrition_panel
il ingredient_list
me menu
re recipe
fi food_items
di drink_items
fa food_advertisement
fp food_packaging

How to Use

from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
model_id = "xorslider/FoodExtract-gemma-3-4b-finetuned"
model     = AutoModelForCausalLM.from_pretrained(model_id, dtype="auto", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained(model_id)
pipe      = pipeline("text-generation", model=model, tokenizer=tokenizer)
input_text = "A bowl of ramen with soft-boiled eggs, nori, and a side of green tea."
formatted  = pipe.tokenizer.apply_chat_template(
    [&#123"role": "user", "content": input_text&#125],
    tokenize=False,
    add_generation_prompt=True
)
output = pipe(formatted, max_new_tokens=128)
print(output[0]["generated_text"][len(formatted):])

Training

Base model: google/gemma-3–4b-it
Dataset: mrdbourke/FoodExtract-1k (1,136 training samples)
Method: Full supervised fine-tuning (SFT) via Hugging Face TRL
Epochs: 3
Batch size: 4
Learning rate: 2e-4

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for xorslider/FoodExtract-gemma-3-4b-finetuned

Finetuned
(831)
this model