Repository navigation
fix: scope reasoning user stops to answer content - #42
Merged
agiping merged 1 commit intoSep 30, 2026
Conversation
Limit this change to non-speculative decoding; speculative compatibility is intentionally out of scope. Document that boundary in the scheduler and regression tests. Use the existing reasoning token count to restrict user stop strings, regexes, token IDs and streaming prefix holdback to content. Keep system EOS and length limits effective during thinking. Preserve the thinking prefix when trimming the first stop match in content, including repeated matches inside a single decoded token. Reuse the existing trim interface and IPC fields. Do not include the reasoning-to-content fallback proposed in sgl-project#33154. Adapted from sgl-project#33152 (eb800ddcd97fb7a27886580941b607017770da93), with the trimming defect described in sgl-project#33151 (efb505ebce378db6b55336f4917be83f68049628) addressed without a global find-to-rfind substitution. Validation: 137 CPU tests and 53 subtests passed; 2 opt-in microbenchmarks skipped. Excluded one existing logprob fixture failure reproduced on base 32a0406. New non-speculative regressions fail on that base. Ruff/isort and diff checks pass. Full manager collection needs the missing mlx dependency; no real-model/GPU validation.
agiping
merged commit Sep 30, 2026
29e482e
into
Infrawaves:decode-scheduler-loop-reduce-itl-max-tool-validation
77 of 87 checks passed
Zhangmj0621
pushed a commit
that referenced
this pull request
Oct 8, 2026
Limit this change to non-speculative decoding; speculative compatibility is intentionally out of scope. Document that boundary in the scheduler and regression tests. Use the existing reasoning token count to restrict user stop strings, regexes, token IDs and streaming prefix holdback to content. Keep system EOS and length limits effective during thinking. Preserve the thinking prefix when trimming the first stop match in content, including repeated matches inside a single decoded token. Reuse the existing trim interface and IPC fields. Do not include the reasoning-to-content fallback proposed in sgl-project#33154. Adapted from sgl-project#33152 (eb800ddcd97fb7a27886580941b607017770da93), with the trimming defect described in sgl-project#33151 (efb505ebce378db6b55336f4917be83f68049628) addressed without a global find-to-rfind substitution. Validation: 137 CPU tests and 53 subtests passed; 2 opt-in microbenchmarks skipped. Excluded one existing logprob fixture failure reproduced on base 32a0406. New non-speculative regressions fail on that base. Ruff/isort and diff checks pass. Full manager collection needs the missing mlx dependency; no real-model/GPU validation.
luke396
added a commit
that referenced
this pull request
Oct 12, 2026
Restore #42's require_reasoning stop gating at its four sites. Instead, end the reasoning phase once in _maybe_update_reasoning_tokens when no usable terminator exists, so user stops keep their legacy behavior. _is_reasoning_over is read only by the stop logic, and all callers set it before the first stop check. Drop the empty-encoding filter for channel openers; K3's openers never encode to an empty sequence. Behavior is unchanged: 131 focused tests + 81 subtests pass, and the expanded suite has the same failure set as before. Without the processor line, the 4 missing-terminator subtests fail again.
luke396
added a commit
that referenced
this pull request
Oct 12, 2026
Restore the matcher-based gating from 79df065 and drop the processor-side fallback added in a54fd39. Some commit paths never run reasoning tracking: the dLLM result path calls update_finish_state without _maybe_update_reasoning_tokens. On those paths, require_reasoning gating ignored user stops for the whole generation. This was introduced by #42 and restored by a54fd39. Without a matcher, the request now keeps legacy stop behavior on every caller. Add a regression test that commits tokens without reasoning tracking. It fails on the base and on a54fd39, and passes here. Focused suite: 132 tests and 83 subtests pass. The expanded suite failure set is unchanged.
luke396
added a commit
that referenced
this pull request
Oct 12, 2026
#42 gated user stops on require_reasoning. When a request asks for reasoning but never gets a reasoning boundary matcher, stops stayed ignored for the whole generation. This happens when there is no reasoning parser, the terminator cannot be encoded, tokenizer init is skipped, or the commit path never runs reasoning tracking (the dLLM result path calls update_finish_state without _maybe_update_reasoning_tokens). Gate reasoning-aware stops on the request's think-end matcher instead. The result processor creates it only for a usable terminator. Without one, string, regex and token-ID stops keep their legacy behavior on every caller. With one, user stops are still ignored until reasoning ends. require_reasoning itself is unchanged. Regressions: 4 missing-terminator subtests (parser absent, tokenizer skipped) and 2 untracked-commit subtests fail on the base and pass here. Non-speculative scope, as in #42.
Nozom1ff
pushed a commit
that referenced
this pull request
Oct 29, 2026
Limit this change to non-speculative decoding; speculative compatibility is intentionally out of scope. Document that boundary in the scheduler and regression tests. Use the existing reasoning token count to restrict user stop strings, regexes, token IDs and streaming prefix holdback to content. Keep system EOS and length limits effective during thinking. Preserve the thinking prefix when trimming the first stop match in content, including repeated matches inside a single decoded token. Reuse the existing trim interface and IPC fields. Do not include the reasoning-to-content fallback proposed in sgl-project#33154. Adapted from sgl-project#33152 (eb800ddcd97fb7a27886580941b607017770da93), with the trimming defect described in sgl-project#33151 (efb505ebce378db6b55336f4917be83f68049628) addressed without a global find-to-rfind substitution. Validation: 137 CPU tests and 53 subtests passed; 2 opt-in microbenchmarks skipped. Excluded one existing logprob fixture failure reproduced on base 32a0406. New non-speculative regressions fail on that base. Ruff/isort and diff checks pass. Full manager collection needs the missing mlx dependency; no real-model/GPU validation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
f335fea8fbonto5fcaf71773as110202dea5: identical patch, one commit, three files.eb800ddcd97fb7a27886580941b607017770da93); address the trimming defect in #33151 (efb505ebce378db6b55336f4917be83f68049628) without a globalfind→rfindchange. Exclude #33154's reasoning-to-content fallback.Evidence
Before:
TestReasoningStopfails against the unfixed new base. Restoring only the old detokenizer while retaining the scheduler fix reproduces 36 failing subtests.After: the focused stop/Kimi suite passes: 83 tests + 53 subtests. Coverage includes streaming/non-streaming string stops, immediate stops, split/repeated matches and decoder modes; scheduler-level checks cover regex/token stops, EOS and length limits.
Identical expanded suite on both revisions, including manager tests and the new base's changed tool-validation/preprocessing/disaggregation tests:
5fcaf71773110202dea5Failure/error identities match; no additional failures. Existing failures include incomplete fixtures and macOS lacking Linux facilities (
lscpu,/dev/shm); they are not changed here.Ruff, formatting, isort,
git diff --check, patch-ID and range-diff checks pass.Merge Danger
Door: Two-way — revert the single commit; no state/schema migration.
Blast Radius: Generation
The shared scheduler and Python detokenizer paths affect reasoning-enabled requests, not only Kimi K3. Non-reasoning behavior and existing EOS/length checks are preserved. Reasoning-aware stop handling is scoped to non-speculative decoding only; speculative compatibility is intentionally out of scope, with no new disabling switch. Validation is CPU-based with a fake tokenizer and real request/accumulator/detokenizer/Kimi parser code; no real-model, GPU or live API validation has been performed.
CI States
Latest PR Test (Base): ❌ Run #36680717107
Latest PR Test (Extra): ❌ Run #36680717002
Latest PR Test (AMD ROCm 10): ➖ No AMD PR run found for this commit.