Repository navigation
Conversation
DeepSeek V4 Flash 0731 uses a pre-tokenizer regex shared by DeepSeek V3, Hunyuan Dense, and JoyAI presets. No custom path means falling through to std::regex. Long letter runs send libstdc++ into recursive backtracking. Large tool output can pile up tens of thousands of frames and blow a server thread's stack before inference gets a shot. Route this exact regex through a non-recursive scanner. Keep Unicode property handling and number groups from earlier passes intact. Check short inputs against std::regex, then hammer custom path with 128 KiB letter runs. DeepSeek V4 Flash 0731 produces identical 8,624 token IDs for a 17,368-byte corpus before and after this change. Patched 51,294-, 51,295-, and 131,072-byte runs finish without a crash. Signed-off-by: Lance Yang <lance.yang@linux.dev>
Author
|
Issue: #26965 |
|
Hi @ioworker0, thanks for your contribution! Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:
Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below. |
ioworker0
marked this pull request as ready for review
August 13, 2026 02:32
This branch has not been deployed
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.
Overview
DeepSeek V4 Flash 0731 shares a pre-tokenizer regex with the DeepSeek V3, Hunyuan Dense, and JoyAI presets. Without a custom implementation, it falls back to
std::regex.Long letter runs can trigger recursive backtracking in libstdc++, accumulating tens of thousands of stack frames and crashing a server thread before inference starts.
This change routes the exact regex through a non-recursive scanner while preserving Unicode property handling and number grouping from earlier passes.
Additional information
Validation performed:
std::regex.Requirements