Courseiva

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

Exhibit

User: Translate the following sentence to French: Hello, how are you?
Model: Bonjour, comment vas-tu?
Expected: Bonjour, comment allez-vous? (formal)

Refer to the exhibit. A user wants formal translations from a generative AI model, but the model outputs informal style inconsistently. Which prompt engineering technique would best ensure consistent formal translations?

⚠ Common exam trap

Many candidates confuse decoding parameters (top_k, temperature) or prompt length with actual style control — candidates assume 'more rules' or 'deterministic sampling' fixes tone, when only concrete demonstrations reliably steer style.

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

✓

Provide a few-shot example with formal and informal pairs

Few-shot prompting provides the model with concrete input/output examples that demonstrate the desired style, which is far more effective at controlling tone and register than abstract instructions. By including formal and informal pairs, the model can infer the transformation pattern and apply it consistently to new translations. This anchors the model's behavior through in-context learning rather than relying on the model to interpret vague stylistic rules.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Use context caching

    Why it's wrong here

    Context caching reuses previously processed prompt prefixes to cut cost and latency; it does not steer output style. It is tempting because caching improves efficiency on repeated inputs, but consistent formality requires explicit style instructions or few-shot examples in the prompt.

  • ✓

    Provide a few-shot example with formal and informal pairs

    Why this is correct

    Few-shot prompting supplies paired formal and informal examples, letting the model infer the required register from demonstrated patterns rather than vague instructions. This constrains output style consistently, satisfying the requirement for reliably formal translations across varied inputs.

  • ✗

    Use a longer system prompt with detailed rules

    Why it's wrong here

    A longer system prompt with detailed rules still relies on the model following instructions probabilistically, so informal phrasing can persist; the stem asks for a technique guaranteeing consistency. It is tempting because detailed system prompts genuinely suit shaping tone and constraints in open-ended generation, where some drift is tolerable.

  • ✗

    Set top_k to 1

    Why it's wrong here

    Setting top_k to 1 forces greedy decoding, always picking the single highest-probability token; this maximises determinism but cannot impose a formal register, since style is governed by the prompt, not sampling breadth. It is tempting because low top_k genuinely suits tasks needing reproducible, near-identical outputs, such as structured data extraction.

About these practice questions

One of 1,008 original Generative AI Leader practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Google Cloud exam blueprint

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.