mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1284] [CLOSED] [Engine] adaptive tier: --adapt-decay outside (0, 1) is refused (inf counts, NaN swap gains) #3358
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#3358
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/1284
Author: @sergqwer
Created: 10/7/2026
Status: ❌ Closed
Base:
main← Head:pr/adapt-decay-range📝 Commits (1)
7c2d432Adaptive tier: --adapt-decay outside (0, 1) is refused📊 Changes
1 file changed (+8 additions, -1 deletions)
View changed files
📝
src/program/generate.cpp(+8 -1)📄 Description
Problem and result
--adapt-decaytakes any number. The adaptive tier multiplies each expert'susageby the decay after every adaptation, so at 1 or more the counts never shrink. At 2, an expert routed early in the conversation passesFLT_MAXafter 128 adaptations (about 128 verify rounds with--adapt-every 1, ~500 with the default 4). Then, inadapt:cand[i].first < vict[i].first + 1.5fis false for inf against inf, so the pair is pushed withgain = inf - inf = NaN;std::sort(swaps, gain > gain)then compares NaNs. That breaks the strict weak orderingstd::sortrequires: undefined behaviour.Before:
strata --adapt-decay 1.5(or 2, 1, 0, -0.1, nan) starts and runs with it.After: the parse refuses a value outside (0, 1) with
--adapt-decay must be between 0 and 1 (exclusive)and exit code 2. Values inside the range behave as before.Related discussion
The range check offered in #407 and #591; the maintainer took
--adapt-decayitself into 0.1.38 without it. On this PR (2026-10-17): "This is a validation fix, not a speed change, so it is outside this pass; it is a small rebase if you want it in the fixes pass." It was #1284 before the 0.2.0-beta tracker reset; this is that rebase.Approach
A check in the flag parse of
src/program/generate.cpp(+8 / -1 lines), beside--adapt-min-gain.!(d > 0 && d < 1)also refuses a NaN. No default changes (the engine's own decay is inside the range).Validation
Revision: this branch, one commit
7c2d4321onmaine88ee39d(v0.2.0-beta + 12 commits), against a build ofmaine88ee39d. RTX 5090, Ryzen 9 9950X3D, 128 GB, Windows 11; MSVC 2022 17.14, CUDA 13.3, release configure (-DSTRATA_PORTABLE=ON,75-real;86-real;89-real;120-real, ggml at the pinned 3cf03257).Passed:
strata --adapt-decay V --no-such-flagon this branch: V = 1.5, 1, 2, 0, -0.1, nan ->--adapt-decay must be between 0 and 1 (exclusive), exit 2. V = 0.7, 0.999, 0.01 -> the parse goes on to the next argument (unknown argument: --no-such-flag). Onmain,--adapt-decay 1.5goes on to the next argument too.Maximilian228/Qwen3.8-Flash-Next-NVFP4-GPTQ-Strata, upstream setup's--family nvfp4 --model NVFP4files),strata --servewith setup's model files plus--expert-cache 3000 --prefill auto --spec 6 --spec-min-p 0.7 --max-context 262144 --kv int8 --gpu 0 --pcie-frac 0 --adapt-every 1000000, envSTRATA_PREFILL_CPU_SHARE=0 STRATA_PCIE_BALANCE=0 STRATA_IQ_MT_MIN=1 STRATA_DUMP_FIRST_LOGITS=<file>, a 2,100-token and a 32,037-token prompt, 32 greedy tokens each: first-token logits and tokens byte-identical tomain's (2K1e9c612c2e6c7a32..., 4 tokens; 32Kf5b2872c7ac30b17..., 20 tokens).Failed: none observed.
Not run:
generate.cpp; no ROCm or Mac here).sycl/src/program/generate.cppkeeps its own parse without the check.--expert-cache 14900, a 1,000-token chat,--adapt-every 1, two runs each): at 0.7, 178 rounds and 1,095 experts swapped; at 2, 188 rounds and 3,523 swapped (3.2x), with the same output and no crash. So the case for the check is the undefined sort, not an observed failure.Limits
strata_control/calibration.pyaccepts a stored--adapt-decayin 0..1 inclusive. A profile holding exactly 0 or 1 now stops the engine at start with the message above; the calibrator itself only writes 0.97.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.