Skip to content

Adaptive tier: --adapt-decay outside (0, 1) is refused (inf counts, NaN swap gains) - #591

Closed
sergqwer wants to merge 1 commit into
Niko1221:mainfrom
sergqwer:pr/adapt-decay-range
Closed

sergqwer wants to merge 1 commit into
Niko1221:mainfrom
sergqwer:pr/adapt-decay-range

Conversation

@sergqwer

@sergqwer sergqwer commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

The range check from #407, alone on 0.1.38, as offered there. 0.1.38's --adapt-decay accepts any value.

What goes wrong at 1 or more. usage is multiplied by the decay after every adaptation, so with 1 or more the counts never shrink. At 2, an expert routed early in the conversation passes FLT_MAX after 128 adaptations, which is about 128 verify rounds with --adapt-every 1 or ~500 with the default 4. Then, in adapt:

  • cand[i].first < vict[i].first + 1.5f is false for inf against inf, so the pair is pushed with gain = inf - inf = NaN.
  • std::sort(swaps, gain > gain) then compares NaNs. That breaks the strict weak ordering std::sort requires, which is undefined behaviour.

Measured on v0.1.38 (RTX 5090, IQ2_XS, fixed --expert-cache 14900, a 1,000-token chat, --adapt-every 1, two runs each):

--adapt-decay rounds ms a round experts swapped hits
0.7 178 13.67 / 13.70 1,095 0.981
2 188 13.47 / 13.54 3,523 0.990

At 2 the tier swapped 3.2x as many experts. Nothing visible broke in a run this short (same output both times, no crash), so the case for refusing is the undefined sort, not a measured failure.

The change: the flag parse refuses values outside (0, 1) with "--adapt-decay must be between 0 and 1 (exclusive)" and exit code 2 (checked with 1.5). Values inside the range behave as before.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio

At 1 or more the usage counts never decay: they grow every adaptation, reach inf (2.0: after 128 adaptations) and
the swap gains become inf - inf = NaN, which the swap sort then compares.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio
txiki739 added a commit to txiki739/Strata3090-5060TI that referenced this pull request Oct 5, 2026
…iko1221#591: at 1 or more the counts grow without end)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
txiki739 added a commit to txiki739/Strata3090-5060TI that referenced this pull request Oct 5, 2026
txiki739 added a commit to txiki739/Strata3090-5060TI that referenced this pull request Oct 5, 2026
…of RAM

The 64 GB section now has the same measurements as the 128 GB ones (the engine limited to 60 GiB by a cgroup):
the decode per prompt and the prefill of both models with one and two GPUs, long prompts of 32K to 200K, and the
agent sessions. UD-IQ4_XS fits at the cap and loses 2-4% (81.5 / 104.7 tok/s); UD-Q4_K_XL reads its experts from
the NVMe (21.4 / 25.2 tok/s, varying a lot between sessions) and needs 44 min for a 200K prompt. The CPU-worker and
--adapt-decay charts are re-measured on the current engine (two runs per point; 1.0 is refused since PR Niko1221#591), and
the agent sessions with 128 GB updated (78.1 / 59.9 tok/s).
@sergqwer sergqwer closed this Oct 5, 2026
@sergqwer

sergqwer commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Reopened as #1047, the same branch and commit. GitHub closed this one when my fork was made private by mistake, which took it out of the fork network.

txiki739 added a commit to txiki739/Strata3090-5060TI that referenced this pull request Oct 12, 2026
…iko1221#591: at 1 or more the counts grow without end)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eddoursul pushed a commit to eddoursul/Lamina that referenced this pull request Oct 12, 2026
…iko1221#591: at 1 or more the counts grow without end)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant