This is a fine-tuned version of Gemma-3 270M trained to extract structured JSON-LD recipe data from unstructured blog posts. The model can parse messy recipe blog posts (with stories, ads, and chaotic formatting) and output clean, valid schema.org Recipe objects.
Model Details
Model Description
This model extracts structured recipe information from natural language text in the form of JSON-LD following the schema.org Recipe specification. It's designed to handle various blog post styles including:
Minimal, organized formats
Fluffy blog posts with stories and advertisements
Chaotic, poorly formatted text
Short Instagram-style posts
Extremely verbose, unstructured content
The model was fine-tuned using LoRA (Low-Rank Adaptation) to maintain efficiency while achieving good extraction accuracy.
The model can be used directly to extract recipe information from blog posts, social media posts, or any text containing recipe information. It outputs valid JSON-LD in schema.org Recipe format, which can be:
Embedded in web pages for SEO
Used in recipe management applications
Parsed by search engines and recipe aggregators
Stored in structured databases
Example Usage
python
1from unsloth import FastLanguageModel
23model, tokenizer = FastLanguageModel.from_pretrained(4 model_name="v-rusu/recipe-extractor-gemma-3-270m",5 max_seq_length=8192,6 load_in_4bit=False,7)89messages =[10{"role":"system","content":"You are a recipe extraction assistant. Extract recipe information from the provided text and output it as a valid JSON-LD object following the schema.org Recipe format."},11{"role":"user","content":"Extract recipe information from this text:\n\n[your blog post text here]"},12]1314inputs = tokenizer.apply_chat_template(15 messages,16 tokenize=True,17 return_tensors="pt",18 add_generation_prompt=True,19).to("cuda")2021outputs = model.generate(22 input_ids=inputs,23 max_new_tokens=1500,24 temperature=1,25 top_p=0.95,26 top_k=64,27)2829response = tokenizer.decode(outputs[0], skip_special_tokens=True)30print(response)
Downstream Use
The extracted JSON-LD can be integrated into:
Recipe website SEO optimization
Recipe aggregation platforms
Meal planning applications
Nutritional analysis tools
Content management systems
Out-of-Scope Use
This model is not suitable for:
Medical or dietary advice
Allergen detection (requires specialized models)
Nutritional calculation (outputs rely on source accuracy)
Non-recipe content extraction
Languages other than English
Bias, Risks, and Limitations
Dataset Bias: The model was trained on data derived from AllRecipes, which may not represent global cuisine diversity
Synthetic Data: Training data was synthetically generated, which may not capture all real-world edge cases
Format Assumptions: The model expects blog-style recipe text and may not handle highly structured or tabular inputs well
Accuracy: Recipe quantities and instructions depend on accurate extraction from source text
No Validation: The model does not verify recipe feasibility or safety
Recommendations
Always validate extracted recipes for completeness and accuracy
Use with diverse recipe sources to identify potential biases
Implement additional validation for allergen and dietary information
Consider human review for production recipe applications
Test with your specific use case before deployment
How to Get Started with the Model
Installation
pip install unsloth transformers
Quick Start
python
1from unsloth import FastLanguageModel
23# Load the model4model, tokenizer = FastLanguageModel.from_pretrained(5 model_name="v-rusu/recipe-extractor-gemma-3-270m",6 max_seq_length=8192,7)89# Prepare your input10blog_post ="""
11Today I'm sharing my grandmother's famous chocolate chip cookies!
12These cookies are the best - soft, chewy, and packed with chocolate.
1314Ingredients:
15- 2 cups all-purpose flour
16- 1 cup sugar
17- 1 cup chocolate chips
18- 2 eggs
19- 1 tsp vanilla extract
2021Instructions:
22First, preheat your oven to 350°F. Then mix all dry ingredients...
23"""2425messages =[26{"role":"system","content":"You are a recipe extraction assistant. Extract recipe information from the provided text and output it as a valid JSON-LD object following the schema.org Recipe format."},27{"role":"user","content":f"Extract recipe information from this text:\n\n{blog_post}"},28]2930# Generate31inputs = tokenizer.apply_chat_template(messages, tokenize=True, return_tensors="pt").to("cuda")32outputs = model.generate(input_ids=inputs, max_new_tokens=1500)33print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Structural Validity Rate: Percentage of outputs that are valid JSON-LD
Field Completeness: Coverage of optional schema.org fields
Quality Score: Average LLM-assessed quality rating
Results
Results vary by training configuration. The best performing model (gemma-3-r64-max35-lr5e-4) achieved:
High structural validity on test set
Consistent extraction of required fields
Good handling of diverse blog post styles
Full evaluation results are saved per training run and include per-sample validation details.
Environmental Impact
Hardware Type: NVIDIA GPU (T4 or better recommended)
Training optimizations: Unsloth framework, 4-bit quantization, LoRA
Compute efficiency: Optimized for Google Colab free tier
Carbon footprint: Minimal due to small model size and efficient training
The use of a small model (270M parameters) and efficient fine-tuning techniques (LoRA, quantization) significantly reduces computational requirements compared to training larger models.