You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

Resep ID Chat Gemma 4 E4B

A full fine-tune of google/gemma-4-E4B-it that writes Indonesian recipes the way Indonesian home cooks actually write them — short, structured, and with the right bumbu. The better chat version than junwatu/resep-ID-gemma-4-E2B-it.

What this model is for

Give it a dish title or a list of ingredients in Bahasa Indonesia, get back a recipe in the standard Indonesian home-cook format:

Bahan-bahan:
- 500 gr ayam fillet
- 5 siung bawang merah
- 3 siung bawang putih
- ...

Cara membuat:
1. Goreng ayam hingga matang...
6. Sajikan hangat.

What it does better than the base Gemma 4 E4B and the e2b release

Trained on 183K cleaned Indonesian recipes (~3× more data than the e2b release).

google/gemma-4-E4B-it (stock) resep-ID-gemma-4-E2B-it (prior release) This model (E4B)
Final eval loss n/a 1.26 1.09
Format compliance (Bahan + Langkah) inconsistent high 100% (50/50 on held-out test)
Recipe length vs real recipes rambles sometimes too short realistic (avg ~16 ingredients, len_ratio 1.07)
Inference artifacts (Unicode fractions, fake unit abbreviations) n/a required no_repeat_ngram_size=6 workaround; some still slipped through zero (with the decode params below)
Indonesian recipe vocabulary uses unnatural phrasing natural natural, with home-cook touches (koreksi rasa, geprek, Sajikan hangat)
Common dishes misses key ingredients better better still on common, similar on long-tail

What it does NOT do well

Be honest about what to expect:

  • Long-tail / sophisticated dishes: when asked for something elaborate (e.g. Beef Wellington, very regional specialties), the model retreats to a simpler, safer dish using the same ingredients. The training data is dominated by home-cook recipes, so the model trends there.
  • Special diet modifiers (MPASI baby food, DEBM low-carb, etc.): often ignored — the model gives a normal recipe.
  • "Saya punya X, Y, enaknya dimasak apa?" prompts: model picks a sensible dish from the ingredients, but it may not be the same dish as a particular reference. Both can be valid uses of the same ingredients.

For these cases the base Gemma 4 isn't better either — they need either a much larger model or a curated specialty dataset.

⚠️ Critical inference setting (different from e2b release)

Use no_repeat_ngram_size=0 and repetition_penalty=1.10.

The e2b release used no_repeat_ngram_size=6 to break bumbu-list mode-collapse. On this larger e4b model + the cleaned 183K corpus, that same setting causes the kind of artifacts we were trying to avoid: it forces the model to substitute Unicode fractions, invent unit abbreviations, and morph valid words when it can't repeat a 6-token window. A 50-sample eval validated that disabling the n-gram block (with the repetition penalty bumped slightly) removes every artifact pattern.

How to use

from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model_id = "junwatu/resep-ID-chat-gemma-4-E4B-it"
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=1280,
    do_sample=False,
    repetition_penalty=1.10,    # was 1.05 in the e2b release
    no_repeat_ngram_size=0,     # was 6 in the e2b release
    pad_token_id=tok.eos_token_id,
)
print(tok.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))

Two generate() arguments differ from the e2b release. Re-using the e2b defaults on this model produces visible artifacts.

Training summary

  • Base: google/gemma-4-E4B-it (≈8B effective params; vision + audio towers frozen during training)
  • Data: 183,218 cleaned Indonesian home recipes TRL prompt+completion chat format
  • Method: Supervised fine-tune, 1 epoch, full FT
  • Hyperparameters: LR 1e-5 (cosine), per-device batch 2, grad-accum 8 (effective batch 16), seq-len 2048, weight-decay 0, warmup-ratio 0.03
  • Compute: AMD Instinct MI300X (192 GB HBM3, ROCm 7.2, PyTorch 2.11.0 rocm7.2 native wheel), bf16, SDPA attention
  • Wall-time: 9 h 41 min for 11,452 optimizer steps
  • Final eval_loss: 1.0909 (vs 20K-validation best 1.2103, e2b release final 1.26)
  • Best-checkpoint policy: load_best_model_at_end=Truecheckpoint-11200 weights are what's saved here

Stack pins (these matter — the rocm6.2 wheel has a bf16-backward NaN bug on Gemma 4):

Component Version
torch 2.11.0+rocm7.2
transformers 5.8.0
trl 1.3.0
peft 0.19.1
accelerate 1.13.0
datasets 4.8.5
huggingface_hub 1.14.0

Limitations & disclosures

  • Single-epoch budget run. Quality could be higher with more compute and more curated long-tail / regional recipes.
  • Plausible but not authoritative. Use as a starting point, not as a definitive cookbook for any specific dish.
  • Decode params matter. Re-using the e2b inference settings on this model will produce the same Unicode-fraction / fake-unit artifacts the e2b release was famous for. Always set no_repeat_ngram_size=0 and repetition_penalty=1.10 (or read them from NO_REPEAT_NGRAM / REPETITION_PENALTY env vars if using the project's pre_eval.hf_generate).
  • License: inherits the Gemma Terms of Use from the base model.

Acknowledgements

Downloads last month
1
Safetensors
Model size
8B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for junwatu/resep-ID-chat-gemma-4-E4B-it

Finetuned
(362)
this model
Quantizations
1 model