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

Support for frequency_penalty #275

Closed
richardliaw opened this issue Nov 3, 2023 · 4 comments
Closed

Support for frequency_penalty #275

richardliaw opened this issue Nov 3, 2023 · 4 comments
Assignees
Labels
feature request New feature or request sampling triaged Issue has been triaged by maintainers

Comments

@richardliaw
Copy link

Frequency Penalty is between -2.0 and 2.0 and it impacts how the model penalizes new tokens based on their existing frequency in the text.

Positive values will decrease the likelihood of the model repeating the same line verbatim by penalizing new tokens that have already been used frequently.

This parameter is important for OpenAI compatibility, which is a growing standard for LLM usage.

cc @Yard1 @akshay-anyscale

@juney-nvidia
Copy link
Collaborator

juney-nvidia commented Nov 4, 2023

@richardliaw

Thanks for reporting this. Can you elaborate a little bit more about the difference between the already supported repetiton_penalty and frequency_penalty here?

Thanks
June

@juney-nvidia juney-nvidia self-assigned this Nov 4, 2023
@juney-nvidia juney-nvidia added the triaged Issue has been triaged by maintainers label Nov 4, 2023
@richardliaw
Copy link
Author

Frequency penalty has a specific implementation here: https://platform.openai.com/docs/guides/gpt/parameter-details.

vLLM treats the two differently (repetition_penalty is multiplicative with the logits, whereas frequency penalty is additive): https://github.com/vllm-project/vllm/blob/9f669a9a7c2b2d0a7963a6e29253280e57680adb/vllm/model_executor/layers/sampler.py#L233-L236

@juney-nvidia juney-nvidia added feature request New feature or request sampling labels Nov 5, 2023
@juney-nvidia
Copy link
Collaborator

Thanks for sharing this, this issue relates to the other one, both regarding to the control of sampling/decoder process. We will follow up and reply later.

June

@kaiyux
Copy link
Member

kaiyux commented Dec 27, 2023

The support should be included in the latest main branch, please see #754.

Closing. Please feel free to comment if you have any question, thanks!

@kaiyux kaiyux closed this as completed Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request sampling triaged Issue has been triaged by maintainers
Projects
None yet
Development

No branches or pull requests

3 participants