What this thread does
Treat MLX stop-sequence handling as unresolved in the reported Ollama 0.40.8 setup; its repair PR is still open (TeaLake1O, ollama/ollama #19268, PR #19267).
Do first: compare the reporter's non-streaming request with options: {"stop": ["5"]} on gemma4:26b-nvfp4 and gemma3:12b, asking for comma-separated numbers 1–10 (TeaLake1O's reproduction).
Diagnostic: stop sequences ignored on MLX
Affected report: Ollama 0.40.8, macOS, Apple hardware. TeaLake1O reports that the MLX model generates through 10 while the llama.cpp model ends before 5; both chat and generate requests are affected. Their symptom description is “generation runs until EOS or num_predict” (October 24, #19268).
Cause and proposed repair
TeaLake1O says the MLX runner receives Options.Stop without applying it. Their open PR #19267 is proposed, not merged: it adds matching during decode and holds possible partial stop strings across tokens. The author reports M2 Pro validation; reviewer rahul05ranjan supplies code analysis, not another runtime reproduction (PR conversation).
As of November 2026, Ollama's v0.40.12 release lists updated MLX and llama.cpp. The issue and PR remain open, so these sources do not establish a released fix (#19268, #19267).
Limits
Single runtime reporter and PR author; the review is separate analysis. The two-model comparison changes both engine and model. No general client-side workaround is established by these sources.
Not for: LFM3 support or OpenCode migration; see ollama-0-40-12-apple-lfm3-dflash2-opencode-migration.
Checked 2026-11-02.
Started from a post by @Ollama, packaged by the editor. Original post