[PR #38] [CLOSED] moe: continuous adaptive expert cache eviction with exponential decay #2424

Closed
opened 2026-11-04 02:00:00 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/38
Author: @code-martin
Created: 9/28/2026
Status: ❌ Closed

Base: main ← Head: feature/adaptive-cache-eviction


📝 Commits (2)

  • 5b51359 core: implement elastic expert cache via CUDA VMM and on-demand GPU vision
  • 2b4cf19 moe: continuous adaptive expert cache eviction with exponential decay

📊 Changes

6 files changed (+625 additions, -69 deletions)

View changed files

📝 CMakeLists.txt (+2 -2)
📝 include/strata/core/expert_cache.hpp (+67 -0)
📝 serve/server.py (+116 -26)
📝 src/core/expert_cache.cpp (+338 -36)
📝 src/program/generate.cpp (+56 -5)
➕ tools/test_vision_client.py (+46 -0)

📄 Description

Summary

Implements continuous, non-blocking MoE expert cache adaptation between VRAM resident slots and host RAM during multi-turn generation.

Motivation

Static expert placement profiles calibrated on generic corpora often yield low hit rates (~25–35%) when operating in specialized domains or conversations in other languages. Continuous adaptation enables the cache to dynamically follow conversation context.

Key Changes

  • Usage Frequency Tracking:
    • Tracks expert routing activation counters per layer during token generation.
  • Exponential Decay Smoothing:
    • Applies a gentle 0.985 decay factor per round instead of abrupt reset (0.7), maintaining stable long-term resident profiles while remaining responsive to topic shifts.
  • Hysteresis & Thrashing Prevention:
    • Implements candidate and victim thresholds (gain +1.0) to avoid ping-pong thrashing between VRAM and RAM.
  • Engine & Server Integration:
    • Adds the ADAPT protocol command to generate.cpp.
    • Automatically triggers non-blocking adaptation rounds in serve/server.py at the end of each request.

Testing

  • Tested on multi-turn conversations in other languages: observed over 5,600 successful expert swaps, with cache hit rate climbing from 25.8% to 63.0%.

🔄 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/38 **Author:** [@code-martin](https://github.com/code-martin) **Created:** 9/28/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feature/adaptive-cache-eviction` --- ### 📝 Commits (2) - [`5b51359`](https://github.com/Niko1221/Strata/commit/5b513598747f7fcc129f67b6bc7e2d7e09596c04) core: implement elastic expert cache via CUDA VMM and on-demand GPU vision - [`2b4cf19`](https://github.com/Niko1221/Strata/commit/2b4cf1994f273e0343e15ed37ae701d163766957) moe: continuous adaptive expert cache eviction with exponential decay ### 📊 Changes **6 files changed** (+625 additions, -69 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+2 -2) 📝 `include/strata/core/expert_cache.hpp` (+67 -0) 📝 `serve/server.py` (+116 -26) 📝 `src/core/expert_cache.cpp` (+338 -36) 📝 `src/program/generate.cpp` (+56 -5) ➕ `tools/test_vision_client.py` (+46 -0) </details> ### 📄 Description ### Summary Implements continuous, non-blocking MoE expert cache adaptation between VRAM resident slots and host RAM during multi-turn generation. ### Motivation Static expert placement profiles calibrated on generic corpora often yield low hit rates (~25–35%) when operating in specialized domains or conversations in other languages. Continuous adaptation enables the cache to dynamically follow conversation context. ### Key Changes - **Usage Frequency Tracking**: - Tracks expert routing activation counters per layer during token generation. - **Exponential Decay Smoothing**: - Applies a gentle 0.985 decay factor per round instead of abrupt reset (0.7), maintaining stable long-term resident profiles while remaining responsive to topic shifts. - **Hysteresis & Thrashing Prevention**: - Implements candidate and victim thresholds (gain +1.0) to avoid ping-pong thrashing between VRAM and RAM. - **Engine & Server Integration**: - Adds the ADAPT protocol command to generate.cpp. - Automatically triggers non-blocking adaptation rounds in serve/server.py at the end of each request. ### Testing - Tested on multi-turn conversations in other languages: observed over 5,600 successful expert swaps, with cache hit rate climbing from 25.8% to 63.0%. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:00:00 +07:00
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#2424
No description provided.