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

Usage examples for --logit-bias #13

Open
davidrpugh opened this issue Oct 16, 2024 · 0 comments
Open

Usage examples for --logit-bias #13

davidrpugh opened this issue Oct 16, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@davidrpugh
Copy link
Member

The logit bias option allows you to manually adjust the likelihood of specific tokens appearing in the generated text. By providing a token ID and a positive or negative bias value, you can increase or decrease the probability of that token being generated.

For example, when using the Gemma family of models, use --logit-bias 4521+1 to increase the likelihood of the token 'Hello', or --logit-bias 4521-1 to decrease its likelihood. Using a value of negative infinity, --logit-bias 15043-inf ensures that the token Hello is never produced. A more practical use case might be to prevent the generation of \code{begin} and \code{end} by setting the \ token (235286) to negative infinity with -l 29905-inf.

These usage examples depend on the tokenizer used by the model. The tokenizer-playground space on HF is an easy way to get token ids for commonly used tokenizers.

@davidrpugh davidrpugh added the enhancement New feature or request label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant