chore: update mlx-swift-lm to fix/gemma4-pad-eos-token#70
Merged
Conversation
Points to fix(Gemma4): add pad token (ID=0) to eosTokenIds to prevent infinite padding loops when Gemma-4 prompts exceed the 1024-token sliding window attention limit.
Contributor
There was a problem hiding this comment.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…uery bug) Adds option 9 to run_benchmark.sh to reproduce and track the bug where Gemma-4 fails to call tools for vague natural-language queries. Test structure (11 total requests): [1/3] Vague 'what is the news' + web_search tool — 5 runs, need ≥3 tool_calls [2/3] Same query, no tools — 3 runs, need 3 coherent text responses (sanity) [3/3] Explicit 'Use web_search...' + tool — 3 runs, need 3 tool_calls Pass criteria: all three sections meet their thresholds. Root cause (documented): The chat_template.jinja appends <|channel>thought\n<channel|> to every non-thinking generation prompt. This flattens the first-token logit distribution for vague queries when tools are present, causing the model to output garbage tokens or ignore tools entirely. Baseline (unfixed): 0/5 vague tool_calls, 3/3 explicit tool_calls. Target (fixed): ≥3/5 vague tool_calls, 3/3 explicit tool_calls.
…nchmark.sh - Swap Quit/regression: 8=Regression, 9=Quit (conventional placement) - Move Test 8 handler block to after BIN+FULL_MODEL are assigned (was incorrectly placed before model selection, causing empty $FULL_MODEL) - Restore accidentally removed 'if [ suite_opt == 2 ]' guard
Member
Author
- Implemented Server.swift workaround to force enable_thinking=true for gemma4 with tools - Extracted and tracked <|channel>thought tags correctly in prompt cache states - Fixed run_benchmark.sh to properly parse tool testing outcomes with adjusted max_tokens and system prompts
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.
Points to fix(Gemma4): add pad token (ID=0) to eosTokenIds to prevent infinite padding loops when Gemma-4 prompts exceed the 1024-token sliding window attention limit.