Downloads · 30 days
14
19% of all-time downloads
Tushar9802/bawarchi-recipe-generator
bawarchi-recipe-generator is a machine learning model from Tushar9802. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as mit.
language: en license: mit basemodel: meta-llama/Llama-3.2-3B-Instruct tags: - recipe-generation - llama - peft - lora - yolo - computer-vision - nlp - cuisine-aware ---
Downloads · 30 days
14
19% of all-time downloads
All-time downloads
73
Public
Repo size
334 MB
Likes
0
Public
Click a slice to open those files.
.safetensors334 MB · 100%
From the Hugging Face model README
language: en license: mit base_model: meta-llama/Llama-3.2-3B-Instruct tags:
Role-aware fine-tuned Llama 3.2 3B for cuisine-context recipe generation
Bawarchi is a recipe generation model that understands ingredient roles and adapts recipes based on cuisine context. Fine-tuned from Llama 3.2 3B using LoRA with a novel curriculum learning approach over 335K recipes, plus role-aware extension training on 1K curated examples.
Key Capabilities:
Example:
Input: Create Indian recipe using chicken, tomato, tortilla
Output: "Chicken Tikka Roti Wrap - Note: Tortilla detected. For authentic Indian cuisine,
consider using roti or naan instead as the flatbread base..."
[q_proj, k_proj, v_proj, o_proj]Curriculum Learning (Phase 1-3):
Phase 1 - Simple Recipes: Basic structure (ingredients → steps)
Phase 2 - Complex Recipes: Multi-step reasoning, timing, techniques
Phase 3 - Fusion Recipes: Cultural adaptation, substitution logic
Role-Aware Extension:
Total Training Time: 13 hours (11h Phase 1-3 + 2h role-aware)
| Metric | Value | Description |
|---|---|---|
| Accuracy | 74.1% | Recipe structure + coherence |
| Final Loss | 0.997 | Cross-entropy on validation set |
| BLEU Score | ~0.45 | N-gram overlap with references |
| Perplexity | ~2.71 | Model confidence |
Cuisine-Context Validation:
Generate cuisine-aware recipes from a list of available ingredients with intelligent adaptation based on cultural context.
Supported Cuisines:
Input Format:
Create a {difficulty}-level {cuisine} recipe using: {ingredient_list}
Output Format:
Not suitable for:
pip install transformers peft torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
# Load base model
base_model = "meta-llama/Llama-3.2-3B-Instruct"
model = AutoModelForCausalLM.from_pretrained(
base_model,
torch_dtype=torch.float16,
device_map="auto"
)
# Load LoRA adapter
adapter_path = "Tushar-9802/bawarchi-recipe-generation" # Replace with actual path
model = PeftModel.from_pretrained(model, adapter_path)
model.eval()
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained(base_model)
tokenizer.pad_token = tokenizer.eos_token
# Generate recipe
ingredients = "chicken, tomato, onion, garlic, ginger"
cuisine = "indian"
difficulty = "medium"
prompt = f"""<|begin_of_text|><|start_header_id|>user<|end_header_id|>
Create a {difficulty}-level {cuisine} recipe using: {ingredients}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.7,
top_p=0.9,
do_sample=True,
pad_token_id=tokenizer.eos_token_id
)
recipe = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(recipe.split("assistant")[-1].strip())
def generate_cuisine_aware_recipe(ingredients, cuisine="general", difficulty="medium"):
"""
Generate recipe with cuisine-context awareness
Args:
ingredients: List of ingredients or comma-separated string
cuisine: Target cuisine (indian/mexican/italian/asian/fusion/general)
difficulty: Recipe complexity (easy/medium/hard)
Returns:
Generated recipe text
"""
if isinstance(ingredients, list):
ingredients = ", ".join(ingredients)
prompt = f"""<|begin_of_text|><|start_header_id|>user<|end_header_id|>
Create a {difficulty}-level {cuisine} recipe using: {ingredients}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.7,
top_p=0.9,
do_sample=True,
repetition_penalty=1.1,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
return response.split("assistant")[-1].strip()
# Example usage
recipe = generate_cuisine_aware_recipe(
ingredients=["chicken", "tomato", "tortilla", "cheese"],
cuisine="mexican",
difficulty="easy"
)
print(recipe)
Primary Dataset: Food.com Recipes
Synthetic Data:
Role-Aware Extension:
Data Processing:
Hardware:
Software:
Hyperparameters:
Phase 1-3:
learning_rate: 2e-4 (Phase 1-2), 1e-4 (Phase 3)
batch_size: 4
gradient_accumulation_steps: 8
effective_batch_size: 32
max_length: 2048
num_epochs: 3 (Phase 1-2), 5 (Phase 3)
optimizer: AdamW
lr_scheduler: linear with warmup
warmup_steps: 100
weight_decay: 0.01
fp16: True
lora_r: 64
lora_alpha: 128
lora_dropout: 0.05
Role-Aware Extension:
learning_rate: 1e-4
batch_size: 2
gradient_accumulation_steps: 8
effective_batch_size: 16
num_epochs: 2
lora_r: 16
lora_alpha: 32
Training Time:
Optimization Techniques:
Metrics on 1000-example test set:
Qualitative Evaluation:
Technical:
Data Bias:
Safety:
Known Biases:
Ethical Considerations:
Recommendations:
ompute Efficiency:
BibTeX:
@misc{bawarchi2026,
author = {Jaju, Tushar},
title = {Bawarchi: Role-Aware Recipe Generation with Llama 3.2},
year = {2026},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/Tushar-9802/bawarchi-recipe-generation}},
note = {Fine-tuned Llama 3.2 3B with curriculum learning and role-based reasoning}
}
APA:
Jaju, T. (2026). Bawarchi: Role-Aware Recipe Generation with Llama 3.2 [Computer software].
HuggingFace. https://huggingface.co/Tushar-9802/bawarchi-recipe-generation
Tushar Jaju
Related Resources:
Future Work:
Acknowledgments:
License: MIT License
Contact: For questions, issues, or collaboration opportunities, please open an issue on GitHub or contact via email.