Microsoft Certified: Azure AI Engineer AssociateImplement generative AI solutionsMedium
An AI engineer is developing an application that uses Azure OpenAI Service to generate marketing copy. The application needs to dynamically adjust the creativity and randomness of the generated text based on user preferences. Which parameter in the Azure OpenAI API should the engineer primarily adjust to control this aspect of the output?
- Afrequency_penalty
- Bmax_tokens
- Ctop_p
- Dtemperature
Show answer & explanationAnswer & explanation
Correct answer: D. temperature
The 'temperature' parameter directly controls the randomness of the output. A higher temperature (e.g., 0.7-1.0) makes the output more creative and diverse, while a lower temperature (e.g., 0.2-0.5) makes it more deterministic and focused.
Why the other options are wrong
- A. frequency_penalty reduces the likelihood of repeating tokens, which affects originality but not the overall randomness or creativity as directly as temperature.
- B. max_tokens limits the length of the generated output, not its creativity or randomness.
- C. top_p controls the diversity of the output by sampling from a cumulative probability distribution, which is related but less direct than temperature for general 'creativity/randomness'.
Azure OpenAI Temperature Parameter
The 'temperature' parameter in Azure OpenAI Service controls the randomness and creativity of the generated text. A higher value leads to more diverse and surprising outputs, while a lower value results in more deterministic and focused outputs.
- Ranges typically from 0 to 2.
- Higher values (e.g., 0.7-1.0) increase creativity.
- Lower values (e.g., 0.2-0.5) increase determinism and focus.
Memory trick: Temperature 'heats up' or 'cools down' the AI's creativity.