Text Generation
Transformers
Safetensors
PEFT
English
qwen3
qwen
cooking
recipes
fine-tuned
lora
knowledge-distillation
synthetic-data
rag
question-answering
conversational
text-generation-inference
Run this model with HF Jobs
Run burpi/Cooking-Qwen-Merged on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/burpi/Cooking-Qwen-Merged. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/burpi/Cooking-Qwen-Merged on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/burpi/Cooking-Qwen-Merged. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/burpi/Cooking-Qwen-Merged. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use burpi/Cooking-Qwen-Merged with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use burpi/Cooking-Qwen-Merged with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="burpi/Cooking-Qwen-Merged") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("burpi/Cooking-Qwen-Merged") model = AutoModelForCausalLM.from_pretrained("burpi/Cooking-Qwen-Merged", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - PEFT
How to use burpi/Cooking-Qwen-Merged with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use burpi/Cooking-Qwen-Merged with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "burpi/Cooking-Qwen-Merged" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "burpi/Cooking-Qwen-Merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/burpi/Cooking-Qwen-Merged
- SGLang
How to use burpi/Cooking-Qwen-Merged with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "burpi/Cooking-Qwen-Merged" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "burpi/Cooking-Qwen-Merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "burpi/Cooking-Qwen-Merged" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "burpi/Cooking-Qwen-Merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use burpi/Cooking-Qwen-Merged with Docker Model Runner:
docker model run hf.co/burpi/Cooking-Qwen-Merged
File size: 12,075 Bytes
6f81477 bcd1229 6f81477 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 bcd1229 5221f04 6f81477 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 6f81477 5221f04 4fb1fdc 6f81477 4fb1fdc 6f81477 4fb1fdc 6f81477 4fb1fdc 6f81477 4fb1fdc 6f81477 4fb1fdc 6f81477 bcd1229 6f81477 4fb1fdc 5221f04 4fb1fdc 6f81477 4fb1fdc 5221f04 4fb1fdc 6f81477 4fb1fdc 6f81477 4fb1fdc 6f81477 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 6f81477 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 6f81477 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 6f81477 4fb1fdc 5221f04 4fb1fdc 6f81477 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 6f81477 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 6f81477 4fb1fdc 6f81477 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 5221f04 4fb1fdc 6f81477 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | ---
language:
- en
library_name: transformers
pipeline_tag: text-generation
tags:
- qwen
- cooking
- recipes
- fine-tuned
- lora
- peft
- knowledge-distillation
- synthetic-data
- rag
- question-answering
- conversational
base_model: Qwen/Qwen3-0.6B
base_model_relation: finetune
model-index: []
---
# Cooking-Qwen-Merged
**A small, specialized cooking language model fine-tuned using synthetic instruction data, knowledge distillation, and Low-Rank Adaptation (LoRA).**
## Overview
Cooking-Qwen-Merged is a fine-tuned Qwen language model designed to answer cooking questions, explain recipes, identify ingredient quantities, and provide preparation guidance.
The goal of this project was straightforward: **build and fine-tune a functional cooking assistant within a single weekend.**
Rather than training a language model from scratch, the project uses a pretrained Qwen model and a teacher–student knowledge distillation pipeline to generate specialized training data.
A larger language model was provided with relevant recipe information retrieved from a vector database. Its generated answers were then used to fine-tune the smaller model using LoRA.
The resulting model contains approximately 597 million parameters, with fewer than 0.2% updated during fine-tuning.
## Model Details
| Property | Description |
|---|---|
| Developer | Murphy Amos |
| Hugging Face | [burpi](https://huggingface.co/burpi) |
| Model type | Causal language model |
| Architecture | Qwen3 |
| Base model | [Qwen3-0.6B](https://huggingface.co/Qwen/Qwen3-0.6B) |
| Parameters | 597,196,800 |
| Language | English |
| Specialization | Cooking and recipe question answering |
| Fine-tuning method | Supervised fine-tuning with LoRA |
| Training framework | PyTorch, Transformers, PEFT |
| Distribution | Merged model weights |
| License | Pending verification of base model and dataset licenses |
## Project Objective
The objective was to develop a small, domain-specific cooking assistant over a weekend using existing open-source machine learning tools.
The project involved building a data-generation pipeline, generating thousands of cooking-related questions, using a larger teacher model to produce training responses, and fine-tuning a smaller Qwen model.
The focus was on delivering a working model rather than conducting a formal research experiment.
## Intended Uses
Cooking-Qwen-Merged is intended for:
- Answering general cooking questions.
- Explaining recipe instructions and preparation methods.
- Identifying ingredients and their quantities.
- Suggesting ingredient substitutions.
- Explaining cooking techniques.
- Assisting with recipe scaling.
- Providing beginner-friendly cooking guidance.
- Answering questions using externally retrieved recipe context.
### Out-of-Scope Uses
The model is not intended to replace professional advice regarding nutrition, food allergies, or food safety.
Generated cooking instructions should be independently verified when incorrect information could create a safety risk.
## How to Use
Install the required dependencies:
```bash
pip install torch transformers accelerate
```
Load the merged model from Hugging Face:
```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "burpi/Cooking-Qwen-Merged"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
dtype=torch.float32
)
model.eval()
question = "How do I cook a steak on the stove?"
messages = [
{
"role": "system",
"content": "You are a cooking assistant. Answer cooking questions clearly and accurately."
},
{
"role": "user",
"content": question
}
]
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=256,
do_sample=False,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(
outputs[0][inputs["input_ids"].shape[1]:],
skip_special_tokens=True
)
print(response)
```
This example assumes the repository contains the merged model weights and tokenizer files.
The model can also be combined with a retrieval system to supply recipe-specific information during inference.
## Training Methodology
### Dataset and Question Generation
The project began with a structured recipe dataset containing ingredients, quantities, cooking instructions, and other recipe information.
Using **ChatGPT Astra**, a collection of **~5,000 cooking-related questions** was generated based on the dataset.
These questions covered ingredient measurements, cooking techniques, preparation instructions, recipe scaling, substitutions, dietary modifications, and troubleshooting.
### Synthetic Response Generation Using Gemini and RAG
The generated questions were then processed through a Retrieval-Augmented Generation (RAG) pipeline using **Google Gemini** as the teacher language model.
For each question, the pipeline:
1. Queried a vector database containing recipe information.
2. Retrieved relevant recipe context.
3. Supplied the question and retrieved context to Gemini.
4. Generated a cooking-related answer grounded in the retrieved information.
5. Stored the resulting question–answer interaction for fine-tuning.
This produced synthetic conversational training data based on the original recipe dataset.
### Student Model Fine-Tuning
The generated question–answer interactions were used to fine-tune a pretrained **Qwen3-0.6B** causal language model.
Fine-tuning was performed using **Low-Rank Adaptation (LoRA)** through Hugging Face PEFT, updating approximately 0.192% of the model's parameters.
The objective was to transfer cooking-specific response behavior from Gemini-generated examples into a smaller Qwen model capable of running independently.
### Training Dataset
The training logs reported the following split:
| Dataset | Examples |
|---|---:|
| Training | 4,270 |
| Evaluation | 1,068 |
| Total | 5,338 |
The original question-generation collection contained 5,000 questions. The reported example counts are taken from the training logs and have not been reconciled with the question count.
### Pipeline Summary
**Recipe Dataset → Astra (Question Generation) → Gemini + RAG (Response Generation) → Synthetic Question–Answer Dataset → Qwen (LoRA Fine-Tuning) → Merged Cooking Model**
## Parameter-Efficient Fine-Tuning
Low-Rank Adaptation (LoRA) was used to update a small subset of the model's parameters.
| Training property | Value |
|---|---:|
| Total parameters | 597,196,800 |
| Trainable parameters | 1,146,880 |
| Trainable proportion | 0.192% |
| Initial learning rate | Approximately 0.0002 |
| Training steps | Approximately 2,150 |
| Training approach | LoRA / PEFT |
| Optimization objective | Supervised next-token prediction |
LoRA adapters were applied to selected attention projection layers, including query and value projections.
The trained adapter was subsequently merged with the pretrained model weights.
## Training Performance
The model was fine-tuned for approximately 2,150 optimization steps using LoRA and a linearly decaying learning-rate schedule.
### Training and Evaluation Curves

The graph shows:
- Raw training loss.
- Smoothed training loss.
- Evaluation loss at recorded checkpoints.
- Learning-rate decay throughout training.
### Training Metrics
| Metric | Approximate value |
|---|---:|
| Initial recorded training loss | 3.17 |
| Final training loss | 1.40 |
| Final evaluation loss | 1.41 |
| Training-loss reduction | 56% |
| Initial learning rate | 0.0002 |
| Final learning rate | Approximately 0 |
| Optimization steps | Approximately 2,150 |
| Learning-rate schedule | Linear decay |
### Training Observations
**Initial convergence:** Training loss decreased rapidly during the first 200–300 optimization steps, indicating substantial early adaptation to the cooking instruction dataset.
**Continued optimization:** Loss decreased more gradually throughout the remaining training process, stabilizing around 1.35–1.45.
**Evaluation performance:** Evaluation loss remained approximately 1.4 at the recorded evaluation checkpoints. The relatively small difference between training and evaluation loss suggests no obvious severe overfitting at those checkpoints, although further testing is necessary.
**Learning-rate behavior:** The learning rate decreased approximately linearly from 2 × 10⁻⁴ to zero across the training run.
### Interpretation
The results demonstrate that the LoRA fine-tuning process reduced the model's next-token prediction loss on the cooking instruction dataset.
These measurements establish training convergence but do not independently verify cooking accuracy, factual reliability, or improvement over the original pretrained model.
## Evaluation Status
The model has undergone preliminary interactive testing with cooking-related questions.
A comprehensive independent benchmark comparing the pretrained and fine-tuned models has not yet been completed.
Future evaluations may measure:
- Ingredient quantity accuracy.
- Factual answer accuracy.
- Cooking instruction correctness.
- Hallucination frequency.
- Performance on unseen recipes.
- Standalone versus retrieval-augmented performance.
## Limitations
Cooking-Qwen-Merged has several limitations:
- The model may generate incorrect ingredient quantities, cooking times, or temperatures.
- It may produce plausible but unsupported cooking instructions.
- Synthetic training data may contain errors inherited from the teacher model or retrieval pipeline.
- Some generated training questions contain formatting or measurement inconsistencies.
- The model has not been comprehensively evaluated on unseen recipes.
- Fine-tuning does not guarantee memorization of the complete recipe database.
- Retrieval augmentation may improve performance on questions requiring exact recipe information.
The model should be treated as a cooking assistant rather than an authoritative recipe database.
## Technical Architecture
The model is based on a pretrained Qwen causal language model.
Its development used:
- **PyTorch:** Model execution and optimization.
- **Hugging Face Transformers:** Model loading and training.
- **PEFT:** Parameter-efficient fine-tuning.
- **LoRA:** Low-rank weight adaptation.
- **Vector database:** Recipe retrieval during synthetic data generation.
- **Teacher language model:** Generation of supervised training responses.
After fine-tuning, the LoRA adapter was merged into the base model for deployment.
## Future Improvements
Potential improvements include:
1. Benchmarking the fine-tuned model against the original Qwen model.
2. Improving the quality and consistency of synthetic training examples.
3. Testing generalization on recipes excluded from training.
4. Quantizing the model to reduce memory requirements.
5. Comparing standalone inference with retrieval-augmented inference.
6. Integrating the model into a cooking assistant application.
## Project Background
Cooking-Qwen-Merged was developed as an independent weekend machine learning project.
The project demonstrates a practical workflow for creating a specialized language model using retrieval-grounded synthetic data, teacher–student distillation, and parameter-efficient fine-tuning.
It is an engineering project rather than a peer-reviewed research publication.
## Citation
**Amos, M. (2026). Cooking-Qwen-Merged: A Small Cooking Language Model Fine-Tuned with Synthetic Instruction Data and LoRA. Hugging Face.**
https://huggingface.co/burpi/Cooking-Qwen-Merged
## Author
**Murphy Amos**
AI Software Engineer | Computer Game Development Undergraduate
[GitHub](https://github.com/MurphyAmos) | [Hugging Face](https://huggingface.co/burpi)
|