Microsoft Certified: Azure AI Engineer AssociateImplement generative AI solutionsMedium
A developer is building a system that uses Azure OpenAI to generate personalized email responses. To prevent the AI from generating repetitive phrases or overusing certain words, which parameter should be adjusted to encourage more diverse vocabulary in the output?
- Apresence_penalty
- Bmax_tokens
- Ctemperature
- Dfrequency_penalty
Show answer & explanationAnswer & explanation
Correct answer: D. frequency_penalty
The `frequency_penalty` parameter directly penalizes new tokens based on their existing frequency in the text so far. Increasing this value makes the model less likely to repeat the same words or phrases, thus encouraging a more diverse vocabulary.
Why the other options are wrong
- A. Presence_penalty discourages the model from talking about existing topics, which is different from avoiding word repetition.
- B. Max_tokens controls output length, not word diversity.
- C. Temperature affects overall randomness, but `frequency_penalty` specifically targets repetition.
Azure OpenAI Frequency Penalty
A parameter in Azure OpenAI Service that penalizes new tokens based on their frequency in the generated text so far, reducing the likelihood of the model repeating the same words or phrases.
- Values typically range from -2.0 to 2.0.
- Positive values discourage repetition.
- Helps generate more diverse and original text.
Memory trick: Frequency Penalty 'punishes' boring repetition, sparking new words.