[PR #3911] [CLOSED] [Engine] qwen35: a penalty for a history token outside a --draft-vocab row no longer writes past the row #4829

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3911
Author: @xyehya
Created: 10/24/2026
Status: ❌ Closed

Base: main ← Head: pr/q36-07a-draft-vocab-oob


📝 Commits (1)

  • 7c4c7b7 [Engine] qwen35: a penalty for a history token outside a --draft-vocab row no longer writes past the row

📊 Changes

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

View changed files

📝 src/qwen35/q36_engine.cu (+1 -0)

📄 Description

Standalone fix, independent of the series (#3699 → #3903 → #3904 → #3905 → #3906 → #3907 → #3908 → #3909 → #3910); the same commit also opens #3908.

Branch pr/q36-07a-draft-vocab-oob: one commit on origin/main (the same fix is the first commit of the MTP-sampling PR in this series).

sample() applies the repeat / frequency / presence penalties to lg[id] for every token id in the last penalty_last_n tokens of the history. With --draft-vocab N the MTP drafts are sampled from a row of only the first N logits, so a history token with id >= N indexes past the end of the row: an out-of-bounds write (and a read) on the host, with a sampled request that has a penalty and a history token above N (origin/main, src/qwen35/q36_engine.cu, sample()). A token outside the row is not in it and takes no penalty; the fix skips it (one line: if (id < 0 || (size_t) id >= lg.size()) continue;). Rows of the full vocabulary are unaffected.

Validation: a standalone copy of origin/main's penalty loop (verbatim) on a 64-logit row with a history of {3, 100} and repeat_penalty 1.2 aborts under _GLIBCXX_ASSERTIONS (__n < this->size()); with the one-line guard it does not. q36_sampling_test (in the next PR of the series) has the case "draft-vocab row: penalties on its own ids only" under the same assertions. Not run: the real engine with a small --draft-vocab and a sampled request under a sanitizer; that the engine's --draft-vocab rows reach sample() is read from the code (sample(lg, ...) with the draft row). No timing: a one-line guard. One file, one line; no flag, no behaviour change for any request that did not index past the row.

🤖 Generated with Claude Code


🔄 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/3911 **Author:** [@xyehya](https://github.com/xyehya) **Created:** 10/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/q36-07a-draft-vocab-oob` --- ### 📝 Commits (1) - [`7c4c7b7`](https://github.com/Niko1221/Strata/commit/7c4c7b76ce606b81d472efc0b4a454e784e1e370) [Engine] qwen35: a penalty for a history token outside a --draft-vocab row no longer writes past the row ### 📊 Changes **1 file changed** (+1 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/qwen35/q36_engine.cu` (+1 -0) </details> ### 📄 Description Standalone fix, independent of the series (#3699 → #3903 → #3904 → #3905 → #3906 → #3907 → #3908 → #3909 → #3910); the same commit also opens #3908. Branch `pr/q36-07a-draft-vocab-oob`: one commit on `origin/main` (the same fix is the first commit of the MTP-sampling PR in this series). `sample()` applies the repeat / frequency / presence penalties to `lg[id]` for every token id in the last `penalty_last_n` tokens of the history. With `--draft-vocab N` the MTP drafts are sampled from a row of only the first N logits, so a history token with id >= N indexes past the end of the row: an out-of-bounds write (and a read) on the host, with a sampled request that has a penalty and a history token above N (`origin/main`, `src/qwen35/q36_engine.cu`, `sample()`). A token outside the row is not in it and takes no penalty; the fix skips it (one line: `if (id < 0 || (size_t) id >= lg.size()) continue;`). Rows of the full vocabulary are unaffected. Validation: a standalone copy of `origin/main`'s penalty loop (verbatim) on a 64-logit row with a history of {3, 100} and `repeat_penalty` 1.2 aborts under `_GLIBCXX_ASSERTIONS` (`__n < this->size()`); with the one-line guard it does not. `q36_sampling_test` (in the next PR of the series) has the case "draft-vocab row: penalties on its own ids only" under the same assertions. Not run: the real engine with a small `--draft-vocab` and a sampled request under a sanitizer; that the engine's `--draft-vocab` rows reach `sample()` is read from the code (`sample(lg, ...)` with the draft row). No timing: a one-line guard. One file, one line; no flag, no behaviour change for any request that did not index past the row. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:39:19 +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#4829
No description provided.