GCP Generative AI Leader Practice Question 48: Top p Nucleus Sampling

Google Cloud Generative AI Leader · Test 5 · question 8 of 10

Techniques to Improve Model Outputhard

A product team is tuning a model that drafts short marketing taglines. At each step, the model ranks every possible next word by probability, then keeps adding words from most probable to least probable only until the running total of their probabilities reaches a chosen threshold. The final word is then sampled from that shortened, dynamically sized list rather than from the model's entire vocabulary.

Which output parameter controls this behavior?

Select one answer
Show answer and explanation

Answer:

  • C. Top-p, which keeps the smallest set of highest-probability tokens whose combined probability reaches the chosen threshold

Top-p, also called nucleus sampling, builds its candidate list dynamically: it adds tokens from most probable to least probable until their combined probability reaches the top-p value, then samples the next token only from that set. The size of the candidate set changes from step to step depending on how confident the model's probability distribution is, which is exactly the behavior described.

Option A is wrong because temperature reshapes the probability distribution itself (making it flatter or sharper) rather than cutting the candidate list off at a cumulative probability threshold. Option B is wrong because top-k keeps a fixed count of the highest-probability tokens no matter how much total probability they add up to, while the scenario describes a threshold on the running total, not a fixed count. Option D is wrong because max output tokens limits the overall length of the response and has nothing to do with how an individual token is chosen.

Reference: Content generation parameters

Practice Test 5 ›

Study guides for Google Cloud Generative AI Leader

Free AI certifications in 2026: what's really $0Which free AI certifications are real exams, which are badges, and which are course certificates: Oracle, Microsoft, Google, AWS, Claude and more.
Google Cloud roadmap: GCP zero to hero in 10 stagesA Google Cloud roadmap from zero to hero: 10 stages, 84 topics in learning order, free-tier labs, exam traps and which certification fits each stage.
Google Cloud Digital Leader exam: what's on it, who it's forGoogle Cloud Digital Leader: August 2026 exam update, six sections, US$99 price as of November 2026, renewal, study plan and ACE comparison.
Agentic AI certification: Oracle, Google, GitHub, NVIDIAAgentic AI certifications in 2026: Oracle's free exam, GitHub GH-600, Google, NVIDIA and Claude, compared by status, price and role.
Google Cloud Generative AI Leader vs AWS AI PractitionerGoogle Cloud Generative AI Leader vs AWS AI Practitioner: format, cost, topics, free preparation and which certification to take first.
Best AI certifications 2026: AWS, Google, Microsoft, ClaudeThe best AI certifications in 2026 from AWS, Google, Microsoft, Claude and Databricks, by level, with price, status and which one to take first.
Google Cloud certification path: is ACE worth it?Is Google's Associate Cloud Engineer certification worth it? The Google Cloud certification path in 2026, with cost, format and which exam to take first.
Google Professional Agentic Architect: what it isGoogle's Professional Agentic Architect certification explained - beta status, the two-part exam, the five domains, price, validity and how to prepare.
What Is RAG? How Retrieval-Augmented Generation WorksWhat RAG is and how it works: chunking, embeddings, vector search, hybrid search, reranking, GraphRAG and agentic RAG on AWS, Google and Azure.
Google Cloud's generative AI offerings, mappedGemini app, Gemini for Workspace, Gemini Enterprise, Agent Search, the contact center suite and Agent Platform: which one a business should pick, and why.
Prompt engineering vs RAG vs fine-tuningWhen to use prompt engineering, retrieval-augmented generation, fine-tuning or continued pre-training, compared on cost, freshness, hallucination and privacy.