Microsoft Certified: Azure AI Engineer AssociateImplement generative AI solutionsEasy

A data scientist is using Azure OpenAI Service to generate marketing copy. They notice that the generated text often repeats the same phrases or ideas, even when the `temperature` parameter is set to a moderate value. Which parameter should the data scientist adjust to reduce the likelihood of the model repeating itself without significantly altering the creativity of the output?

  1. Afrequency_penalty
  2. Bn
  3. Cpresence_penalty
  4. Dtop_p
Show answer & explanation

Correct answer: A. frequency_penalty

The frequency_penalty parameter directly addresses the issue of repetitive phrases by reducing the likelihood of tokens that have already appeared in the text being generated again. This helps in producing more diverse and less repetitive output.

Why the other options are wrong

  • B. N specifies the number of completions to generate, not how repetitive each completion is.
  • C. Presence penalty reduces the likelihood of new tokens based on whether they are present in the text, not how frequently they appear.
  • D. Top_p is a sampling parameter that controls diversity by considering a cumulative probability of tokens, but doesn't specifically target repetition of phrases.

Frequency Penalty

A parameter in Azure OpenAI Service that penalizes new tokens based on their existing frequency in the text, reducing repetition.

  • Discourages the model from repeating the same words or phrases.
  • Applied after token selection, influencing future token probabilities.
  • Higher values lead to less repetition.

Memory trick: Parameters manage output quality, especially when avoiding repetitive echoes.

More Implement generative AI solutions questions