Controlling GPT-3 with Logit Bias

How AI Dungeon uses logit bias to help control GPT-3.

GPT-3 Tokens

openai.Completion.create(engine=’davinci’, prompt=”q: What is the capital of france?\na:”, logprobs = 5, stop = “\n”, temperature=0)
{
“ France”: -3.9549413,
“ Paris”: -0.88349044,
“ The”: -3.9709404,
“ fr”: -4.021952,
“par”: -2.0355594
}
{
‘ France’: ‘1%’,
‘ Paris’: ‘41%’,
‘ The’: ‘1%’,
‘ fr’: ‘1%’,
‘par’: ‘13%’
}

Logit Bias

openai.Completion.create(engine=’davinci’, prompt=”q: What is the capital of france?\na:”, logprobs = 5, stop = “\n”, temperature=0, logit_bias={6342:-1})
{
“ France”: -3.6606863,
“ Paris”: -1.6055677,
“ The”: -3.6641173,
“ fr”: -3.757301,
“ par”: -1.7221524
}
openai.Completion.create(engine=’davinci’, prompt=”q: What is the capital of france?\na:”, logprobs = 5, stop = “\n”, temperature=0, logit_bias={6342:-10})
openai.Completion.create(engine=’davinci’, prompt=”q: What is the capital of france?\na:”, logprobs = 5, stop = “\n”, temperature=0, logit_bias={6342:-1, 1582:-10})

How We Use Logit Bias to Avoid User Banned Words

Users can add words which they don’t want to appear in their adventures (e.g. the dreaded ‘suddenly’).
openai.Completion.create(engine=’davinci’, prompt=”q: What is the capital of france?\na:”, logprobs = 5, stop = “\n”, temperature=0, logit_bias=banned_word_biases)

Making AI a tool of creativity and freedom for everyone. https://play.aidungeon.io

AI Dungeon’s World of Cthulhu marks the beginning of the future of entertainment.


You can now play AI Dungeon with one of the most powerful AI models in the world.

The first version of AI Dungeon was entertaining in its own wacky way, but it could almost never form a cohesive story.

History


Source: AI Dungeon Classic

Get the Medium app