mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #831] The profile's length caps the expert arena — even an explicit --expert-cache N #371
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#371
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 @ZhongUncle on GitHub (Oct 4, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/831
With
--expert-profile, the profile's length becomes the ceiling of the VRAM expert arena:autois capped at it, an explicit--expert-cache Nabove it is silently truncated to it (native pack), and the one path that keeps N slots (--expert-cache-per-layer) can never fill the ones past the profile. Measurements below. Is the profile's length meant to be the ceiling? Or should the profile seed the hot experts and the remaining slots fill on demand - which is what a user with a trace-built profile (make_profile.py --no-base) and a big card most likely expects?The three mechanisms:
--expert-cache autois capped atprofile.size()(src/program/generate.cpp:3222). Known and documented in tools/make_profile.py (issue #46 was fixed by shipping profiles that rank every pair) - fine.--expert-cache Nlarger than the profile is silently truncated to the profile's length on the native-pack path: the sized-slots loop only iterates the profile's pairs and rewriteso.expert_cache(src/program/generate.cpp:3299-3314). No warning is printed.--expert-cache-per-layerskips that clamp, so the arena keeps N slots - but the profile is the policy ("the decode-time admission finds no room and every non-profiled expert stays a CPU miss", generate.cpp:3451-3454), so the slots past the profile can never hold anything. The VRAM is allocated and permanently idle.And since
--serverequires the profile-filled tier (Verifier::init, src/core/verify.cpp:325 - the engine exits at startup without--expert-profile), the compulsory-miss fill the engine already implements for profile-less runs (generate.cpp:3445) is unreachable exactly where it would be useful: serving. This all seems adjacent to R4.1's open admission/eviction question (include/strata/core/expert_cache.hpp:107).Measured
RTX 3080 20 GB (driver 595.91.07, CUDA 13.2), Xeon E5-2680 v4, 62 GB RAM, Ubuntu 24.04.5, engine 0.1.39 built from source, Qwen3.8-Flash-Next GSQ-RCO IQ2_XS (48 x 512 = 24,576 pairs),
--max-context 262144 --kv int8 --kv-resident 32768 --spec 4 --prefill auto. Same model and flags throughout; only the profile and--expert-cachevary.A. Full profile (24,576 pairs),
--expert-cache auto- the shipped behavior, fine:B. Profile truncated to 3,000 pairs, explicit
--expert-cache 9813- asked for 9,813, got 3,000, no warning:C. Same profile,
--expert-cache-per-layer, explicit--expert-cache 8000- the arena keeps 8,000 slots (11.25 GiB), 3,000 are filled, the remaining 5,000 (~7 GiB) can never hold an expert:(The 3,000-of-8,000 residency was cross-checked with a local patch that reports
ExpertCache::resident()in the engine's INFO/DONE lines and the Monitor, where the "experts cached" figure currently reads the capacity instead. Happy to send that as a small PR if you want it.)Reproducing
Truncate any profile to its first 3,000 pairs (the format is make_profile.py's):
Then start the server with
--expert-profile data/expert-profile-3000.binand either--expert-cache 9813(case B) or--expert-cache 8000 --expert-cache-per-layer(case C), and read the startup log.What I'd suggest
--help/ docs/DETAILS.md, and warn when an explicit N is truncated (case B is silent today).--serve. I can measure the hit-rate difference (static profile vs profile-seeded hybrid) on the 3080 if that helps the R4.1 question.Drafted with AI assistance (Claude); every number above was measured on the machine listed, and every file:line reference was checked against the source at 0.1.39.
@Niko1221 commented on GitHub (Oct 6, 2026):
0.1.40 adds a warning when an explicit --expert-cache is above the profile's length (on a native pack the profile is the ceiling). A profile that ranks every (layer, expert) pair lifts it; whether the profile should only seed the hot experts is still open, so this stays open.
@Niko1221 commented on GitHub (Oct 7, 2026):
Thanks for the measurements. Since 0.1.40 an explicit --expert-cache N above the profile's length prints a warning that says so, instead of silently using fewer slots. On your design question: an explicit number stays an explicit number, and the warning is the recommendation. 0.1.40.2 also names an explicit --expert-cache in the low-free-VRAM line at start and suggests a smaller N or auto (see #781). Closing.