[PR #2967] [Engine] Add experimental RoPE-to-YaRN 4x saved-cache migration #4368

Open
opened 2026-11-07 15:35:13 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2967
Author: @CC-David-CC
Created: 10/17/2026
Status: 🔄 Open

Base: main ← Head: feat/rope-yarn4-cache-minimal


📝 Commits (2)

  • e45bd5f feat: experimental RoPE to YaRN 4x saved-cache migration
  • 6d29b11 test: cover saved-cache migration and provenance

📊 Changes

17 files changed (+726 additions, -57 deletions)

View changed files

📝 CMakeLists.txt (+5 -1)
➕ docs/ROPE_CACHE_MIGRATION.md (+32 -0)
📝 include/strata/core/conversation_cache.hpp (+3 -0)
📝 include/strata/core/conversation_file.hpp (+1 -1)
📝 include/strata/core/conversation_snapshot.hpp (+7 -0)
➕ include/strata/core/rope_cache_migration.hpp (+29 -0)
📝 include/strata/kernels/rope_scaling.hpp (+24 -0)
📝 serve/server.py (+16 -11)
📝 serve/test_slots.py (+37 -0)
📝 src/core/conversation_file.cpp (+29 -9)
📝 src/core/conversation_file_test.cpp (+1 -1)
📝 src/core/conversation_state.cpp (+21 -8)
📝 src/core/conversation_validation_test.cpp (+12 -0)
➕ src/core/rope_cache_migration.cpp (+187 -0)
➕ src/core/rope_cache_migration_test.cpp (+222 -0)
📝 src/kernels/cuda/rope.cu (+3 -17)
📝 src/program/generate.cpp (+97 -9)

📄 Description

Problem and result

An ordinary-RoPE saved session cannot normally be restored under different YaRN settings. Add opt-in migration to approximate YaRN 4x history, including MTP draft keys, while retaining the original saved file and marking converted history as approximate.

#1698. This updates the existing saved-cache migration proposal onto current main.

Approach

Rebased onto main 90767252f, preserving the new server admission/queue methods and engine source registration. Require --experimental-rope-yarn4-cache, STRATA_ROPE_TABLE=1, FP16 KV, text-only and one GPU. Convert eligible keys, preserve provenance through save/reload, and refuse incompatible or repeated migration. Added the migration and slot regressions to the branch.

Usage: docs/ROPE_CACHE_MIGRATION.md.

Validation

Tested revision: 6d29b11ae.

Passed:

  • git diff --check upstream/main.
  • CUDA 13.2, RTX PRO 6000 Blackwell: built strata, rope_cache_migration_test, conversation_file_test, conversation_validation_test and rope_parity. All four selected CTests passed.
  • HIP: full strata build and the same four CTests passed on llm-79, RX 7900 XTX (gfx1100), ROCm 7.15 / Clang 23.
  • HIP real-model smoke test on Qwen3.8-Flash-Next IQ3_XXS: migrated 255 cached tokens with a 256-token retrieval prompt, generated correctly, then saved/reloaded with approximate-history provenance retained and correct retrieval. This used the unchanged tested executable, MTP off, with allocation limits 2048 to 4096; it is not long-context validation.
  • SYCL: strata built with Intel oneAPI 2026.1; no Intel GPU execution claimed.
  • HIP/Clang 17, gfx1012: all five changed engine/kernel translation units compiled separately.
  • AMD host CPU checks: migration regression passed 3,827 checks under AddressSanitizer and UBSan; saved-file regression passed 201 checks.
  • Linux: python -m unittest serve.test_slots serve.test_queue_keepalive -v passed all 37 tests. Windows also passed, with the symlink check skipped there and covered on Linux.

Failed:

  • Full HIP build: installed Clang 17 rejects two __shared__ alignas(16) declarations in unchanged upstream src/kernels/cuda/iq_kernels.cu (lines 2263 and 2450). This older-toolchain failure remains on A5500; the full build and tests passed on llm-79 with its installed ROCm toolchain.

  • An initial real-model run refused migration because the model fingerprint differed. A diagnostic run and a subsequent run of the unchanged production executable passed. The initial refusal remains unexplained; the identity check was retained.

Not run:

  • Long-context quality/performance, real-model MTP migration, and default-off token-identity comparison on this revision. Earlier measurements are not claimed as new validation.
  • SYCL runtime validation; this experimental migration operation is not exposed by the SYCL port.

Limits

Converted keys do not recompute the historical attention that produced retained values and recurrent state; migration is approximate, not equivalent to fresh YaRN prefill. Keep the same model, MTP and execution settings. Vision, batching, multiple GPUs and non-FP16 KV are excluded. The source session is retained; existing destinations and repeated conversions are refused.


🔄 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/2967 **Author:** [@CC-David-CC](https://github.com/CC-David-CC) **Created:** 10/17/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/rope-yarn4-cache-minimal` --- ### 📝 Commits (2) - [`e45bd5f`](https://github.com/Niko1221/Strata/commit/e45bd5fde95f272cc7031be5a9c4bf3f7a2bb8b3) feat: experimental RoPE to YaRN 4x saved-cache migration - [`6d29b11`](https://github.com/Niko1221/Strata/commit/6d29b11aee1ddcfe660ddfe4ed4567474a69d2ab) test: cover saved-cache migration and provenance ### 📊 Changes **17 files changed** (+726 additions, -57 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+5 -1) ➕ `docs/ROPE_CACHE_MIGRATION.md` (+32 -0) 📝 `include/strata/core/conversation_cache.hpp` (+3 -0) 📝 `include/strata/core/conversation_file.hpp` (+1 -1) 📝 `include/strata/core/conversation_snapshot.hpp` (+7 -0) ➕ `include/strata/core/rope_cache_migration.hpp` (+29 -0) 📝 `include/strata/kernels/rope_scaling.hpp` (+24 -0) 📝 `serve/server.py` (+16 -11) 📝 `serve/test_slots.py` (+37 -0) 📝 `src/core/conversation_file.cpp` (+29 -9) 📝 `src/core/conversation_file_test.cpp` (+1 -1) 📝 `src/core/conversation_state.cpp` (+21 -8) 📝 `src/core/conversation_validation_test.cpp` (+12 -0) ➕ `src/core/rope_cache_migration.cpp` (+187 -0) ➕ `src/core/rope_cache_migration_test.cpp` (+222 -0) 📝 `src/kernels/cuda/rope.cu` (+3 -17) 📝 `src/program/generate.cpp` (+97 -9) </details> ### 📄 Description ## Problem and result An ordinary-RoPE saved session cannot normally be restored under different YaRN settings. Add opt-in migration to approximate YaRN 4x history, including MTP draft keys, while retaining the original saved file and marking converted history as approximate. ## Related discussion #1698. This updates the existing saved-cache migration proposal onto current main. ## Approach Rebased onto main `90767252f`, preserving the new server admission/queue methods and engine source registration. Require `--experimental-rope-yarn4-cache`, `STRATA_ROPE_TABLE=1`, FP16 KV, text-only and one GPU. Convert eligible keys, preserve provenance through save/reload, and refuse incompatible or repeated migration. Added the migration and slot regressions to the branch. Usage: `docs/ROPE_CACHE_MIGRATION.md`. ## Validation Tested revision: `6d29b11ae`. **Passed:** - `git diff --check upstream/main`. - CUDA 13.2, RTX PRO 6000 Blackwell: built `strata`, `rope_cache_migration_test`, `conversation_file_test`, `conversation_validation_test` and `rope_parity`. All four selected CTests passed. - HIP: full `strata` build and the same four CTests passed on llm-79, RX 7900 XTX (gfx1100), ROCm 7.15 / Clang 23. - HIP real-model smoke test on Qwen3.8-Flash-Next IQ3_XXS: migrated 255 cached tokens with a 256-token retrieval prompt, generated correctly, then saved/reloaded with approximate-history provenance retained and correct retrieval. This used the unchanged tested executable, MTP off, with allocation limits 2048 to 4096; it is not long-context validation. - SYCL: `strata` built with Intel oneAPI 2026.1; no Intel GPU execution claimed. - HIP/Clang 17, gfx1012: all five changed engine/kernel translation units compiled separately. - AMD host CPU checks: migration regression passed 3,827 checks under AddressSanitizer and UBSan; saved-file regression passed 201 checks. - Linux: `python -m unittest serve.test_slots serve.test_queue_keepalive -v` passed all 37 tests. Windows also passed, with the symlink check skipped there and covered on Linux. **Failed:** - Full HIP build: installed Clang 17 rejects two `__shared__ alignas(16)` declarations in unchanged upstream `src/kernels/cuda/iq_kernels.cu` (lines 2263 and 2450). This older-toolchain failure remains on A5500; the full build and tests passed on llm-79 with its installed ROCm toolchain. - An initial real-model run refused migration because the model fingerprint differed. A diagnostic run and a subsequent run of the unchanged production executable passed. The initial refusal remains unexplained; the identity check was retained. **Not run:** - Long-context quality/performance, real-model MTP migration, and default-off token-identity comparison on this revision. Earlier measurements are not claimed as new validation. - SYCL runtime validation; this experimental migration operation is not exposed by the SYCL port. ## Limits Converted keys do not recompute the historical attention that produced retained values and recurrent state; migration is approximate, not equivalent to fresh YaRN prefill. Keep the same model, MTP and execution settings. Vision, batching, multiple GPUs and non-FP16 KV are excluded. The source session is retained; existing destinations and repeated conversions are refused. --- <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#4368
No description provided.