[PR #15610] [CLOSED] Handle large Gemma4 thinking prompt defaults #41102

Closed
opened 2026-04-23 01:50:00 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15610
Author: @dhiltgen
Created: 4/15/2026
Status: ❌ Closed

Base: main ← Head: gemma4-thinking


📝 Commits (1)

  • d28bfe4 Handle large Gemma4 thinking prompt defaults

📊 Changes

9 files changed (+171 additions, -27 deletions)

View changed files

📝 model/renderers/gemma4.go (+5 -1)
📝 model/renderers/gemma4_reference_test.go (+17 -0)
📝 model/renderers/renderer.go (+11 -0)
📝 server/create.go (+2 -0)
📝 server/prompt.go (+15 -1)
📝 server/prompt_test.go (+59 -0)
📝 types/model/config.go (+10 -8)
📝 x/create/client/create.go (+34 -17)
📝 x/create/client/create_test.go (+18 -0)

📄 Description

The ConfigV2 allow runtime selection of the renderers. If we want to bake different renderer names into the created models we can avoid that change.

For large Gemma4 models, when the request does not explicitly ask for thinking, the renderer appends this after the generation prompt:

<|channel>thought
<channel|>

That primes an empty thought channel so the model transitions into the response channel instead of emitting raw control fragments like thought, <channel|>, etc. into user-visible text.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15610 **Author:** [@dhiltgen](https://github.com/dhiltgen) **Created:** 4/15/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `gemma4-thinking` --- ### 📝 Commits (1) - [`d28bfe4`](https://github.com/ollama/ollama/commit/d28bfe46b06522bc9a25679f0f30ce73d31e0908) Handle large Gemma4 thinking prompt defaults ### 📊 Changes **9 files changed** (+171 additions, -27 deletions) <details> <summary>View changed files</summary> 📝 `model/renderers/gemma4.go` (+5 -1) 📝 `model/renderers/gemma4_reference_test.go` (+17 -0) 📝 `model/renderers/renderer.go` (+11 -0) 📝 `server/create.go` (+2 -0) 📝 `server/prompt.go` (+15 -1) 📝 `server/prompt_test.go` (+59 -0) 📝 `types/model/config.go` (+10 -8) 📝 `x/create/client/create.go` (+34 -17) 📝 `x/create/client/create_test.go` (+18 -0) </details> ### 📄 Description The ConfigV2 allow runtime selection of the renderers. If we want to bake different renderer names into the created models we can avoid that change. For large Gemma4 models, when the request does not explicitly ask for thinking, the renderer appends this after the generation prompt: ``` <|channel>thought <channel|> ``` That primes an empty thought channel so the model transitions into the response channel instead of emitting raw control fragments like thought, <channel|>, etc. into user-visible text. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 01:50:00 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#41102