Courseiva
mediumMultiple Choice

Generative AI Leader Practice Question: A developer is using the Gemini API to classify…

A developer is using the Gemini API to classify customer emails. They want to ensure that the model always returns one of three predefined labels: 'complaint', 'inquiry', or 'feedback'. Which model configuration is MOST appropriate?

⚠ Common exam trap

A common pitfall in the Google Generative AI exam is believing that higher creativity settings (temperature, top-p) are needed for classification tasks, when in fact deterministic settings (temperature 0.0) combined with prompt engineering (few-shot with explicit labels) are the correct approach for strict label constraints.

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

✓

Set temperature to 0.0 and use few-shot examples with required labels in the prompt

Setting temperature to 0.0 makes the model deterministic, minimizing randomness and ensuring consistent output. Combined with few-shot examples that explicitly list the three required labels ('complaint', 'inquiry', 'feedback') in the prompt, this configuration reliably constrains the model to return only those labels, which is the most appropriate approach for a strict classification task.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Set temperature to 1.0 and top-p to 0.9 to allow creativity while constraining via system instructions

    Why it's wrong here

    Temperature 1.0 and top-p 0.9 deliberately preserve randomness, so the model may emit text other than the three permitted labels despite system instructions. It is tempting because these settings suit creative drafting tasks, but deterministic single-label classification needs temperature near zero or constrained decoding to guarantee a valid label.

  • ✗

    Fine-tune the model on a dataset of labeled emails to memorize the three classes

    Why it's wrong here

    Fine-tuning would teach the model to associate email text with the three labels, but it does not constrain the model’s output vocabulary to only those labels; the model could still generate any string, including misspellings or synonyms. This option is tempting because fine-tuning is the standard method for adapting a model to a specific classification task when labelled data is abundant. It would be correct if the goal were to improve accuracy on a broader set of categories without requiring a strict output constraint.

  • ✗

    Use top-k sampling with k=50 and no temperature adjustment

    Why it's wrong here

    Top-k sampling with k=50 still draws randomly from fifty candidate tokens, so output can drift outside the three permitted labels. It is tempting because top-k narrows vocabulary for open-ended generation, but classification into a fixed label set requires constrained decoding or a low-temperature configuration that forces one of the three valid tokens.

  • ✓

    Set temperature to 0.0 and use few-shot examples with required labels in the prompt

    Why this is correct

    Setting temperature to 0.0 makes decoding greedy, so the highest-probability token is always chosen, maximising consistency. Few-shot examples in the prompt demonstrate the exact label set, steering the model to emit only 'complaint', 'inquiry' or 'feedback'. Together they satisfy the constraint of returning one of three predefined labels.

About these practice questions

This Generative AI Leader question is part of Courseiva's 1,008-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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 Generative AI Leader practice question is part of Courseiva's free Google Cloud 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 Generative AI Leader exam.