[issue5] KV Cache 通信临界带宽 / TTFT / QPM 上界模型与扫描报告 - #30
Open
shsaihdsaiudh wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 Issue
#5
提交内容
src/code/issue5/kv_cache_break_even.py:prefill 阶段"以存代算"的带宽临界值模型,以及给定 TTFT 约束下的 QPM 上界估算。模型:
以存代算严格优于全量重算的条件是
T_hybrid < T_full,由此直接解出临界带宽——即在给定命中率、上下文长度、KV Cache 大小与算力下,低于该带宽就不值得走"以存代算"。工具同时输出 TCP / RDMA 两档带宽下的 TTFT 与 QPM 上界,用于对比"提升带宽能换到多少并发"。验证
python -m pytest src/code/issue5/test_kv_cache_break_even.py -q # 3 passed python src/code/issue5/kv_cache_break_even.py单测覆盖公式的边界情形。默认扫描 8K / 32K / 128K 上下文 × 10% / 30% / 50% / 80% 命中率,结果写入
src/code/issue5/results/(JSON + CSV)。当前边界
本 PR 覆盖验收要求 1 的模型部分。
默认的 KV Cache 大小、重算耗时、TCP/RDMA 带宽均为可替换的示例参数,不是实测值,文件与 README 中已标注。验收要求 1 的"用实测数据验证"需要在"prefill 节点 + 共享远端 KV 存储"的两机环境上采集不同命中率/上下文长度下的加载与重算耗时后回填。
验收要求 2(把 KV Cache 传输由 TCP 改为 RDMA 的实现,及带宽/时延/并发/QPM 对比报告)需要两台 GPU 服务器与 RDMA 网卡,提交者当前为单机单卡环境,本 PR 未包含 RDMA transport 实现。