Courseiva

Generative AI Leader Practice Question: Techniques to Improve Generative AI Model Output

An e-commerce company fine-tunes a model on customer reviews to generate product feedback summaries. They want to ensure the model does not reproduce toxic language from the training data. Besides filtering the training data, which additional technique is most effective at inference time?

⚠ Common exam trap

Google often tests the misconception that controlling randomness (temperature, top-k) or search strategy (beam search) can prevent toxic outputs, when in fact these techniques only affect token probability distributions and do not perform any semantic safety filtering.

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

✓

Pass the model output through a toxicity detection model and conditionally regenerate or block

It directly addresses the safety requirement at inference time by introducing a secondary guardrail. A toxicity detection model (e.g., a classifier trained on the Jigsaw Toxic Comment dataset) can score the generated output in real time; if the score exceeds a threshold, the system can either block the response or trigger a regeneration with adjusted parameters. This is the only technique that actively filters for toxic language after generation, rather than merely reducing output variance or exploring alternative sequences.

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 0.0 to reduce variance

    Why it's wrong here

    Temperature 0.0 makes decoding deterministic, selecting the highest-probability token; it does not suppress toxic tokens, which requires decoding-time constraints such as a safety filter or logit bias. It tempts because low temperature is a real variance-reduction technique, but toxicity is a content issue, not a randomness one.

  • ✗

    Set top-k to 10 to limit token choices

    Why it's wrong here

    Top-k only truncates the candidate pool to the k most probable tokens; it applies no toxicity classifier or penalty, so a toxic token ranked first is still emitted. It is tempting because top-k genuinely controls output diversity and repetition, and would be the right lever when the goal is coherent, focused generation rather than safety filtering.

  • ✓

    Pass the model output through a toxicity detection model and conditionally regenerate or block

    Why this is correct

    Filtering training data alone cannot guarantee toxic-free output, so a post-generation toxicity classifier screens each summary and triggers regeneration or blocking when thresholds are breached. This directly satisfies the inference-time constraint, catching residual toxicity the fine-tuning absorbed. It operates on the model's actual output rather than inputs, making it the most reliable safeguard.

  • ✗

    Use beam search with a high beam width

    Why it's wrong here

    Beam search explores several candidate sequences in parallel and selects the highest cumulative-probability one, which can entrench fluent toxic phrasing rather than suppress it. It is tempting because beam search genuinely improves translation and summarisation quality, and would be the right choice when accuracy of long-form output matters more than safety.

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.