mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #869] [CLOSED] serve: opt-in recovery from repeated reasoning passages #2886
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2886
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/869
Author: @huangserva
Created: 10/5/2026
Status: ❌ Closed
Base:
main← Head:serve-reasoning-loop-recovery📝 Commits (1)
ae679daserve: opt-in recovery from repeated reasoning passages📊 Changes
3 files changed (+259 additions, -2 deletions)
View changed files
📝
docs/DETAILS.md(+13 -0)📝
serve/server.py(+81 -2)➕
serve/test_reasoning_loop_recovery.py(+165 -0)📄 Description
A high-effort IQ3_S request can repeat whole reasoning passages until
max_tokensis exhausted and return no final answer. The 0.1.39 guard from #606 ends runs of one identical token; it does not detect a repeated sentence or a repeated code-verification pass. This draft adds an opt-in, one-shot recovery policy for those passages. It does not claim to fix numerical corruption or replace #838.Set
"reasoning_loop_recovery": truein the model config (default: false). At clean parser and UTF-8 boundaries every 512 output tokens, the server checks whether at least 25% of the most recent 2,000 word/punctuation units belongs to 12-unit passages seen at least three times in the reasoning history. It stops and drains the current generation and resumes with every generated token ID preserved. Only the native high-effort hint in the initial system message changes to the template's low-effort hint. No final answer, synthetic reasoning, or</think>is inserted; both passes share the original completion limit.On recovery only, temperature is raised to at least 1.0 and presence penalty to at least 1.5, with top-p 0.95/top-k 20 and the same seed. This deliberately overrides an explicit low-entropy client sampler and is documented as opt-in. An already-matching sampler is passed through unchanged. History and request traces record recovery count and repetition coverage. The 0.1.39 single-token guard stays enabled.
Validation:
python -m unittest discover -s serve -p 'test_*.py'on base6f32ec070f23ced9f50e704d854d775da52591ab: 281 tests run, 274 passed, 7 skipped (no GPU/model fixtures). The optional jsonschema package was installed for schema-validation tests. Includes 13 new recovery tests.3cf03257f219afbe7334045ff7c6a06ac68c627d: the captured original IQ3_S failure prefix produced 1,487 consecutive repeated passages, reached the 16,384-token cap, and never closed thinking or delivered a final answer. This is a multi-token loop, so the server's 256-identical-token guard does not match it. Recovery enabled on that same loaded engine, input, seed and cap detected coverage 1.0 at 2,048 generated tokens, recovered once, and finished naturally withstopat 9,629 total completion tokens, with a nonempty final answer (SHA-2565a35536b34032fce0094f6453067efb6952f2ae15a6620cbc59f863c5f188cad). The repeated prefix is retained, including 187 phrase repetitions generated before recovery. This is one diagnostic replay, not a new full-quality benchmark on 0.1.39.STRATA_NO_LARGEPAGES=1was used in both arms, after the default large-page startup was manually aborted before READY due to slow allocation. This switch changes page backing, not model arithmetic. No engine source was modified.stop/nonempty final answer at 6,655 completion tokens with one recovery. A frozen 31-request cohort then returned 31 complete final answers. Protocol, limitations and public answers.Limits: this is a heuristic policy and may trigger on useful repeated code/checks. It supports the exact native high-effort hint in the first system message, skips images, and can require re-prefilling the modified prompt. Other templates/effort positions are not validated. A resumed model can still loop or reach the shared output limit. The 31-request cohort was run on 0.1.38; the 0.1.39 GPU check above is one diagnostic pair, not evidence that every 0.1.39 request completes. The draft is open for feedback on the opt-in API, threshold, and sampler policy before broader use.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.