GENERATIVE-AI-ENGINEER-ASSOCIATE · Question #94
Which of the following is the most effective way to design a prompt that elicits a specific format in the response?
The correct answer is A. Provide clear examples of the desired format. Providing concrete examples of the desired output format (few-shot prompting) is the most reliable technique for constraining an LLM's response structure.
Question
Which of the following is the most effective way to design a prompt that elicits a specific format in the response?
Options
- AProvide clear examples of the desired format
- BUse short and ambiguous instructions
- CAvoid specifying any format in the prompt
- DUse multiple tasks in a single prompt
How the community answered
(36 responses)- A92% (33)
- C6% (2)
- D3% (1)
Why each option
Providing concrete examples of the desired output format (few-shot prompting) is the most reliable technique for constraining an LLM's response structure.
Including explicit examples of the expected format in the prompt leverages few-shot learning - the model infers the pattern from demonstrations and replicates the structure, which is consistently more effective than abstract format instructions alone.
Short and ambiguous instructions give the model insufficient signal about the desired format, resulting in inconsistent or unexpected output structures.
Omitting format specification entirely leaves output structure undefined, forcing the model to choose its own format which will vary across requests.
Combining multiple tasks in a single prompt divides the model's attention, increases the chance of format drift, and makes it harder for the model to apply a consistent structure to each task.
Concept tested: Few-shot prompting for structured output format elicitation
Source: https://www.promptingguide.ai/techniques/fewshot
Topics
Community Discussion
No community discussion yet for this question.