[PR #1646] [CLOSED] fix(api): honor chat logit_bias on CUDA and HIP #3578

Closed
opened 2026-11-07 15:29:18 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1646
Author: @CC-David-CC
Created: 10/9/2026
Status: ❌ Closed

Base: main ← Head: fix/chat-logit-bias-1627


📝 Commits (2)

  • 5022b58 fix(api): apply request logit biases in CUDA and HIP sampling
  • 356aee0 docs: demonstrate Hello token bias with measured before and after requests

📊 Changes

39 files changed (+3376 additions, -10 deletions)

View changed files

📝 CMakeLists.txt (+3 -0)
📝 docs/DETAILS.md (+2 -0)
➕ docs/LOGIT_BIAS.md (+80 -0)
➕ docs/measurements/logit-bias-1627-20261008/README.md (+96 -0)
➕ docs/measurements/logit-bias-1627-20261008/cuda/build-state.json (+8 -0)
➕ docs/measurements/logit-bias-1627-20261008/cuda/parser.txt (+1 -0)
➕ docs/measurements/logit-bias-1627-20261008/cuda/python.txt (+354 -0)
➕ docs/measurements/logit-bias-1627-20261008/cuda/sampler.txt (+12 -0)
➕ docs/measurements/logit-bias-1627-20261008/english/complete.json (+6 -0)
➕ docs/measurements/logit-bias-1627-20261008/english/engine.txt (+40 -0)
➕ docs/measurements/logit-bias-1627-20261008/english/rows.json (+183 -0)
➕ docs/measurements/logit-bias-1627-20261008/hip-live/baseline.txt (+45 -0)
➕ docs/measurements/logit-bias-1627-20261008/hip-live/complete.json (+8 -0)
➕ docs/measurements/logit-bias-1627-20261008/hip-live/mtp.txt (+83 -0)
➕ docs/measurements/logit-bias-1627-20261008/hip-live/off.txt (+77 -0)
➕ docs/measurements/logit-bias-1627-20261008/hip-live/rows.json (+700 -0)
➕ docs/measurements/logit-bias-1627-20261008/hip/build-state.json (+8 -0)
➕ docs/measurements/logit-bias-1627-20261008/hip/live-state.json (+5 -0)
➕ docs/measurements/logit-bias-1627-20261008/hip/parser.txt (+1 -0)
➕ docs/measurements/logit-bias-1627-20261008/hip/python.txt (+360 -0)

...and 19 more files

📄 Description

Resolves #1627.

Chat requests accepted logit_bias without applying it. This patch applies per-request biases in CUDA/HIP target sampling, including greedy decoding and ordinary MTP.

Why Hello?

Hello is familiar, is one token (ID 9419) in the tested tokenizer, and is naturally emitted for this prompt. 9419 is a token ID, not a logit/probability; -100 is the requested bias and means exclusion here. Nothing is banned by default.

Same prompt: "Reply with one English greeting, one word only." Temperature 0, max_tokens 8, reasoning_effort "none". Only logit_bias changes:

Request value Measured output
Field omitted Hello (9419)
"logit_bias": {"9419": -100} Hi (12675)
"logit_bias": [[9419, false]] Hi (12675)
Field omitted again Hello (9419)

All four English checks passed on llm-60. Token IDs depend on the tokenizer; a token ban is not a universal word ban.

52 further HTTP checks passed across CUDA and HIP, including MTP, streaming and 103,215 bans. Both builds, 276 Python tests per backend, parser tests and three GPU sampler parity paths per GPU passed. Matched no-bias outputs agree with pristine main fb58e0db.

Invalid input fails before streaming. Older engines, SYCL and continuous batching reject nonempty biases. Multi-GPU and experimental coupled/probabilistic MTP were not validated. No throughput claim.

Full before/after requests and raw results


🔄 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/Niko1221/Strata/pull/1646 **Author:** [@CC-David-CC](https://github.com/CC-David-CC) **Created:** 10/9/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/chat-logit-bias-1627` --- ### 📝 Commits (2) - [`5022b58`](https://github.com/Niko1221/Strata/commit/5022b5801b8bc8a9ceb603b94bdb41a78f8021ea) fix(api): apply request logit biases in CUDA and HIP sampling - [`356aee0`](https://github.com/Niko1221/Strata/commit/356aee00c6bf98b58c11021dbcaa61ea07641ebf) docs: demonstrate Hello token bias with measured before and after requests ### 📊 Changes **39 files changed** (+3376 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+3 -0) 📝 `docs/DETAILS.md` (+2 -0) ➕ `docs/LOGIT_BIAS.md` (+80 -0) ➕ `docs/measurements/logit-bias-1627-20261008/README.md` (+96 -0) ➕ `docs/measurements/logit-bias-1627-20261008/cuda/build-state.json` (+8 -0) ➕ `docs/measurements/logit-bias-1627-20261008/cuda/parser.txt` (+1 -0) ➕ `docs/measurements/logit-bias-1627-20261008/cuda/python.txt` (+354 -0) ➕ `docs/measurements/logit-bias-1627-20261008/cuda/sampler.txt` (+12 -0) ➕ `docs/measurements/logit-bias-1627-20261008/english/complete.json` (+6 -0) ➕ `docs/measurements/logit-bias-1627-20261008/english/engine.txt` (+40 -0) ➕ `docs/measurements/logit-bias-1627-20261008/english/rows.json` (+183 -0) ➕ `docs/measurements/logit-bias-1627-20261008/hip-live/baseline.txt` (+45 -0) ➕ `docs/measurements/logit-bias-1627-20261008/hip-live/complete.json` (+8 -0) ➕ `docs/measurements/logit-bias-1627-20261008/hip-live/mtp.txt` (+83 -0) ➕ `docs/measurements/logit-bias-1627-20261008/hip-live/off.txt` (+77 -0) ➕ `docs/measurements/logit-bias-1627-20261008/hip-live/rows.json` (+700 -0) ➕ `docs/measurements/logit-bias-1627-20261008/hip/build-state.json` (+8 -0) ➕ `docs/measurements/logit-bias-1627-20261008/hip/live-state.json` (+5 -0) ➕ `docs/measurements/logit-bias-1627-20261008/hip/parser.txt` (+1 -0) ➕ `docs/measurements/logit-bias-1627-20261008/hip/python.txt` (+360 -0) _...and 19 more files_ </details> ### 📄 Description Resolves #1627. Chat requests accepted logit_bias without applying it. This patch applies per-request biases in CUDA/HIP target sampling, including greedy decoding and ordinary MTP. ### Why Hello? Hello is familiar, is one token (ID 9419) in the tested tokenizer, and is naturally emitted for this prompt. 9419 is a token ID, not a logit/probability; -100 is the requested bias and means exclusion here. Nothing is banned by default. Same prompt: "Reply with one English greeting, one word only." Temperature 0, max_tokens 8, reasoning_effort "none". Only logit_bias changes: | Request value | Measured output | |---|---| | Field omitted | Hello (9419) | | `"logit_bias": {"9419": -100}` | Hi (12675) | | `"logit_bias": [[9419, false]]` | Hi (12675) | | Field omitted again | Hello (9419) | All four English checks passed on llm-60. Token IDs depend on the tokenizer; a token ban is not a universal word ban. 52 further HTTP checks passed across CUDA and HIP, including MTP, streaming and 103,215 bans. Both builds, 276 Python tests per backend, parser tests and three GPU sampler parity paths per GPU passed. Matched no-bias outputs agree with pristine main fb58e0db. Invalid input fails before streaming. Older engines, SYCL and continuous batching reject nonempty biases. Multi-GPU and experimental coupled/probabilistic MTP were not validated. No throughput claim. [Full before/after requests and raw results](https://github.com/CC-David-CC/Strata-a5500/blob/fix/chat-logit-bias-1627/docs/LOGIT_BIAS.md) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:29:18 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3578
No description provided.