Does presence/frequncy penalty 'look at' the prompt/context, or just the tokens in the completion?

Let’s say my prompt/message to 3.5 turbo is:

My favorite color is red. What is yours? Start your reply with “My favorite color is…”

Will the response be less likely to choose red since my prompt contains that? Or does the penalty on “red” only kick in once the model has itself generated the word/token “red”?

I suspect it only looks at completion tokens, but hoping that I’m wrong (since with chat models, you are going back and forth, so most of the model’s tokens end up being in the context).

2 Likes