Downloads · 30 days
0
LordAhkam/chef-llm-dpo-v2
chef-llm-dpo-v2 is a machine learning model from LordAhkam. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
--- basemodel: unsloth/gemma-4-12b-it libraryname: peft pipelinetag: text-generation language: tr license: gemma tags: - dpo - lora - turkish - recipes - gastronomy - trl ---
Downloads · 30 days
0
Access
Public
Updated Aug 8, 2026
Repo size
74.9 MB
Likes
0
Public
Click a slice to open those files.
.safetensors42.7 MB · 57%
From the Hugging Face model README
base_model: unsloth/gemma-4-12b-it library_name: peft pipeline_tag: text-generation language: tr license: gemma tags:
Code: github.com/YusufGn219/chef.LLM
This is a LoRA adapter for unsloth/gemma-4-12b-it, fine-tuned with Direct
Preference Optimization (DPO) to improve its behavior on Turkish-language
cooking/recipe questions. Rather than re-teaching the model's entire
recipe-writing behavior from scratch (as earlier SFT attempts in this
project did), this adapter uses a small, targeted set of preference pairs
to nudge the model away from a few specific known failure modes while
staying close to the strong base model everywhere else.
This is the second (and, for now, final) DPO iteration in this project — see "Training History" below.
Turkish-language recipe generation, cooking Q&A, and food-science explanations. Research/hobby use.
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
base_model = AutoModelForCausalLM.from_pretrained(
"unsloth/gemma-4-12b-it", torch_dtype=torch.bfloat16, device_map="auto"
)
model = PeftModel.from_pretrained(base_model, "LordAhkam/chef-llm-dpo-v2")
tokenizer = AutoTokenizer.from_pretrained("LordAhkam/chef-llm-dpo-v2")
messages = [{"role": "user", "content": "Mercimek çorbası tarifi verir misin?"}]
inputs = tokenizer.apply_chat_template(
messages, tokenize=True, add_generation_prompt=True,
return_tensors="pt", return_dict=True
).to(model.device)
output = model.generate(**inputs, max_new_tokens=1024, do_sample=True, temperature=0.7, top_p=0.9)
print(tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
trl's DPOTrainerq_proj, k_proj,
v_proj, o_proj (attention-only), dropout=0.05(prompt, chosen, rejected) preference pairs,
hand-curated for this project — a mix of (a) pairs contrasting this
project's own earlier failed fine-tune attempts (degenerate
repetition-loop outputs) against coherent base-model answers, and (b)
pairs correcting specific factual/structural defects found during
evaluation (a leaked internal token, a misidentified regional dish, an
incorrect food-chemistry claim).g6e.xlargeThis project ran two DPO rounds on the same base model:
Round 2 was chosen for release because it permanently fixed a more structurally significant defect (an internal reasoning-trace token leaking into the final output) even though the aggregate score is statistically unchanged from round 1.
Evaluated on a 78-prompt Turkish recipe test set (basic recipes, dietary-constraint recipes, regional/technical/measurement questions, professional gastronomy terminology, and length/format instruction-following), scored on a 4-criterion rubric (format, fluency, factual consistency, detail; 1-5 each, hunter-mode scoring — actively checking for hallucinations rather than rewarding fluency alone).
| Model | Score |
|---|---|
Untuned base (unsloth/gemma-4-12b-it) | 85.1% |
| This model (DPO round 2) | 89.4% |
| DPO round 1 (not released) | 90.0% |
| Earlier SFT attempts (v1/v2/v3) | 68-78% |
This model is not fully corrected on all known defects. Confirmed still-present issues as of the round-2 evaluation:
Given these, this model should be treated as a research/hobby artifact for general Turkish recipe writing and formatting, not as an authoritative source for regional-dish provenance, food chemistry, or food-safety-critical dosing information (e.g. meat curing).
Inherits the Gemma Terms of Use
from the base model (unsloth/gemma-4-12b-it).