Skip to content

server: fix prompt caching for repeated prompts #5420

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

Merged
merged 1 commit into from
Feb 9, 2024

Conversation

ristew
Copy link
Contributor

@ristew ristew commented Feb 8, 2024

Fix non-deterministic prompt caching for repeated prompts (#4902).

All this PR does is move the conditional that checks if there are no new prompt tokens from after to before the kv cache is trimmed. This fixes the issue in my testing (repeating curl localhost:3731/completion -s -X POST -H 'Content-type: application/json' --data '{"prompt":"What a beautiful","n_probs":1,"n_predict":1,"cache_prompt":true}').

Copy link
Member

@ggerganov ggerganov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good catch

@ggerganov ggerganov merged commit 7c777fc into ggml-org:master Feb 9, 2024
jordankanter pushed a commit to jordankanter/llama.cpp that referenced this pull request Mar 13, 2024
hodlen pushed a commit to hodlen/llama.cpp that referenced this pull request Apr 1, 2024
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