Skip to content

Commit d599e5e

Browse files
authored
fix gibberish when use flaggems atten (#382)
<!-- Copyright 2026 FlagOS Contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> ### PR Category <!-- One of [Core | Vendor | OP | Tools | Others] --> OP ### PR Type <!-- One of [User Experience | New Features | Bug Fixes | Improvements | Performance | Breaking Change | Deprecations | Test Case | Docs | Others] --> Bug Fixes ### Description <!-- Describe what this PR does and why. --> fix Gibberish when use flaggems atten ### Related Issues <!-- Link any related issues: Fixes #issue, Closes #issue, or Related to #issue --> ### Changes <!-- List the key changes made in this PR. --> - add forward_includes_kv_cache_update=False By default ### Testing <!-- How has this change been tested? Include test commands, hardware used, etc. --> - ### Checklist - [ ] I have run the existing tests and they pass - [ ] I have added tests for my changes (if applicable) - [ ] I have updated the documentation (if applicable)
1 parent 885aaef commit d599e5e

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

vllm_fl/dispatch/backends/flaggems/impl/attention.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@
5050

5151
class AttentionFLBackend(AttentionBackend):
5252
accept_output_buffer: bool = True
53+
# KV cache update is performed by vLLM via do_kv_cache_update() before
54+
# forward(). Without this, vLLM assumes the backend updates the KV cache
55+
# inside forward() and never calls do_kv_cache_update, leaving the cache
56+
# unwritten (all zeros) and producing garbage output.
57+
forward_includes_kv_cache_update: bool = False
5358
supported_dtypes: ClassVar[list[torch.dtype]] = [torch.float16, torch.bfloat16]
5459

5560
@staticmethod

0 commit comments

Comments
 (0)