Strip Gemma 4 thinking tokens from translation output#29
Merged
Conversation
Contributor
Author
|
For the gemma4 model we need update-llama-cpp-2026-06-17 from llama-cpp-rs. But I guess it is only a matter of days when it is merged. :D It contains an important fix for the chat template. Sorry again, that I screwed up the PRs. |
Gemma 4 emits thinking content in two forms: - <|channel>thought\n...<channel|>answer (full block with closing tag) - <|channel>thought answer (no closing tag, space-separated) Handle both cases so thinking tokens never leak into the translation result.
eb5702d to
d1052b5
Compare
Emit a warning when apply_chat_template fails and ltengine falls back to the hardcoded Gemma prompt format.
711e00f to
9e897d7
Compare
Member
|
This looks OK, although it's a bit of a hack, we can include this, but long term it might be better to explicitly disable thinking mode from certain models, based on https://ai.google.dev/gemma/docs/capabilities/thinking it should be possible. |
Contributor
Author
I will look into this. :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I am sorry, the "Big" PR was not supposed to be merged anymore, since I thought splitting it up into several smaller ones would be good for review. Now it got a bit scrambled, and some PRs I squashed differently into the other ones, so the code is now in a weird state. I am going through everything and checking again. Sorry for that. So this PR is still needed since Gemma 4 answers contain this "thought".