Skip to content
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

[BFCL] Prompt Caching for Claude Models #751

Merged
merged 5 commits into from
Nov 13, 2024

Conversation

VishnuSuresh27
Copy link
Contributor

@VishnuSuresh27 VishnuSuresh27 commented Nov 11, 2024

This PR request seeks to merge my changes of adding prompt caching abilities when running inference on Claude models. The benefit will be reduced cost significantly for inference on BFCL's multi-turn datasets when using the following models (in both Function Calling and Prompting modes):

  • Claude 3.5 Sonnet
  • Claude 3 Haiku
  • Claude 3 Opus

Summary of changes made:

  • Cached user messages
  • Cached system prompt (for Prompting mode)
  • Cached tools (for Function-Calling mode)

Please note:

  • This implementation rightfully avoids caching in single-turn cases as there aren't any future turns that could avail cache reading benefits.
  • According to the Anthropic guide, using prompting caching will not affect the model accuracy.

    Prompt caching has no effect on output token generation. The response you receive will be identical to what you would get if prompt caching was not used.

@HuanzhiMao HuanzhiMao added the BFCL-General General BFCL Issue label Nov 11, 2024
Copy link
Collaborator

@HuanzhiMao HuanzhiMao left a comment

Choose a reason for hiding this comment

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

LGTM.
According to the Anthropic guide, using prompting caching will not affect the model accuracy.

Prompt caching has no effect on output token generation. The response you receive will be identical to what you would get if prompt caching was not used.

@HuanzhiMao HuanzhiMao merged commit 5a42197 into ShishirPatil:main Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BFCL-General General BFCL Issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants