Generative AI Leader Practice Question: Techniques to Improve Generative AI Model Output
A company uses Vertex AI PaLM for code generation. The code often contains security vulnerabilities. Which improvement should be applied?
⚠ Common exam trap
Google often tests the misconception that parameter tuning (like temperature or top_k) can fix content quality issues, when in fact prompt engineering—such as system instructions—is the primary tool for guiding model behavior toward specific goals like security.
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
✓
Include a security-focused system instruction
Including a security-focused system instruction directly guides the model to prioritize secure coding practices, such as input validation and proper error handling, reducing vulnerabilities. This leverages prompt engineering to shape model behavior without altering parameters like temperature or top_k, which control randomness, not security awareness.
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 top_k to 1
Why it's wrong here
Setting top_k to 1 narrows token sampling but does not inject security constraints, so insecure patterns persist in the model's output. Greedy decoding suits tasks needing deterministic phrasing, not code whose vulnerabilities require prompt-level security guidance and review.
- ✓
Include a security-focused system instruction
Why this is correct
A security-focused system instruction sets persistent behavioural guardrails, steering the model to avoid insecure patterns such as unsanitised input handling across every generation. This directly targets the vulnerability constraint; prompt-level or post-hoc scanning alone cannot shape generation as reliably.
- ✗
Use Codey model instead
Why it's wrong here
Codey is a code-completion model, not a security-hardened generator; swapping models does not address insecure output, which stems from prompt design and lack of validation. Codey suits autocomplete and code chat tasks, not remediating vulnerability-prone generation.
- ✗
Increase temperature to 0.8
Why it's wrong here
Raising temperature increases sampling randomness, producing more varied but not more secure code; it cannot inject secure-coding constraints. Temperature tuning suits creative or diverse generation tasks, not vulnerability remediation. Lowering temperature or adding security-focused prompting and review is what reduces insecure patterns.
Go deeper
Related to this question
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 →
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.