[PR #12222] [MERGED] llm: Clamp batch size to context size #44986

Closed
opened 2026-04-25 00:41:03 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/12222
Author: @jessegross
Created: 9/9/2025
Status: Merged
Merged: 9/9/2025
Merged by: @jessegross

Base: mainHead: jessegross/batch


📝 Commits (1)

  • ea9e144 llm: Clamp batch size to context size

📊 Changes

3 files changed (+5 additions, -3 deletions)

View changed files

📝 integration/context_test.go (+1 -1)
📝 llm/server.go (+2 -0)
📝 runner/ollamarunner/cache.go (+2 -2)

📄 Description

The context must always be able to store the current batch, so if the user requests a small context then we should also shrink the batch to match. This also fixes the TestLongInputContext test on the new engine. (The old engine already has this behavior.)


🔄 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/12222 **Author:** [@jessegross](https://github.com/jessegross) **Created:** 9/9/2025 **Status:** ✅ Merged **Merged:** 9/9/2025 **Merged by:** [@jessegross](https://github.com/jessegross) **Base:** `main` ← **Head:** `jessegross/batch` --- ### 📝 Commits (1) - [`ea9e144`](https://github.com/ollama/ollama/commit/ea9e144bd651570313d3643e5bd4ab8ffcc21c7c) llm: Clamp batch size to context size ### 📊 Changes **3 files changed** (+5 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `integration/context_test.go` (+1 -1) 📝 `llm/server.go` (+2 -0) 📝 `runner/ollamarunner/cache.go` (+2 -2) </details> ### 📄 Description The context must always be able to store the current batch, so if the user requests a small context then we should also shrink the batch to match. This also fixes the TestLongInputContext test on the new engine. (The old engine already has this behavior.) --- <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-25 00:41:03 -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#44986