Courseiva

AI-900 Practice Question: Describe features of generative AI workloads on Azure

A developer is using Azure OpenAI Service to generate Python code snippets. They notice that the generated code often contains repetitive function definitions and loops. Which parameter should be increased to reduce this repetition?

⚠ Common exam trap

Microsoft often tests the distinction between parameters that control randomness (temperature, Top P) versus those that control repetition (frequency penalty, presence penalty), leading candidates to mistakenly choose temperature when the issue is repetitive content.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Frequency penalty

The frequency penalty parameter reduces repetition by penalizing tokens that have already appeared in the generated text, making the model less likely to reuse the same functions or loops. Increasing this value directly discourages the model from generating repetitive patterns, which is exactly the issue described.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Temperature

    Why it's wrong here

    Temperature scales the logits before the softmax to control the randomness of token sampling: a lower temperature (e.g., 0.1) makes the distribution more peaked and deterministic, while a higher temperature (e.g., 1.0) increases randomness. However, temperature does not have a memory of which tokens were generated previously; it only reshapes the overall probability distribution over the vocabulary at each step. Therefore, lowering temperature may lead to more conservative outputs but cannot specifically penalize repeated tokens, making it ineffective as a repetition control.

    When this WOULD be correct

    A question asking which parameter to increase to make the model generate more creative or diverse responses, e.g., 'Which parameter should be increased to encourage the model to produce less predictable code?'

  • Max tokens

    Why it's wrong here

    Max tokens (max_tokens) caps the upper bound of tokens the model can generate in a single completion, effectively limiting response length. It does not alter the token selection probability distribution; even with a large max_tokens, the model may still repeat phrases indefinitely if other parameters favor that behavior. Thus, while it prevents excessively long outputs, it has no impact on the tendency to produce repeated code patterns.

    When this WOULD be correct

    A question asks: 'Which parameter should be increased to allow the model to generate a longer response, such as a complete essay or a full code file?'

  • Frequency penalty

    Why this is correct

    The frequency penalty is a sampling parameter in Azure OpenAI that reduces the likelihood of repeating tokens that have already appeared frequently in the generated sequence. It works by subtracting a value proportional to the token's cumulative frequency from its logit score before sampling, thereby actively discouraging repetitive patterns. A higher penalty (e.g., from 0 to 2) forces the model to choose more diverse vocabulary, which directly addresses the repetition problem in code snippet generation.

  • Top P

    Why it's wrong here

    Top P (nucleus sampling) restricts the candidate token pool to the smallest set whose cumulative probability exceeds the specified threshold (e.g., 0.95). This influences output diversity by cutting off the long tail of low-probability tokens, but it does not apply any explicit penalty to tokens that have already occurred. Because repetition is driven by high probability assigned to recently generated tokens, Top P alone cannot suppress recurrence without modifying the underlying token probabilities.

    When this WOULD be correct

    In a scenario where the question asks which parameter to adjust to make the generated text more focused and less random, such as 'Which parameter should be decreased to produce more deterministic and less diverse outputs?', then Top P would be correct if decreased.

Option-by-option analysis

Why each answer is right or wrong

Understanding why wrong answers are wrong — and when they would be correct — is what separates a 750 score from a 900. The AI-900 exam frequently reuses these exact scenarios with slightly different constraints.

Frequency penaltyCorrect answer

Why this is correct

The frequency penalty is a sampling parameter in Azure OpenAI that reduces the likelihood of repeating tokens that have already appeared frequently in the generated sequence. It works by subtracting a value proportional to the token's cumulative frequency from its logit score before sampling, thereby actively discouraging repetitive patterns. A higher penalty (e.g., from 0 to 2) forces the model to choose more diverse vocabulary, which directly addresses the repetition problem in code snippet generation.

TemperatureWrong answer — click to see why

Why this is wrong here

Increasing temperature makes output more random, which could introduce more repetition or variation, not reduce it. Repetition is controlled by frequency penalty, which penalizes tokens that have already appeared.

★ When this WOULD be the correct answer

A question asking which parameter to increase to make the model generate more creative or diverse responses, e.g., 'Which parameter should be increased to encourage the model to produce less predictable code?'

Why candidates choose this

Candidates may confuse temperature with frequency penalty, thinking that higher randomness (temperature) will break repetitive patterns, but it actually increases the chance of random repetitions.

Max tokensWrong answer — click to see why

Why this is wrong here

Increasing max tokens allows longer output but does not reduce repetition; it may even increase repetition by giving the model more space to generate redundant content.

★ When this WOULD be the correct answer

A question asks: 'Which parameter should be increased to allow the model to generate a longer response, such as a complete essay or a full code file?'

Why candidates choose this

Candidates may think that limiting output length causes repetition, so increasing max tokens would give the model room to avoid repeating itself, but repetition is controlled by penalty parameters, not length.

Top PWrong answer — click to see why

Why this is wrong here

Top P controls the cumulative probability of token selection, affecting diversity but not directly penalizing repetition. Increasing Top P would not specifically reduce repetitive patterns like repeated function definitions or loops.

★ When this WOULD be the correct answer

In a scenario where the question asks which parameter to adjust to make the generated text more focused and less random, such as 'Which parameter should be decreased to produce more deterministic and less diverse outputs?', then Top P would be correct if decreased.

Why candidates choose this

Candidates may confuse Top P with frequency penalty because both influence output diversity, but Top P affects the nucleus sampling threshold rather than directly penalizing repeated tokens.

Analysis generated from the official AI-900blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”

About these practice questions

Courseiva writes every AI-900 question from scratch — 985 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AI-900 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AI-900 exam.