[PR #5017] [GUI] Monitor: show memory and expert placement, sampling, KV format and VRAM use; clear the recent requests #5286

Open
opened 2026-11-07 16:34:04 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/5017
Author: @elricdog
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: main


📝 Commits (1)

  • 4619a07 [GUI] Add Monitor insights and request clearing

📊 Changes

20 files changed (+1833 additions, -12 deletions)

View changed files

➕ SMI2000-Changes.md (+1155 -0)
📝 apps/host/server/index.mjs (+3 -0)
📝 apps/host/server/monitor-dashboard.mjs (+1 -1)
📝 apps/host/server/native-control.mjs (+3 -1)
➕ apps/host/src/components/SmiMemoryPanel.tsx (+43 -0)
➕ apps/host/src/components/SmiMonitorExtras.tsx (+82 -0)
📝 apps/host/src/components/SnapshotDialog.tsx (+13 -1)
📝 apps/host/src/lib/i18n.ts (+5 -2)
📝 apps/host/src/lib/native-monitor.ts (+1 -1)
➕ apps/host/src/lib/smi-expert-tiers.ts (+82 -0)
📝 apps/host/src/lib/types.ts (+4 -1)
➕ apps/host/src/locales/smi-en.json (+51 -0)
➕ apps/host/src/locales/smi-es.json (+51 -0)
📝 apps/host/src/main.tsx (+1 -0)
📝 apps/host/src/screens/Monitor.tsx (+7 -3)
➕ apps/host/src/styles/smi-monitor.css (+59 -0)
📝 apps/host/tests/locale-gaps.test.mjs (+1 -1)
➕ apps/host/tests/smi-monitor.test.mjs (+93 -0)
📝 serve/server.py (+79 -1)
➕ serve/test_smi_monitor.py (+99 -0)

📄 Description

Quick Summary

Show RAM and expert placement, sampling defaults, KV cache details, VRAM breakdowns and prefill speeds. Add request-history clearing without resetting lifetime counters, plus PNG clipboard copying.

Include English and Spanish strings, host and server tests, and reapplication instructions for the local customization.

Problem and result

The Monitor did not show several things a user needs to tune a model that does not fit the GPU:

  • how much system RAM is used, and where the model's experts are (VRAM, RAM, NVMe disk);
  • the sampling a request gets for the fields it leaves out;
  • the KV cache format (--kv) and what it costs in memory;
  • what fills the card's VRAM;
  • the prompt (prefill) speed of each request.

There was also no way to start the request list and its averages again without restarting the model.

After this change the Monitor shows:

  1. A Memory and experts card: system RAM (used, free, chart) and one stacked bar of where the experts are (VRAM / RAM / NVMe). It shows the number of experts, GB and share of each.
  2. A Sampling card: temperature, top-p, top-k, min-p, penalties and seed, as the server applies them (model card → model config sampling → Chat settings). A dot marks the values set in the model's config.
  3. In Context fill: the KV format, its estimated size and a short line on what the format means.
  4. In the VRAM card (one GPU only): a coloured bar of weights, MTP draft, expert cache, KV (≈), verify buffers, other and free.
  5. A Prefill tok/s column in Recent requests, after Tok/s.
  6. A Clear button in Recent requests (two clicks). It clears the list and the totals of the /metrics view only; /v1/status and Prometheus keep counting from the server start. The model keeps running.
  7. A Copy to clipboard button in the Monitor screenshot window, between Close and Download.

On an RTX 3060 12 GB with 48 GB RAM, running Qwen3.8-Flash-Next UD-Q6_K_XL at 64K with --kv k8v4 and --resident-budget-gib 24, the card read the following. VRAM held 609 experts (2.5 GB). RAM held ≈5,796 experts (24.0 GB); the engine log says 5,791. NVMe held ≈18,171 experts (75.2 GB). The total was 24,576 experts (101.7 GB).

None yet.

Approach

  • No engine (C++) change. Every figure comes from what the engine already reports:
    • the INFO line: expert_slots, expert_cache_mib, arena_mib, kv, context, kv_resident; ram_experts / cpu_experts on DeepSeek;
    • its start lines in the log.
  • serve/server.py adds the following, all under an SMI2000 comment:
    • experts and expert_total_mib, read from the pack's native_experts.txt header. setdefault keeps any figure the engine reports itself.
    • vram_parts (weights, draft, buffers in MiB), parsed from this start's log lines. A missing line leaves its part out.
    • kv_mib_est, for qwen4exp only. It uses the same bytes per cell as setup.UD_FIT_KV_BYTES and strata_control/vram_fit.py.
    • A sampling key in GET /metrics.
    • POST /metrics/reset. It sits behind the API key and _own_page() (JSON only, no foreign Origin), like /config. It clears history and keeps a baseline of totals, so only the /metrics view starts again.
  • The host adds POST /api/native/instances/<id>/metrics/reset, which calls the server and re-reads /metrics?requests=all. Re-reading is needed because the host's poll merges older requests back in.
  • The UI pieces are new files: SmiMemoryPanel.tsx, SmiMonitorExtras.tsx, smi-expert-tiers.ts (pure helpers, tested) and smi-monitor.css. The hooks in Monitor.tsx, SnapshotDialog.tsx, native-monitor.ts, monitor-dashboard.mjs and types.ts are a few lines each.
  • Estimates are marked ≈ and nothing is guessed. The RAM expert count from arena_mib and the KV size are estimates. When a figure is missing, the part is left out or the card says so.
  • Strings: a new smi-en.json / smi-es.json catalog pair. Strings that already exist in en.json reuse their keys, so other languages keep their translations; the new strings fall back to English in the other seven languages. locale-gaps.test.mjs now also reads smi-en.
  • Compatibility: /metrics only gains keys. An older host ignores them, and a newer host with an older server shows the old Monitor plus a "Restart the model…" note. This is not opt-in: the new cards show by default. Per CONTRIBUTING this needs a maintainer decision.

Validation

Revision b99f1e35 (on c62d5e3a). Windows, Node 22.4.1, the app's bundled Python. Strata 0.2.9 desktop app, engine 0.1.55 CUDA, RTX 3060 12 GB, 48 GB RAM.

Passed:

  • node --test tests/smi-monitor.test.mjs tests/locale-gaps.test.mjs tests/native-monitor-projection.test.mjs tests/monitor-host-sensors.test.mjs tests/split-qa2-fields.test.mjs in apps/host: 27 pass, 0 fail.
  • npx tsc --noEmit in apps/host: no errors.
  • npm run build in apps/host: built.
  • python -m unittest serve.test_smi_monitor serve.test_vram: 13 tests OK.
  • python -m unittest serve.test_server: 359 tests OK (3 skipped).
  • The isolated UI preview (scripts/preview-ui.mjs fixture with the figures above), checked by hand: all seven features render. Clear empties the list. Copy puts image/png on the clipboard.
  • On the RTX 3060 PC, the server's new figures computed from the real pack and the real engine log matched the engine's own lines:
    • pack_expert_totals gave 24,576 experts and 104,187 MiB.
    • vram_parts_from_log gave weights 4,480, draft 1,152 and buffers 114 MiB.
    • The engine logged "101.7 GiB experts, 2.5 GiB in the GPU caches, 24.0 GiB RAM copy, file tier 75.2 GiB".

Failed:

  • npm test (full host suite): 4 failures, the same 4 as on c62d5e3a without this change:

    • native file actions with symlinks;
    • engine-version.test.mjs;
    • monitor-dashboard.test.mjs (cannot load .ts on Node 22.4);
    • weight discovery with symlinks.

    timeskip-real.test.mjs failed once in a full run and passed twice on its own.

Not run:

  • CUDA, HIP, SYCL and Metal builds: no engine source changed.
  • The packaged desktop app with a model loaded after this change: the build was copied into the app, but the new figures were not yet seen from a live engine.
  • Multi-GPU, DeepSeek V4.1 and Qwen3.6: the DeepSeek path is covered by unit tests only, and the VRAM bar is hidden on multi-GPU.
  • Linux and macOS.

Limits

  • The KV size is an estimate for Qwen3.8-Flash-Next only (13 attention layers). Other families show the format without a size.
  • The VRAM parts depend on the wording of the engine's start lines. If they change, VRAM_LOG_PARTS needs updating; the test holds the 0.1.55 lines.
  • The RAM expert count is arena_mib / the average expert size (≈). The OS file cache may hold some "disk" experts; this is not measured, and the card says so.
  • Only English and Spanish strings for the new text.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/5017 **Author:** [@elricdog](https://github.com/elricdog) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (1) - [`4619a07`](https://github.com/Niko1221/Strata/commit/4619a074a0d3862d21644be426d8247551aec9f9) [GUI] Add Monitor insights and request clearing ### 📊 Changes **20 files changed** (+1833 additions, -12 deletions) <details> <summary>View changed files</summary> ➕ `SMI2000-Changes.md` (+1155 -0) 📝 `apps/host/server/index.mjs` (+3 -0) 📝 `apps/host/server/monitor-dashboard.mjs` (+1 -1) 📝 `apps/host/server/native-control.mjs` (+3 -1) ➕ `apps/host/src/components/SmiMemoryPanel.tsx` (+43 -0) ➕ `apps/host/src/components/SmiMonitorExtras.tsx` (+82 -0) 📝 `apps/host/src/components/SnapshotDialog.tsx` (+13 -1) 📝 `apps/host/src/lib/i18n.ts` (+5 -2) 📝 `apps/host/src/lib/native-monitor.ts` (+1 -1) ➕ `apps/host/src/lib/smi-expert-tiers.ts` (+82 -0) 📝 `apps/host/src/lib/types.ts` (+4 -1) ➕ `apps/host/src/locales/smi-en.json` (+51 -0) ➕ `apps/host/src/locales/smi-es.json` (+51 -0) 📝 `apps/host/src/main.tsx` (+1 -0) 📝 `apps/host/src/screens/Monitor.tsx` (+7 -3) ➕ `apps/host/src/styles/smi-monitor.css` (+59 -0) 📝 `apps/host/tests/locale-gaps.test.mjs` (+1 -1) ➕ `apps/host/tests/smi-monitor.test.mjs` (+93 -0) 📝 `serve/server.py` (+79 -1) ➕ `serve/test_smi_monitor.py` (+99 -0) </details> ### 📄 Description ## Quick Summary Show RAM and expert placement, sampling defaults, KV cache details, VRAM breakdowns and prefill speeds. Add request-history clearing without resetting lifetime counters, plus PNG clipboard copying. Include English and Spanish strings, host and server tests, and reapplication instructions for the local customization. ## Problem and result The Monitor did not show several things a user needs to tune a model that does not fit the GPU: - how much system RAM is used, and where the model's experts are (VRAM, RAM, NVMe disk); - the sampling a request gets for the fields it leaves out; - the KV cache format (`--kv`) and what it costs in memory; - what fills the card's VRAM; - the prompt (prefill) speed of each request. There was also no way to start the request list and its averages again without restarting the model. After this change the Monitor shows: 1. A **Memory and experts** card: system RAM (used, free, chart) and one stacked bar of where the experts are (VRAM / RAM / NVMe). It shows the number of experts, GB and share of each. 2. A **Sampling** card: temperature, top-p, top-k, min-p, penalties and seed, as the server applies them (model card → model config `sampling` → Chat settings). A dot marks the values set in the model's config. 3. In **Context fill**: the KV format, its estimated size and a short line on what the format means. 4. In the **VRAM** card (one GPU only): a coloured bar of weights, MTP draft, expert cache, KV (≈), verify buffers, other and free. 5. A **Prefill tok/s** column in **Recent requests**, after Tok/s. 6. A **Clear** button in **Recent requests** (two clicks). It clears the list and the totals of the `/metrics` view only; `/v1/status` and Prometheus keep counting from the server start. The model keeps running. 7. A **Copy to clipboard** button in the Monitor screenshot window, between Close and Download. On an RTX 3060 12 GB with 48 GB RAM, running Qwen3.8-Flash-Next UD-Q6_K_XL at 64K with `--kv k8v4` and `--resident-budget-gib 24`, the card read the following. VRAM held 609 experts (2.5 GB). RAM held ≈5,796 experts (24.0 GB); the engine log says 5,791. NVMe held ≈18,171 experts (75.2 GB). The total was 24,576 experts (101.7 GB). ## Related discussion None yet. ## Approach - **No engine (C++) change.** Every figure comes from what the engine already reports: - the `INFO` line: `expert_slots`, `expert_cache_mib`, `arena_mib`, `kv`, `context`, `kv_resident`; `ram_experts` / `cpu_experts` on DeepSeek; - its start lines in the log. - `serve/server.py` adds the following, all under an `SMI2000` comment: - `experts` and `expert_total_mib`, read from the pack's `native_experts.txt` header. `setdefault` keeps any figure the engine reports itself. - `vram_parts` (weights, draft, buffers in MiB), parsed from this start's log lines. A missing line leaves its part out. - `kv_mib_est`, for `qwen4exp` only. It uses the same bytes per cell as `setup.UD_FIT_KV_BYTES` and `strata_control/vram_fit.py`. - A `sampling` key in `GET /metrics`. - `POST /metrics/reset`. It sits behind the API key and `_own_page()` (JSON only, no foreign Origin), like `/config`. It clears `history` and keeps a baseline of `totals`, so only the `/metrics` view starts again. - The host adds `POST /api/native/instances/<id>/metrics/reset`, which calls the server and re-reads `/metrics?requests=all`. Re-reading is needed because the host's poll merges older requests back in. - The UI pieces are new files: `SmiMemoryPanel.tsx`, `SmiMonitorExtras.tsx`, `smi-expert-tiers.ts` (pure helpers, tested) and `smi-monitor.css`. The hooks in `Monitor.tsx`, `SnapshotDialog.tsx`, `native-monitor.ts`, `monitor-dashboard.mjs` and `types.ts` are a few lines each. - **Estimates are marked `≈` and nothing is guessed.** The RAM expert count from `arena_mib` and the KV size are estimates. When a figure is missing, the part is left out or the card says so. - **Strings:** a new `smi-en.json` / `smi-es.json` catalog pair. Strings that already exist in `en.json` reuse their keys, so other languages keep their translations; the new strings fall back to English in the other seven languages. `locale-gaps.test.mjs` now also reads `smi-en`. - **Compatibility:** `/metrics` only gains keys. An older host ignores them, and a newer host with an older server shows the old Monitor plus a "Restart the model…" note. **This is not opt-in:** the new cards show by default. Per CONTRIBUTING this needs a maintainer decision. ## Validation Revision `b99f1e35` (on `c62d5e3a`). Windows, Node 22.4.1, the app's bundled Python. Strata 0.2.9 desktop app, engine 0.1.55 CUDA, RTX 3060 12 GB, 48 GB RAM. **Passed:** - `node --test tests/smi-monitor.test.mjs tests/locale-gaps.test.mjs tests/native-monitor-projection.test.mjs tests/monitor-host-sensors.test.mjs tests/split-qa2-fields.test.mjs` in `apps/host`: 27 pass, 0 fail. - `npx tsc --noEmit` in `apps/host`: no errors. - `npm run build` in `apps/host`: built. - `python -m unittest serve.test_smi_monitor serve.test_vram`: 13 tests OK. - `python -m unittest serve.test_server`: 359 tests OK (3 skipped). - The isolated UI preview (`scripts/preview-ui.mjs` fixture with the figures above), checked by hand: all seven features render. Clear empties the list. Copy puts `image/png` on the clipboard. - On the RTX 3060 PC, the server's new figures computed from the real pack and the real engine log matched the engine's own lines: - `pack_expert_totals` gave 24,576 experts and 104,187 MiB. - `vram_parts_from_log` gave weights 4,480, draft 1,152 and buffers 114 MiB. - The engine logged "101.7 GiB experts, 2.5 GiB in the GPU caches, 24.0 GiB RAM copy, file tier 75.2 GiB". **Failed:** - `npm test` (full host suite): 4 failures, the same 4 as on `c62d5e3a` without this change: - native file actions with symlinks; - `engine-version.test.mjs`; - `monitor-dashboard.test.mjs` (cannot load `.ts` on Node 22.4); - weight discovery with symlinks. `timeskip-real.test.mjs` failed once in a full run and passed twice on its own. **Not run:** - CUDA, HIP, SYCL and Metal builds: no engine source changed. - The packaged desktop app with a model loaded **after** this change: the build was copied into the app, but the new figures were not yet seen from a live engine. - Multi-GPU, DeepSeek V4.1 and Qwen3.6: the DeepSeek path is covered by unit tests only, and the VRAM bar is hidden on multi-GPU. - Linux and macOS. ## Limits - The KV size is an estimate for Qwen3.8-Flash-Next only (13 attention layers). Other families show the format without a size. - The VRAM parts depend on the wording of the engine's start lines. If they change, `VRAM_LOG_PARTS` needs updating; the test holds the 0.1.55 lines. - The RAM expert count is `arena_mib` / the average expert size (`≈`). The OS file cache may hold some "disk" experts; this is not measured, and the card says so. - Only English and Spanish strings for the new text. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#5286
No description provided.