[PR #399] [CLOSED] tools: refresh DS4 startup expert profiles from recent routing counts #513

Closed
opened 2026-10-29 21:26:16 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/399
Author: @LostVector
Created: 10/22/2026
Status: ❌ Closed

Base: main ← Head: upstream/refresh-ds4-profile


📝 Commits (2)

  • cbde6c5 tools: refresh DS4 expert profiles from recent routing deltas
  • 0a429de docs: distinguish count-delta refresh from existing DS4 profile tools

📊 Changes

3 files changed (+238 additions, -0 deletions)

View changed files

➕ docs/DS4_PROFILE_REFRESH.md (+90 -0)
➕ tools/refresh_ds4_profile.py (+91 -0)
➕ tools/test_refresh_ds4_profile.py (+57 -0)

📄 Description

Refreshing startup expert placement improved held-out code generation from 11.3 to 18.0 tokens/s on the first response, and 14.6 to 23.9 tokens/s on a repeated response, on our three-GPU AMD setup. First-response expert VRAM hit rate rose from 42.3% to 75.5%. These are workload-specific measurements from our earlier experimental engine stack, not a universal speedup or a benchmark of current upstream.

In plain terms, the saved profile tells Maya which experts to put in VRAM at startup. Our profile contained about 920 million historical selections; roughly 975,000 recent calibration selections barely changed its rankings. This offline utility extracts the new selections from independent before/after snapshots and gives those recent observations more influence. The measured blend was approximately 80% recent usage and 20% normalized historical usage, separately per layer. Normal adaptive caching continues during inference.

What this adds

  • tools/refresh_ds4_profile.py: read DS4 raw uint32 count profiles, subtract each calibration run's starting counts, combine independent deltas, and write a fresh blended profile plus a SHA-256 provenance receipt.
  • Refuse existing output/receipt paths, wrong binary geometry, decreasing counters, unobserved layers, invalid blend weights, and uint32 overflow.
  • A calibration and rollback recipe, measurement methodology and limitations, plus five CPU-only tests.

Upstream already saves these routing counts, and tools/ds4/profile.py make already normalizes and combines saved profiles. This proposal complements that tool when calibration starts from an accumulated profile: subtracting the starting counts prevents old history from being counted again in each snapshot. Starting calibration from empty profiles and using the existing tool remains an alternative. No automatic aging, runtime defaults, kernels, weights, or cache budgets change.

Validation

  • Rebased onto upstream 25deec5; five CPU-only unit tests passed (python3 -m unittest discover -s tools -p test_refresh_ds4_profile.py -v).
  • Running this port on the original two independent calibration snapshot pairs reproduced the selected experiment profile byte for byte: SHA-256 419ff834edd0952e6ebc2dc260d436590e31b17ecede0b9d5bc8941aa2f743ab.
  • git diff --check passed. The live inference server and its profile were not modified for this submission.

Measurement scope

DeepSeek-V4.1-Flash-1017 EXL3 3.5 bpw; two R9700 32 GB cards plus an RX 9070 XT 16 GB; TP2, drafting off, greedy 128-token held-out responses. Calibration used different code, technical and prose tasks; confirmation reversed the comparison order. Technical and prose responses also improved, with smaller gains; the documentation includes those results.

Changing placement and initial cache heat can change floating-point execution between CPU and GPU. This is not a cross-profile logit-parity or broad quality claim. Current upstream tool correctness and exact profile reproduction were checked; these historical throughput measurements were not rerun against the current engine. See docs/DS4_PROFILE_REFRESH.md for the recipe and full limits.


🔄 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/mw00/project-maya/pull/399 **Author:** [@LostVector](https://github.com/LostVector) **Created:** 10/22/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `upstream/refresh-ds4-profile` --- ### 📝 Commits (2) - [`cbde6c5`](https://github.com/mw00/project-maya/commit/cbde6c5dd4e4944892dfffaf69a0d7d4d88a1d23) tools: refresh DS4 expert profiles from recent routing deltas - [`0a429de`](https://github.com/mw00/project-maya/commit/0a429dea6d51d6e5dc1b2c4853b7dc99a75eaf63) docs: distinguish count-delta refresh from existing DS4 profile tools ### 📊 Changes **3 files changed** (+238 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `docs/DS4_PROFILE_REFRESH.md` (+90 -0) ➕ `tools/refresh_ds4_profile.py` (+91 -0) ➕ `tools/test_refresh_ds4_profile.py` (+57 -0) </details> ### 📄 Description Refreshing startup expert placement improved held-out code generation from **11.3 to 18.0 tokens/s on the first response**, and **14.6 to 23.9 tokens/s on a repeated response**, on our three-GPU AMD setup. First-response expert VRAM hit rate rose from **42.3% to 75.5%**. These are workload-specific measurements from our earlier experimental engine stack, not a universal speedup or a benchmark of current upstream. In plain terms, the saved profile tells Maya which experts to put in VRAM at startup. Our profile contained about 920 million historical selections; roughly 975,000 recent calibration selections barely changed its rankings. This offline utility extracts the new selections from independent before/after snapshots and gives those recent observations more influence. The measured blend was approximately 80% recent usage and 20% normalized historical usage, separately per layer. Normal adaptive caching continues during inference. ### What this adds - `tools/refresh_ds4_profile.py`: read DS4 raw uint32 count profiles, subtract each calibration run's starting counts, combine independent deltas, and write a fresh blended profile plus a SHA-256 provenance receipt. - Refuse existing output/receipt paths, wrong binary geometry, decreasing counters, unobserved layers, invalid blend weights, and uint32 overflow. - A calibration and rollback recipe, measurement methodology and limitations, plus five CPU-only tests. Upstream already saves these routing counts, and `tools/ds4/profile.py make` already normalizes and combines saved profiles. This proposal complements that tool when calibration starts from an accumulated profile: subtracting the starting counts prevents old history from being counted again in each snapshot. Starting calibration from empty profiles and using the existing tool remains an alternative. No automatic aging, runtime defaults, kernels, weights, or cache budgets change. ### Validation - Rebased onto upstream `25deec5`; five CPU-only unit tests passed (`python3 -m unittest discover -s tools -p test_refresh_ds4_profile.py -v`). - Running this port on the original two independent calibration snapshot pairs reproduced the selected experiment profile byte for byte: SHA-256 `419ff834edd0952e6ebc2dc260d436590e31b17ecede0b9d5bc8941aa2f743ab`. - `git diff --check` passed. The live inference server and its profile were not modified for this submission. ### Measurement scope DeepSeek-V4.1-Flash-1017 EXL3 3.5 bpw; two R9700 32 GB cards plus an RX 9070 XT 16 GB; TP2, drafting off, greedy 128-token held-out responses. Calibration used different code, technical and prose tasks; confirmation reversed the comparison order. Technical and prose responses also improved, with smaller gains; the documentation includes those results. Changing placement and initial cache heat can change floating-point execution between CPU and GPU. This is not a cross-profile logit-parity or broad quality claim. Current upstream tool correctness and exact profile reproduction were checked; these historical throughput measurements were not rerun against the current engine. See `docs/DS4_PROFILE_REFRESH.md` for the recipe and full limits. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:26:16 +07:00
Sign in to join this conversation.
No labels
pull-request
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
mw00/project-maya#513
No description provided.