[GH-ISSUE #5020] [Engine] Arena mode keeps all 24,576 experts in RAM on top of the VRAM expert cache (44.9 GiB of the 71.7 GiB host copy is never read again) #2322

Open
opened 2026-11-04 01:58:25 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @radiumliu on GitHub (Nov 2, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5020

Area

[Engine]

What do you want to do?

Keep the host copy of the experts the GPU cache already holds out of RAM in arena mode, instead of pinning all 24,576 of them. On this box that is 44.86 GiB that is copied into VRAM once and never read again — and it is what pushes a 125.7 GiB machine to 122 GiB and into OOM.

What do you do today instead?

Run the default arena (--expert-cache auto, no --mmap-experts) and keep 20+ GiB of free RAM by hand: reclaim the GGUF page cache with memory.reclaim, raise the systemd-oomd threshold, and add swap. The only documented ways to stop the duplication are the low-RAM modes, which mean leaving the arena for --mmap-experts — reasonable for a 32–64 GB PC, but they are described as a mode for PCs that cannot hold the experts at all, not for a 128 GB box that can hold them and then has nothing left for the rest of the system.

Environment

  • Engine: 0.1.55 (f-029-rel 99866a47a2b8, cuda12.9 build), installed by the Terminal
  • OS / kernel: Ubuntu 24.04, kernel 6.8.0-117-generic, systemd 255
  • Hardware: 2× Tesla V100-SXM2-32GB (sm_70), PCIe 3.0 x8 per card (6.7 GB/s host→device measured), Ryzen 5 5600 (6 cores, no AVX-512), 125.7 GiB DDR4-3000, 64 GiB swap
  • Model: Qwen3.8-Flash-Next UD-Q4_K_XL (Unsloth, 4 shards, 103.69 GiB), native pack (unsloth-ud-q4_k_xl, experts read in place from the GGUF shards)
  • Flags: --expert-cache auto --prefill auto --spec 4 --spec-min-p 0.5 --mtp … --max-context 262144 --kv int8 --ple-io ram --kv-resident 32768 --vision --vram-reserve-mib 700 --layer-split auto
  • Steady state while serving: --layer-split auto puts layers 0–22 on CUDA0 and 23–47 + head on CUDA1; expert cache 15,361 slots = 44.86 GiB of VRAM (21.97 + 22.89), 731/182 MiB free per card

The duplication, measured

The pack itself states the full expert table size in the header of native_experts.txt:

# strata native experts v4: … (n_expert 512, total 77017907200; absolute offsets in …-00002-of-00004.gguf …)

77,017,907,200 B = 71.732 GiB = 48 layers × 512 experts = 24,576 blobs.

/proc/<engine-pid>/smaps, aggregated by mapping, shows one anonymous region of exactly that size, fully resident:

RSS            mapping
71.732 GiB     [anon]     <- the expert arena: all 24,576 experts
 8.554 GiB     [heap]
 5.685 GiB     ...-00002-of-00004.gguf   (PLE table, mmap)
 2.994 GiB     /dev/zero (deleted)       (parked conversations)

So the host side holds all 24,576, while the GPU side holds 15,361 of those same blobs as a copy. 15,361/24,576 = 62.5 % of the arena is duplicated in VRAM, and the engine's own cache policy is static and has no eviction (expert cache … ranked by routing frequency, no eviction), so those 44.86 GiB of host bytes are never read after the cache is filled. What the CPU expert pool actually serves is the remaining 9,215 experts = 26.9 GiB.

What it costs in practice

Item Value
Engine anon (arena + heap + conversations) 81.4 GiB
Engine cgroup, steady 111.6 GiB
Whole user session (engine + 5 small services) 122.1 GiB of 125.7 GiB
Free RAM while serving 0.8–1.4 GiB

At midnight the box was killed three times in 90 minutes, and not by the kernel OOM killer: systemd-oomd killed the whole user@1000 slice (engine, web UI, gateway and three more services in the same 0.13 s) because the session's PSI stayed above Ubuntu's 50 % limit with reclaim activity. The kernel log has no Killed process line at all. The engine's own PSI was 0.00 during the event — it was the other tasks on the box that were stalled on memory.

With ~45 GiB less pinned anon, this box would have had ~45 GiB of headroom and none of that would have happened. Note also that VmLck for the engine is 0 and system Mlocked is 80 kB, so the arena is not mlock'd here (cudaHostRegister PORTABLE ok covers the transfer/KV path only) — it is ordinary anonymous memory, which is why enlarging swap helps a little, but the copy still should not exist.

The ask

Any one of these would close it:

  1. In arena mode, keep only the experts the GPU cache does not hold resident (pin or just keep them; leave the VRAM-resident ones as reclaimable page cache). This is what --resident-cpu-experts describes for the mmap mode — it just is not reachable while the arena is in use.
  2. If --resident-experts / --resident-cpu-experts is the intended answer for a two-GPU layer split with a native pack, say so in docs/DETAILS.md: today the doc places both under "Low-RAM modes (chosen by setup)" / "when the RAM cannot hold them beside the system", which reads as "not for a 128 GB box".
  3. Failing either, a knob that makes the arena hold a ranked subset below the VRAM cache size (--resident-budget-gib equivalent for the arena), so the budget maths can close.

STRATA_ARENA_MMAP=1 is not it here: the release note for 0.1.39 measures it well (2×16 GB GPUs, 32 GB RAM, ~1 → 25 GB available), but it maps experts.bin, and this native pack has no experts.bin (it carries dense.bin, index.txt, native_experts.txt and points into the GGUF shards). If it works against the shards too, a line in the docs would say so.

  • #3734 — "In-place GGUF expert pages stay GPU-pinned on top of the resident pool (~2x expert RAM)" — the same class of duplication in the mapped mode on an AMD box. It was auto-closed after 5 days for a missing [Engine] prefix, not by a maintainer, so the ask was never answered.

Evidence available

Happy to attach: the full 6-hour audit series (30 s cadence: meminfo, engine smaps aggregate, cgroup memory.stat/memory.current, /proc/pressure/memory, oomd's own log for the three kills), the engine startup log with every sizing line (arena, layer split, cache slots, PCIe probe), and the before/after numbers for a manual memory.reclaim that released 24.2 GiB of GGUF page cache with no change in decode throughput (mean 69.5 vs 69.8 tok/s over the 8 requests immediately before and after).

Originally created by @radiumliu on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/5020 ### Area [Engine] ### What do you want to do? Keep the **host copy of the experts the GPU cache already holds** out of RAM in arena mode, instead of pinning all 24,576 of them. On this box that is 44.86 GiB that is copied into VRAM once and never read again — and it is what pushes a 125.7 GiB machine to 122 GiB and into OOM. ### What do you do today instead? Run the default arena (`--expert-cache auto`, no `--mmap-experts`) and keep 20+ GiB of free RAM by hand: reclaim the GGUF page cache with `memory.reclaim`, raise the systemd-oomd threshold, and add swap. The only documented ways to stop the duplication are the low-RAM modes, which mean leaving the arena for `--mmap-experts` — reasonable for a 32–64 GB PC, but they are described as a mode for PCs that cannot hold the experts at all, not for a 128 GB box that can hold them and then has nothing left for the rest of the system. ### Environment - **Engine:** `0.1.55` (`f-029-rel 99866a47a2b8`, cuda12.9 build), installed by the Terminal - **OS / kernel:** Ubuntu 24.04, kernel `6.8.0-117-generic`, systemd 255 - **Hardware:** 2× Tesla V100-SXM2-32GB (sm_70), **PCIe 3.0 x8** per card (6.7 GB/s host→device measured), Ryzen 5 5600 (6 cores, **no AVX-512**), 125.7 GiB DDR4-3000, 64 GiB swap - **Model:** `Qwen3.8-Flash-Next` **UD-Q4_K_XL** (Unsloth, 4 shards, 103.69 GiB), native pack (`unsloth-ud-q4_k_xl`, experts read in place from the GGUF shards) - **Flags:** `--expert-cache auto --prefill auto --spec 4 --spec-min-p 0.5 --mtp … --max-context 262144 --kv int8 --ple-io ram --kv-resident 32768 --vision --vram-reserve-mib 700 --layer-split auto` - **Steady state while serving:** `--layer-split auto` puts layers 0–22 on CUDA0 and 23–47 + head on CUDA1; expert cache **15,361 slots = 44.86 GiB of VRAM** (21.97 + 22.89), 731/182 MiB free per card ### The duplication, measured The pack itself states the full expert table size in the header of `native_experts.txt`: ``` # strata native experts v4: … (n_expert 512, total 77017907200; absolute offsets in …-00002-of-00004.gguf …) ``` 77,017,907,200 B = **71.732 GiB** = 48 layers × 512 experts = 24,576 blobs. `/proc/<engine-pid>/smaps`, aggregated by mapping, shows one anonymous region of exactly that size, fully resident: ``` RSS mapping 71.732 GiB [anon] <- the expert arena: all 24,576 experts 8.554 GiB [heap] 5.685 GiB ...-00002-of-00004.gguf (PLE table, mmap) 2.994 GiB /dev/zero (deleted) (parked conversations) ``` So the host side holds all 24,576, while the GPU side holds 15,361 of those same blobs as a copy. 15,361/24,576 = **62.5 % of the arena is duplicated in VRAM**, and the engine's own cache policy is static and has no eviction (`expert cache … ranked by routing frequency, no eviction`), so those 44.86 GiB of host bytes are never read after the cache is filled. What the CPU expert pool actually serves is the remaining **9,215 experts = 26.9 GiB**. ### What it costs in practice | Item | Value | | --- | --- | | Engine anon (arena + heap + conversations) | 81.4 GiB | | Engine cgroup, steady | 111.6 GiB | | Whole user session (engine + 5 small services) | 122.1 GiB of 125.7 GiB | | Free RAM while serving | 0.8–1.4 GiB | At midnight the box was killed **three times in 90 minutes**, and not by the kernel OOM killer: `systemd-oomd` killed the whole `user@1000` slice (engine, web UI, gateway and three more services in the same 0.13 s) because the session's PSI stayed above Ubuntu's 50 % limit with reclaim activity. The kernel log has no `Killed process` line at all. The engine's own PSI was 0.00 during the event — it was the *other* tasks on the box that were stalled on memory. With ~45 GiB less pinned anon, this box would have had ~45 GiB of headroom and none of that would have happened. Note also that `VmLck` for the engine is **0** and system `Mlocked` is 80 kB, so the arena is not mlock'd here (`cudaHostRegister PORTABLE ok` covers the transfer/KV path only) — it is ordinary anonymous memory, which is why enlarging swap helps a little, but the copy still should not exist. ### The ask Any one of these would close it: 1. **In arena mode, keep only the experts the GPU cache does not hold resident** (pin or just keep them; leave the VRAM-resident ones as reclaimable page cache). This is what `--resident-cpu-experts` describes for the mmap mode — it just is not reachable while the arena is in use. 2. If `--resident-experts` / `--resident-cpu-experts` **is** the intended answer for a two-GPU layer split with a native pack, say so in `docs/DETAILS.md`: today the doc places both under "Low-RAM modes (chosen by setup)" / "when the RAM cannot hold them beside the system", which reads as "not for a 128 GB box". 3. Failing either, a knob that makes the arena hold a ranked subset below the VRAM cache size (`--resident-budget-gib` equivalent for the arena), so the budget maths can close. `STRATA_ARENA_MMAP=1` is not it here: the release note for 0.1.39 measures it well (2×16 GB GPUs, 32 GB RAM, ~1 → 25 GB available), but it maps `experts.bin`, and this native pack has no `experts.bin` (it carries `dense.bin`, `index.txt`, `native_experts.txt` and points into the GGUF shards). If it works against the shards too, a line in the docs would say so. ### Related - **#3734** — "In-place GGUF expert pages stay GPU-pinned on top of the resident pool (~2x expert RAM)" — the same class of duplication in the *mapped* mode on an AMD box. It was auto-closed after 5 days for a missing `[Engine]` prefix, not by a maintainer, so the ask was never answered. ### Evidence available Happy to attach: the full 6-hour audit series (30 s cadence: meminfo, engine `smaps` aggregate, cgroup `memory.stat`/`memory.current`, `/proc/pressure/memory`, oomd's own log for the three kills), the engine startup log with every sizing line (arena, layer split, cache slots, PCIe probe), and the before/after numbers for a manual `memory.reclaim` that released 24.2 GiB of GGUF page cache with no change in decode throughput (mean 69.5 vs 69.8 tok/s over the 8 requests immediately before and after).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2322
No description provided.