--- license: gemma base_model: google/gemma-4-e2b-it datasets: - junwatu/indonesian-recipes language: - id tags: - text-generation - recipes - indonesian - cooking - gemma - gemma-4 - conversational pipeline_tag: text-generation --- # Resep Masakan Indonesia Gemma 4 A fine-tune of `google/gemma-4-e2b-it` that writes Indonesian recipes the way Indonesian home cooks actually write them — short, structured, and with the right bumbu. ## What this model is for Give it a dish title in Bahasa Indonesia, get back a recipe in the standard Indonesian home-cook format: ``` Bahan: - 500 gr ikan kering - 5 siung bawang merah - 3 siung bawang putih - 1 buah tomat - ... Langkah: 1. Goreng ikan kering hingga matang dan kering. 2. Tumis bumbu halus hingga harum... 6. Sajikan hangat. ``` ## What it does better than the base Gemma 4 E2B I fine-tuned the base model on 66K real Indonesian recipes (mainly home cooking — ayam, sapi, ikan, kambing, tahu, tempe, telur, udang). Compared to the stock `google/gemma-4-e2b-it`: | | Stock Gemma 4 E2B | This model | |---|---|---| | Recipe format consistency | Mostly OK | **Always Bahan + Langkah** | | Recipe length vs real recipes | ~50% too long, rambles | **Matches real recipes — concise** | | Knows Indonesian recipe vocabulary (`tumis`, `koreksi rasa`, `Sajikan`) | Sometimes uses unnatural phrasing | **Uses the natural words home cooks use** | | Common Indonesian dishes (Rendang, Pepes, Tumis, Sambal) | Often misses key ingredients | **Better ingredient profiles for common dishes** | | Indonesian fluency | Good (5/5) | Good (~4.6/5 — small artifact rate) | Overall on a 50-recipe blind eval against real home-cook references: **+12% quality vs the stock base**. ## What it does NOT do well Be honest with yourself about what to expect: - **Regional / less-common dishes** (e.g. Tahu Thek, Sosis Solo, Tempe Mendoan, Cabe Gendot) — the model will give you a generic recipe that ignores the specific dish identity. The training data didn't have enough examples. - **Special diet modifiers** (MPASI baby food, DEBM low-carb diet, etc.) — it ignores these qualifiers and gives a normal recipe. - **Defining secret ingredients** — Padang dishes might be missing santan; "kuning" dishes might miss kunyit/asam jawa. For these cases the base Gemma 4 isn't better either — they're hard problems that need either a much larger model or a curated specialty dataset. ## How to use This model needs **one important inference setting** to work properly: `no_repeat_ngram_size=6`. Without it, the model can get stuck repeating ingredient lines on long recipes. This setting is a single inference-time argument; everything else works like any standard Gemma chat model. ```python from transformers import AutoModelForCausalLM, AutoTokenizer import torch model_id = "junwatu/gemma-4-e2b-resep-id" # adjust to actual repo tok = AutoTokenizer.from_pretrained(model_id) model = AutoModelForCausalLM.from_pretrained( model_id, dtype=torch.bfloat16, device_map="auto", ) messages = [{ "role": "user", "content": ( 'Tulis resep masakan Indonesia berjudul: "Tumis Kangkung Tempe".\n' "Format jawaban:\n" "Bahan:\n- (daftar bahan, satu per baris)\n\n" "Langkah:\n1. (langkah pertama)\n2. (langkah kedua)\n...\n" "Gunakan Bahasa Indonesia." ), }] inputs = tok.apply_chat_template( messages, add_generation_prompt=True, return_tensors="pt", return_dict=True, ).to(model.device) out = model.generate( **inputs, max_new_tokens=1024, do_sample=False, repetition_penalty=1.05, no_repeat_ngram_size=6, # ← important pad_token_id=tok.eos_token_id, ) print(tok.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True)) ``` ## Training summary (for the curious) - **Base**: `google/gemma-4-e2b-it` (4.6B effective params, vision/audio paths frozen during training) - **Data**: ~66K Indonesian home recipes (HF parquet) - **Method**: Supervised fine-tune, prompt + completion format, 1 epoch - **Compute**: AMD MI300X (192 GB HBM3), ~1.5 hours, bf16 - **Final eval loss**: 1.26 Full technical details in the project repo. ## Limitations & honest disclosures - This is a **single-epoch** run on a budget. Quality could be higher with more compute and better data curation. - Model occasionally produces **odd fraction notation** like `1/n sdt` — these are minor inference-time glitches from the n-gram repetition guard. Easy to clean up if you're using the output programmatically. - Some recipes will be **plausible but not authentic** to a specific region. Use it as a starting point, not a definitive cookbook. - **License**: inherits the [Gemma Terms of Use](https://ai.google.dev/gemma/terms) from the base model. ## Acknowledgements - Base model: [google/gemma-4-e2b-it](https://huggingface.co/google/gemma-4-e2b-it) - Dataset: Indonesian home recipe corpus (cleaned/curated) - Compute: AMD Instinct MI300X If you find this useful or have suggestions, open an issue on the model page.