[PR #13068] [MERGED] logprob: add bytes to logprobs #19330

Closed
opened 2026-04-16 07:04:14 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/13068
Author: @ParthSareen
Created: 11/13/2025
Status: Merged
Merged: 11/13/2025
Merged by: @ParthSareen

Base: mainHead: parth/logprobs-bytes


📝 Commits (4)

  • 5556b10 logprob: add bytes to logprobs
  • 902535e update tests
  • fde1741 move logprobs to api layer
  • 661e2ac remove unused bytes param from server type

📊 Changes

4 files changed (+312 additions, -0 deletions)

View changed files

📝 api/types.go (+3 -0)
📝 integration/api_test.go (+25 -0)
📝 server/logprob.go (+15 -0)
📝 server/routes_generate_test.go (+269 -0)

📄 Description

The raw bytes are provided by OpenAI when logprobs are requested. This is for helping disambiguate unicode and emoji boundaries when using custom sampling strategies.

This PR adds bytes to both Ollama API and the OpenAI compatible endpoint

Ollama API

"logprobs": {
        "content": [
          {
            "token": "Hello",
            "logprob": -0.0005131333600729704,
            "bytes": [
              72,
              101,
              108,
              108,
              111
            ],
            "top_logprobs": [
              {
                "token": "Hello",
                "logprob": -0.0005131333600729704,
                "bytes": [
                  72,
                  101,
                  108,
                  108,
                  111
                ]
              },
...

OpenAI compatibility

      "logprobs": {
        "content": [
          {
            "token": "Hello",
            "logprob": -0.0005131333600729704,
            "bytes": [
              72,
              101,
              108,
              108,
              111
            ],
            "top_logprobs": [
              {
                "token": "Hello",
                "logprob": -0.0005131333600729704,
                "bytes": [
                  72,
                  101,
                  108,
                  108,
                  111
                ]
              },
...

🔄 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/13068 **Author:** [@ParthSareen](https://github.com/ParthSareen) **Created:** 11/13/2025 **Status:** ✅ Merged **Merged:** 11/13/2025 **Merged by:** [@ParthSareen](https://github.com/ParthSareen) **Base:** `main` ← **Head:** `parth/logprobs-bytes` --- ### 📝 Commits (4) - [`5556b10`](https://github.com/ollama/ollama/commit/5556b1088d3d4dfe712b949d471a672719d8e83a) logprob: add bytes to logprobs - [`902535e`](https://github.com/ollama/ollama/commit/902535ecc00535bf6c9d20667172fed7fbbed3ba) update tests - [`fde1741`](https://github.com/ollama/ollama/commit/fde17414aa94d31d1d81f319380b11ba6b4eec79) move logprobs to api layer - [`661e2ac`](https://github.com/ollama/ollama/commit/661e2acb721f78c26812abd06832f1a9ba03dc13) remove unused bytes param from server type ### 📊 Changes **4 files changed** (+312 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `api/types.go` (+3 -0) 📝 `integration/api_test.go` (+25 -0) 📝 `server/logprob.go` (+15 -0) 📝 `server/routes_generate_test.go` (+269 -0) </details> ### 📄 Description The raw bytes are provided by OpenAI when logprobs are requested. This is for helping disambiguate unicode and emoji boundaries when using custom sampling strategies. This PR adds bytes to both Ollama API and the OpenAI compatible endpoint ## Ollama API ``` "logprobs": { "content": [ { "token": "Hello", "logprob": -0.0005131333600729704, "bytes": [ 72, 101, 108, 108, 111 ], "top_logprobs": [ { "token": "Hello", "logprob": -0.0005131333600729704, "bytes": [ 72, 101, 108, 108, 111 ] }, ... ``` ## OpenAI compatibility ``` "logprobs": { "content": [ { "token": "Hello", "logprob": -0.0005131333600729704, "bytes": [ 72, 101, 108, 108, 111 ], "top_logprobs": [ { "token": "Hello", "logprob": -0.0005131333600729704, "bytes": [ 72, 101, 108, 108, 111 ] }, ... ``` --- <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-16 07:04:14 -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#19330