QuestionQ39

Application Development

A Generative AI Engineer uses an LLM to classify species of edible mushrooms from text descriptions of particular features. The model produces accurate test responses, and the Generative AI Engineer is confident they have the correct list of possible labels, but its output often includes extra reasoning when they want to return only the label and no additional text.

What action should they take to elicit the desired behavior from this LLM?

  • A Use few shot prompting to instruct the model on expected output format
  • B Use zero shot prompting to instruct the model on expected output format
  • C Use zero shot chain-of-thought prompting to prevent a verbose output format
  • D Use a system prompt to instruct the model to be succinct in its answer
Explanation

Few-shot prompting provides example input-output pairs that demonstrate the exact desired response pattern. Showing mushroom descriptions paired with label-only outputs steers the model to return only a valid label, without explanatory text. Google Cloud documents few-shot examples as a way to guide specific output formats and styles.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!