Logit BIAs, increase the odds of a word appearing

Hello :slight_smile: I’ve read the article “Using logit bias to define token probability | OpenAI Help Center” and have a few questions regarding the use case " Increase the odds of a word appearing"
I would like to write a text with the occurrence of several words, for example (cat, dogs, horse). When I put the words directly in the prompt like this: “Write a text with the words cat, dog, horse” it works just fine, but when I want to fine tune the likelihood using the token ids it doesn’t work. Furthermore, the given example in the support article includes just one ID for a word, in my use cases (mostly german language) a word consists of several token IDs. Here is my example in JSON:
{
“model”: “text-davinci-003”,
“prompt”: “Write a text”,
“max_tokens”: 700,
“temperature”: 0,
“frequency_penalty”:0,
“logit_bias”:{“67”:20,“2023”:20,“9038”:20, “198”:50},
“presence_penalty”:0,
“top_p”: 1
}
Does someone have a best practice example, how to include logit_bias? :grinning: Paula

1 Like