Downloads · 30 days
16
13% of all-time downloads
Daniel-Krasik/Qwen2.5-1.5B-QLoRA-Recipe
Qwen2.5-1.5B-QLoRA-Recipe is a text generation model from Daniel-Krasik. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as cc-by-nc-sa-4.0.
A domain-adapted language model fine-tuned for culinary recipe generation using QLoRA
Downloads · 30 days
16
13% of all-time downloads
All-time downloads
125
Public
Parameters
1.6B
1.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.6 GB · 99%
How the weights are stored.
U81.4B · 85%
From the Hugging Face model README
A domain-adapted language model fine-tuned for culinary recipe generation using QLoRA
This model is a fine-tuned version of Qwen/Qwen2.5-1.5B-Instruct, specialized for generating cooking recipes from ingredient lists. Using QLoRA (Quantized Low-Rank Adaptation), the model achieves significant improvements in recipe generation quality while retaining 97% of its general language understanding capabilities.
| Metric | Base Model | Fine-Tuned | Improvement |
|---|---|---|---|
| ROUGE-1 | 30.5% | 48.5% | +59% |
| ROUGE-2 | 7.1% | 28.3% | +299% |
| ROUGE-L | 16.8% | 39.2% | +134% |
| MMLU | 70.7% | 68.7% | 97.2% retained |
| HellaSwag | 66.0% | 64.0% | 97.0% retained |
This model is designed for generating cooking recipes based on a list of ingredients. It produces structured recipes with:
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load the model
model_id = "Daniel-Krasik/Qwen2.5-1.5B-QLoRA-Recipe"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
# Create a prompt
messages = [
{
"role": "system",
"content": "You will generate one cooking recipe. List all necessary ingredients and give detailed steps."
},
{
"role": "user",
"content": "Include ingredients: chicken breast, garlic, lemon, rosemary, olive oil"
}
]
# Generate
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=500, do_sample=False)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
For more flexibility, you can load just the LoRA adapters:
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load base model
base_model = "Qwen/Qwen2.5-1.5B-Instruct"
adapter_id = "Daniel-Krasik/Qwen2.5-1.5B-QLoRA-Recipe-adapters"
tokenizer = AutoTokenizer.from_pretrained(base_model)
model = AutoModelForCausalLM.from_pretrained(base_model, device_map="auto")
model = PeftModel.from_pretrained(model, adapter_id)
This model is not suitable for:
The model was fine-tuned on the recipe-nlg-llama2 dataset, containing approximately 2 million recipes with structured fields:
| Field | Description |
|---|---|
title | Recipe name |
NER | Named entities (ingredients) |
ingredients | Full ingredient list with quantities |
directions | Step-by-step cooking instructions |
Data Splits:
# Quantization Settings
load_in_4bit: true
bnb_4bit_quant_type: nf4
bnb_4bit_use_double_quant: true
bnb_4bit_compute_dtype: bfloat16
# LoRA Architecture
lora_r: 16
lora_alpha: 32
lora_dropout: 0.1
target_modules: ["q_proj", "v_proj"]
| Specification | Value |
|---|---|
| GPU | NVIDIA A100 (40GB) |
| Training Time | ~1 hour |
| Peak Memory | ~12GB |
| Platform | RunPod |
The model was evaluated using multiple metrics to ensure comprehensive assessment:
| Metric | Base Model | Fine-Tuned | Relative Improvement |
|---|---|---|---|
| ROUGE-1 | 30.5% | 48.5% | +59% |
| ROUGE-2 | 7.1% | 28.3% | +299% |
| ROUGE-L | 16.8% | 39.2% | +134% |
| Metric | Base Model | Fine-Tuned | Change |
|---|---|---|---|
| Precision | 0.817 | 0.815 | -0.002 |
| Recall | 0.857 | 0.856 | -0.001 |
| F1 | 0.836 | 0.835 | -0.001 |
Near-identical BERTScores confirm the model learned format/vocabulary alignment without semantic drift.
| Benchmark | Base Model | Fine-Tuned | Retention |
|---|---|---|---|
| MMLU | 70.7% | 68.7% | 97.2% |
| HellaSwag | 66.0% | 64.0% | 97.0% |
The model retained 97% of its general capabilities while gaining significant domain expertise.
Input: chicken breast, marinara sauce, penne noodles, Merlot wine, olive oil, water, cilantro
Generated Output:
Chicken Penne
Ingredients:
- chicken breast
- marinara sauce
- penne noodles
- Merlot wine
- olive oil
- water
- cilantro
Directions:
- Preheat oven to 375 degrees F (190 degrees C). Place the chicken breasts in a large baking dish; brush with olive oil and sprinkle with salt and pepper. Bake until cooked through, about 20 minutes.
- Meanwhile, cook the pasta according to package directions. Drain well.
- In a small bowl, whisk together the marinara sauce, wine, and water. Pour over the chicken and toss to coat. Add the pasta and toss to combine. Sprinkle with cilantro leaves and serve hot.
Input: olive oil, potatoes, onion, eggs, salt, pepper, flat-leaf parsley
Generated Output:
Potato Frittata
Directions:
- Heat the oil in a large skillet over medium heat; add the potatoes and cook until tender, about 10 minutes.
- Add the onion and cook until soft, about 5 minutes.
- Remove from heat and let cool slightly.
- In a bowl, whisk together the eggs, salt, and pepper.
- Stir in the cooled potato mixture.
- Pour into a greased 9-inch baking dish.
- Bake at 375°F for 20 to 25 minutes or until set.
@software{qwen_qlora_chef_2025,
author = {Daniel Krasik},
title = {Qwen-QLoRA-Chef: Fine-tuning Qwen2.5 for Recipe Generation using QLoRA},
year = {2025},
publisher = {GitHub},
url = {https://github.com/danielkrasik3010/Qwen-QLoRA-Chef},
note = {A complete pipeline for domain-adaptive language model fine-tuning}
}
Daniel Krasik