Microsoft Certified: Azure AI Engineer AssociateImplement generative AI solutionsEasy
A data science team is developing an Azure OpenAI Service application that generates marketing copy. They observe that the generated text often repeats certain phrases or ideas too frequently, making the output less diverse and engaging. Which Azure OpenAI Service parameter should they adjust to mitigate this issue?
- AMax_tokens
- BTemperature
- CTop_p
- DPresence Penalty
Show answer & explanationAnswer & explanation
Correct answer: D. Presence Penalty
Presence Penalty discourages the model from repeating tokens that have already appeared in the text, promoting more diverse output. Increasing its value would reduce the frequency of repeated phrases.
Why the other options are wrong
- A. Max_tokens limits the length of the generated output, not its diversity or tendency to repeat.
- B. Temperature controls the randomness of the output; higher values make it more random, but don't directly prevent repetition of existing tokens.
- C. Top_p (nucleus sampling) controls the diversity by considering a subset of tokens with a cumulative probability, but doesn't specifically penalize existing tokens.
Presence Penalty
A parameter in Azure OpenAI Service that penalizes new tokens based on whether they appear in the text so far, reducing repetition.
- Discourages the model from repeating words/phrases.
- Higher values lead to more diverse, less repetitive text.
- Applied after frequency penalty.
Memory trick: TRP: To Really Produce diverse text, adjust your parameters.