Skip to content

[RL] [KVCache] let cache transfer managers update key prefix after weight update and add unit tests#7083

Open
liyonghua0910 wants to merge 2 commits intoPaddlePaddle:developfrom
liyonghua0910:develop+20260326_add_tests
Open

[RL] [KVCache] let cache transfer managers update key prefix after weight update and add unit tests#7083
liyonghua0910 wants to merge 2 commits intoPaddlePaddle:developfrom
liyonghua0910:develop+20260326_add_tests

Conversation

@liyonghua0910
Copy link
Copy Markdown
Collaborator

@liyonghua0910 liyonghua0910 commented Mar 30, 2026

Motivation

This PR updates the mooncake key_prefix during update_weights.

Previously, key_prefix was only refreshed in resume. To make cache metadata align with the new model version earlier, this PR adds one more refresh in update_weights, while keeping the existing refresh in resume.

Modifications

  • Add cache-transfer control handling in EngineService._control_update_weights()
  • Add update_weights handler in CacheTransferManager
  • Keep resume refreshing key_prefix
  • Add unit tests for both update_weights and resume paths

Usage or Command

No new API.

Behavior after this PR:

  • update_weights refreshes key_prefix
  • resume also refreshes key_prefix
pytest -q tests/engine/test_common_engine.py -k "control_update_weights"
pytest -q tests/cache_manager/test_cache_transfer_manager.py -k "handle_resume or handle_update_weights"

Accuracy Tests

N/A

Checklist

  • Add at least a tag in the PR title.
  • Format your code, run pre-commit before commit.
  • Add unit tests.
  • Provide accuracy results.
  • If the current PR is submitting to the release branch, make sure the PR has been submitted to the develop branch, then cherry-pick it to the release branch with the [Cherry-Pick] PR tag.

@paddle-bot
Copy link
Copy Markdown

paddle-bot bot commented Mar 30, 2026

Thanks for your contribution!

@liyonghua0910 liyonghua0910 changed the title [CI] add unit tests for sleep/wakeup control method [RL] [KVCache] let cache transfer managers update key prefix after weight update and add unit tests Mar 30, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 4 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@a7f52c3). Learn more about missing BASE report.

Files with missing lines Patch % Lines
fastdeploy/engine/common_engine.py 60.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #7083   +/-   ##
==========================================
  Coverage           ?   73.74%           
==========================================
  Files              ?      402           
  Lines              ?    56462           
  Branches           ?     8909           
==========================================
  Hits               ?    41637           
  Misses             ?    11876           
  Partials           ?     2949           
Flag Coverage Δ
GPU 73.74% <75.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants