-
Notifications
You must be signed in to change notification settings - Fork 77
add unit test for prefix cache tracking scorer #311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
add unit test for prefix cache tracking scorer #311
Conversation
/assign @vMaroon |
@zhengkezhou1 kindly please rebase and sign your commits |
/cc @vMaroon |
9aa3959
to
e6b8203
Compare
all commits are signed now. |
the commits do not appear to be signed/verified yet. See https://docs.github.com/en/authentication/managing-commit-signature-verification |
Signed-off-by: zhengkezhou1 <[email protected]>
e6b8203
to
c8e1e2a
Compare
ok, its works now right? |
|
||
for _, tt := range testcases { | ||
t.Run(tt.name, func(t *testing.T) { | ||
mockScorer := &mockPodScorer{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The precise prefix-cache scorer is a wrapper of the kvcache.Indexer. The wrapping logic is mostly normalization.
What this test ends up doing is test the latter - which is great, but can be achieved by testing the indexedScoresToNormalizedScoredPods
function directly instead of using a mock PodScorer interface.
I think this test should verify correctness of the scorer as-is. This would require:
- Access to the indexer's backing
kvblock.Index
- Having the test populate the
kvblock.Index
with kv-block information - Testing correctness of the scorer as-is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding data to the kvblock.Index
alone isn't sufficient; we also need to add data to the tokensIndexer
. However, the kv-cache-manager
currently only allows access to the KVBlockIndex
. Can we add a method to the kv-cache-manager
to expose the tokensIndexer
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add data to the tokenization cache by making the calls in a "warmup" step (call once, get no scores). Note that this behavior will change soon once tokenization is synchronous, after-which there would be no need for such a step.
fix #218