Generative AI Leader Google Cloud Practice Test

Session length

1 / 20

Which sampling parameter allows controlling the token selection based on cumulative probability?

Top-k sampling

Top-p sampling

Top-p sampling, also known as nucleus sampling, is a method that enables the selection of tokens based on their cumulative probability distribution. In this approach, instead of considering a fixed number of top tokens like in top-k sampling, top-p sampling focuses on a dynamic set of tokens that collectively account for a certain threshold of probability, denoted as 'p'.

When generating text, the algorithm sorts all possible tokens by their probability and then selects the smallest subset of tokens whose cumulative probability meets or exceeds the specified threshold. This ensures that the generated text remains coherent and realistic while allowing for diversity. By adjusting the 'p' value, users can control the trade-off between creativity and reliability. A lower p value may lead to less randomness and more focused text generation, while a higher p value can introduce more variability and potentially creative outputs.

In contrast, top-k sampling limits the selection to a fixed number of tokens regardless of their cumulative probability, while random sampling does not consider probabilities at all, making it less effective in generating contextually meaningful text. Temperature sampling affects the probability distribution itself but does not directly manage token selection based on cumulative probability. Thus, top-p sampling is the most effective method for controlling token selection with respect to their cumulative probability.

Random sampling

Temperature sampling

Next question

Find the option that is right for you!

All options are one-time payments.

$25.99

30 day premium pass

All the basics to get you started

  • Ad-free experience
  • View your previous attempt history
  • Mobile app access
  • In-depth explanations
  • 30 day premium pass access
👑$59.99 $171.99 usd

6 month DELUXE pass (most popular)

Everything with the 30 day premium pass FOR 6 MONTHS! & the ultimate digital PDF study guide (BONUS)

  • Everything included in the premium pass
  • $171.99 usd value for $59.99! You save $106!
  • + Access to the ultimate digital PDF study guide
  • + 6 months of premium pass access
  • + Priority support
$15.99 $24.99

Ultimate digital PDF study guide

For those that prefer a more traditional form of learning

  • Available for instant download
  • Available offline
  • Hundreds of practice multiple choice questions
  • Comprehensive content
  • Detailed explanations
Image Description
Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy