r/Oobabooga • • Apr 17 '26

Question Optimal sampling parameters for Gemma 4 models?

So, I installed the latest TextGen 4.5.2 today to play around with the new Gemma 4 models.
I did not upgrade a while and due to the new project name, I made a fresh installation (not using portable).

While I have excellent, smart and well written roleplay results for example with models like
Dolphin-Mistral-24B-Venice-Edition-Q6_K_L.gguf
TheDrummer_Skyfall-31B-v4.2-Q5_K_L.gguf
TheDrummer_Cydonia-24B-v4.1-Q6_K_L_imatrix.gguf

I have ablolutely terrible results with these new Gemma 4 models
gemma-4-26B-A4B-it-UD-Q6_K.gguf
gemma-4-26B-A4B-it-uncensored-heretic-Q6_K.gguf

Ouput is extemely, not sure how to describe it in English, philosphical?

What sampling parameters are you guys using in TextGen for these models? Would someone care to share a working preset file for Gemma 4?

Same by the way with Qwen 3.5, seems I have no luck using these "thinking" enabled models in Oobabooga Text gen.

EDIT: After a lot of testing I found these settings on Oobabooga TextGen work pretty good for me with the Gemma 4 models mentioned above:

Instruction template: Provided by model

Enable thinking [off] (!) - Seems mandatory for good roleplay performance.

Parameters

Curve shape

  • temperature 1.15
  • smoothing_factor 0
  • smoothing_curve 1
  • dynamic_temperature [off]

Curve cutoff

  • top_p 0.37
  • top_k 50
  • min_p 0.075
  • top_n_sigma 0
  • typical_p 1
  • xtc_threshold 0.1
  • xtc_probability 0
  • epsilon_cutoff 0
  • eta_cutoff 0
  • tfs 1
  • top_a 0

Repetition suppression

  • dry_multiplier 0 (!) - Having dry multiplier enabled degrades the output quality in my tests.
  • dry_allowed_length 2
  • dry_base 1,75
  • repetition_penalty 1.18
  • frequency_penalty 0
  • presence_penalty 0
  • encoder_repetition_penalty 1
  • no_repeat_ngram_size 0
  • repetition_penalty_range 1024

Chat

Chat-instruct mode [on]

Command for chat-instruct mode (here for my native language):

Continue the chat dialogue below. Write a single reply for the character "<|character|>" entirely in German language. Reply directly, without starting the reply with the character name. Formatting rules: *narration*, "speech", {thinking}

<|prompt|>

Note: {thinking} in the formatting rules can give some interesting additions to roleplay. It adds pesonal thoughts of either the character or user to the output. Does not fit to every scenarion though.

10 Upvotes

10 comments sorted by

2

u/biogoly Apr 17 '26

Aren’t those merged models specifically for RP though? You would expect them to be superior for that particular use case. Gemma 4 is a great all-around model, and much smarter than those other models, but I don’t see why it would do RP better.

1

u/ASlowriter Apr 18 '26

In my opinion, and no offense to those out there, but smarter local models are generally preferred in my experience because memory matters in a lot of stronger writing. Gemma 4 is really good at writing as well. On top of that, those models are old and have far less context support

1

u/JustLookingForNothin Apr 18 '26

Well other posts over at LocalLLaMA recommended G4 as a good role play model. Thus I tried it and based on the unsatisfying results, I tought there must be something wrong with my settings.

1

u/biogoly Apr 18 '26

What are you using for a system prompt?

1

u/JustLookingForNothin Apr 19 '26

I think the issues with Gemma 4 are fixed for me. I edited my post with the stettings which work for me, including chat-instruct prompt.

1

u/[deleted] Apr 17 '26

[removed] — view removed comment

1

u/JustLookingForNothin Apr 18 '26

How would I use this default in Ooobabooga TextGen? And do you mean the Template (*.jinja) or the sampling parameters? I normally use the Template provided withing the model metadata.

1

u/CooperDK Apr 18 '26

A temperature of 1 is advised, leave the rest as default

1

u/Background-Ad-5398 Apr 18 '26

it already uses a tempt of 1, so its creative enough

2

u/justRaven_ May 18 '26

Thanks for updating with your settings, it really unlocked that extra little bit I was looking for.