Skip to content

fix(tokenizer): enable add_bos_token for Gemma 4 base models - #8044

Closed
Souravrajvi0 wants to merge 3 commits into
unslothai:mainfrom
Souravrajvi0:feat/gemma4-base-bos-token-8664
Closed

Souravrajvi0 wants to merge 3 commits into
unslothai:mainfrom
Souravrajvi0:feat/gemma4-base-bos-token-8664

Conversation

@Souravrajvi0

Copy link
Copy Markdown
Contributor

Gemma 4 base (non-it) unsloth Hub mirrors ship without add_bos_token: true even though google/gemma-4-* includes it. Without BOS, base-model inference degenerates into repeated text.

Set add_bos_token at load time for the four base families (E2B, E4B, 31B, 26B-A4B) and their -unsloth-bnb-4bit variants. -it models are untouched because their chat templates already emit bos_token.

Fixes #7903.

@Souravrajvi0
Souravrajvi0 marked this pull request as draft August 6, 2026 16:51
@Souravrajvi0
Souravrajvi0 force-pushed the feat/gemma4-base-bos-token-8664 branch 2 times, most recently from ff06984 to 3cd461f Compare August 13, 2026 05:02
Souravrajvi0 and others added 3 commits August 15, 2026 07:01
Gemma 4 base (non-it) unsloth Hub mirrors ship without add_bos_token: true
even though google/gemma-4-* includes it. Without BOS, base-model inference
degenerates into repeated text.

Set add_bos_token at load time for the four base families (E2B, E4B, 31B,
26B-A4B) and their -unsloth-bnb-4bit variants. -it models are untouched
because their chat templates already emit bos_token.

Fixes unslothai#7903.
Co-authored-by: souravrajvidev-glitch <[email protected]>
@Souravrajvi0
Souravrajvi0 force-pushed the feat/gemma4-base-bos-token-8664 branch from 3cd461f to 6d06ad0 Compare August 15, 2026 07:01
@Souravrajvi0

Copy link
Copy Markdown
Contributor Author

Closing to reduce PR queue noise while maintainers are not actively reviewing. Happy to reopen a focused PR if there is interest in this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Gemma 4 base models are missing <bos> token in tokenizer config

1 participant