mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #403] --resident-budget-gib: a budget clamped to available RAM then fails the safety check (0.1.31) #189
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#189
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?
Originally created by @brenoperucchi on GitHub (Oct 1, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/403
Version: 0.1.31 (tag
v0.1.31), Windows 11 26200, RTX 5090 32 GB, Ryzen 9 5950X, 64 GB DDR4 at the time.Model: Unsloth UD-Q4_K_XL, imported by hand following
docs/UNSLOTH_Q4.md, with"--resident-budget-gib", "40"in the config.What happens
The engine clamps the budget, fills it, and then refuses to start with the same number:
The docs say "On 64 GB, 40. The engine clamps a budget larger than the RAM it finds free", but with that setting the
engine did not start here. An explicit smaller budget (
26) works around it.Likely cause
I read
src/core/expert_source.cppbut did not step through it in a debugger.The budget branch (around line 1029) calls
available_memory_bytes(physical)once and clampsbudget_bytestoroom = physical - headroom. It then packs the ranked experts whileat <= budget_bytes, sobytescan end up equalto
roomor a few bytes under it. Right after that (around line 1069)available_memory_bytesis called again,and
bytes > physical - headroomis checked against the new reading. If available RAM drops by a few MB between thetwo calls (the engine's own allocations, the OS file cache, another process), a budget clamped to the limit fails.
Both log lines show 31.37 because the drop is smaller than the two-decimal rounding.
Some ways to fix it, whichever you prefer: reuse the first reading for the second check when a budget was given; clamp
the budget to
roomminus a small margin such as 256 MiB; or use the clamped value as the hard check's limit.Repro
We saw it once. It should happen whenever the budget gets clamped and available RAM shrinks even slightly before the
second check, so it may be intermittent.
Start of
strata-ud-q4_k_xl.logup to the failure@brenoperucchi commented on GitHub (Oct 1, 2026):
Still there in 0.1.32:
src/core/expert_source.cppdid not change betweenv0.1.31andv0.1.32.The new Unsloth setup flow makes it easier to run into. With
--family unsloth,resident_budget_gib()insetup.pyrounds the total physical RAM and subtracts 24, so a 64 GB PC gets
--resident-budget-gib 40. The engine checks thebudget against available RAM, which on this machine (64 GB at the time) was 31.37 GiB. A 40 GiB budget gets clamped
to that limit, and the clamped budget is what failed the second check in the log above. A 64 GB user who keeps the
setup default may see the same error at start.
@Niko1221 commented on GitHub (Oct 1, 2026):
Thanks, confirmed. The engine lowers the budget to the free RAM it reads first, then reads free RAM a second time for the safety check, and a few MB of difference between the two readings makes it fail. Being fixed for the next release: the check will use the same reading with a small margin, and if RAM is still short it will warn and read the rest of the experts through the file cache instead of stopping. Setup will also get a
--resident-budget-giboption. Keeping this open until the release.@pipeob0 commented on GitHub (Oct 1, 2026):
Same failure on a different model and quantization, on 64 GB of RAM. It looks less like a clamping bug and more like the available-RAM estimate depending on what the previous run left behind.
Machine: Ryzen 7 5700X3D, 64 GB DDR4-2666, RTX 5060 Ti 16 GB, Windows 11, engine 0.1.31 and 0.1.32. Model:
orcarouter/Qwen3.8-Flash-Next-Uncensored-GGUF(IQ4_XS), 60.94 GiB of routed experts, pack built from the three shards (native_experts.txtv4, 303 matrices served natively).--resident-budget-gib 40starts and fills:--resident-budget-gib 50refuses, and it refuses with the complement, not the budget:The same session had just completed a run at 40, so "50.70 GiB available" is not a property of the machine — it moves with what is still page-locked from the previous run. On this machine 40 is the usable ceiling and 50 is past it, and the number that gets printed as available is smaller than the 64 GB the machine has.
One more data point for whoever picks this up: on this machine the budget mode is not the fast path either.
experts.binin mmap 38.1 tok/s against 25.4 with--resident-budget-gib 40on the same file, and the two costs are in the log —adaptive tier 2688 experts swapped into the VRAM tier (every 4 rounds, 7.580 ms/round), and the CPU pool reading the page-locked complement at 15.5 GB/s against 27.4 GB/s from the OS page cache. Full table in #416.@Niko1221 commented on GitHub (Oct 1, 2026):
Fixed in 0.1.33: a clamped budget leaves 256 MiB of margin and the safety check uses the same RAM reading; a budget that can't be kept at all is a warning (the experts are read from the files). Setup takes
--resident-budget-gib N. Thanks!