mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
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#3742
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/1892
Author: @lask3802
Created: 10/10/2026
Status: ❌ Closed
Base:
main← Head:nan-guard📝 Commits (1)
18df5caNon-finite logits (#879): a guard with self-healing📊 Changes
13 files changed (+536 additions, -13 deletions)
View changed files
📝
docs/DETAILS.md(+26 -0)📝
include/strata/core/conversation_cache.hpp(+10 -0)📝
include/strata/core/verify.hpp(+20 -0)📝
include/strata/kernels/verify_kernels.hpp(+5 -0)📝
serve/replicas.py(+8 -2)📝
serve/server.py(+58 -0)📝
serve/test_parallel.py(+50 -0)📝
serve/test_replicas.py(+23 -0)📝
serve/test_server.py(+125 -1)📝
src/core/conversation_cache_test.cpp(+11 -0)📝
src/core/verify.cpp(+61 -1)📝
src/kernels/cuda/verify_kernels.cu(+23 -0)📝
src/program/generate.cpp(+116 -9)📄 Description
Refs #879, #606.
What it changes
Rarely a window's logits become NaN and the reply degenerates into token 0 (
!) repeated. The poison sits in theconversation's K/V and recurrent state, so with the prompt cache every later turn of that conversation stays poisoned
until it is read again from token 0. The q8_1 clamps of 0.1.39 and later removed the overflows found so far; reports
on 0.1.41 (#879) show that some cause is left. This PR does not look for that cause. It stops serving the poison:
--servechecks its head logits on the GPU beside the greedy pick: one small kernel writes aflag per slice of each row into mapped memory, and the host reads the flags after the sync the window already does.
No extra sync.
non-finite logits (#879)line with the positionand ends the request with
DONE ... nonfinite(a batch slot:BDONE <slot> <n> nonfinite).slot, and reads its prompt from token 0. A slot still running finishes its reply and is not kept after it.
"length"(asrepeat_stop_tokensdoes); a second fire on the retry is an error (503 before an answer, an errorevent in a stream). With replicas, the router forgets what that replica held.
STRATA_NAN_INJECT=<n>[,<n>...](debug) reports the n-th checked window as non-finite, to exercise the path.On by default, as a fix;
STRATA_NAN_GUARD=0turns it off (no kernel is recorded).Covered: the serial decode loop (one GPU or a layer split), the
--pipeline-windowsdecode loop of a layer split, theprompt's short tail (
read_windows,read_windows_pl), and both batch-slot loops.What it leaves alone
stratawithout--serve) and the SYCL port insycl/(it has its own verify path)do not check.
repeat_stop_tokensstays as the backstop.Measured
RTX 3080 (PCIe 4.0 x8), Linux, RVN IQ3_S with the usual one-GPU config (
--expert-cache auto --prefill auto --spec 4 --mtp ... --conversation-cache-mib 8192), this branch's build.STRATA_NAN_GUARD=0, at fixed expert sets (--pcie-frac 0 --adapt-every 0 --adapt-swaps 0 --mtp-max-t 1 --suffix-draft 0,STRATA_IQ_MT_MIN=1 STRATA_PREFILL_CPU_SHARE=0), a chat replay of 2 x 4 turns on a16K-token system prompt: byte-identical in 3 pairs (one with
STRATA_ROUTE_TAIL_SKIP=0, one withSTRATA_SH_STREAM=0); two guard-on runs 8 of 8. One more guard-off run differed from every other run from its firstanswer on, and a second guard-off run matched the guard-on runs, so that was a difference between runs of this
config, not the guard. (Also 8 of 8 on an older base,
fb58e0dplus the remote-stage PRs.)logits_nonfinite_kernel424 launches, 4.77 us on average(7.78 us at most), 2.0 ms against 21.6 s of decode: 0.009%. A decode rate A/B (40 prompts x 200 tokens,
on/off/off/on: 40.78 / 40.94 / 40.86 / 40.45 tok/s, on the older base) cannot resolve a difference that small.
STRATA_NAN_INJECT=1,60: a new chat's first window flagged -> the server sent the request again from token 0and the client saw one normal answer; the 60th window, mid-reply in the next turn -> that reply ended as
"length"after 58 tokens; the turn after it reused 0 cached tokens and answered normally. The engine logged exactly the two
injected windows.
A real fire was not seen in these runs. On a two-PC remote-stage build (#1748 + #1887) the guard stayed silent through
163 requests of the load that had poisoned about 4 in 10 before that build's own fix, so the guard is the backstop,
not the fix, there.
Builds and tests
NonFiniteLogits,test_nonfinite_in_batch_mode,test_nonfinite_forgets_the_replicaare new); ctest without a GPU: 24 pass(
conversation_cache_testwith the newclear()among them), the GPU parity tests not run.conversation_cache_testandconv_cache_testpass.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.