[PR #15185] [MERGED] mlx: respect tokenizer add_bos_token setting in pipeline #40936

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

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15185
Author: @dhiltgen
Created: 3/31/2026
Status: Merged
Merged: 3/31/2026
Merged by: @dhiltgen

Base: mainHead: mlx_bos


📝 Commits (1)

  • da04d5d mlx: respect tokenizer add_bos_token setting in pipeline

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 x/mlxrunner/pipeline.go (+1 -1)

📄 Description

Replace hardcoded Encode(prompt, true) with
Encode(prompt, r.Tokenizer.AddBOS()) so the pipeline respects each model's tokenizer configuration.

Models with add_bos_token=true (gemma3, llama): unchanged, tokenizer still prepends BOS.

Models with bos_token=null (qwen3, qwen3.5): unchanged, the BOS guard (vocab.BOS >= 0) already prevented prepending regardless of the flag.

This aligns the pipeline with the /v1/tokenize endpoint which already uses Tokenizer.AddBOS().


🔄 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/15185 **Author:** [@dhiltgen](https://github.com/dhiltgen) **Created:** 3/31/2026 **Status:** ✅ Merged **Merged:** 3/31/2026 **Merged by:** [@dhiltgen](https://github.com/dhiltgen) **Base:** `main` ← **Head:** `mlx_bos` --- ### 📝 Commits (1) - [`da04d5d`](https://github.com/ollama/ollama/commit/da04d5defb27b4e65e9e18ff1fb9d56aafe3caea) mlx: respect tokenizer add_bos_token setting in pipeline ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `x/mlxrunner/pipeline.go` (+1 -1) </details> ### 📄 Description Replace hardcoded Encode(prompt, true) with Encode(prompt, r.Tokenizer.AddBOS()) so the pipeline respects each model's tokenizer configuration. Models with add_bos_token=true (gemma3, llama): unchanged, tokenizer still prepends BOS. Models with bos_token=null (qwen3, qwen3.5): unchanged, the BOS guard (vocab.BOS >= 0) already prevented prepending regardless of the flag. This aligns the pipeline with the /v1/tokenize endpoint which already uses Tokenizer.AddBOS(). --- <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:42:53 -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#40936