Few-Shot Prompting for Sentiment Analysis on Amazon Bedrock
Short answer
A Provide examples of text passages with corresponding positive or negative labels in the prompt followed by the new text passage to be classified.
Question
Which prompt engineering strategy meets these requirements?
Key Takeaways
Few-shot prompting improves LLM accuracy by providing concrete examples of desired input-output pairs, guiding the model's behavior more effectively than zero-shot or irrelevant context.
Learn why few-shot prompting is the optimal strategy for sentiment analysis using large language models on Amazon Bedrock, ensuring accurate classification through labeled examples.
Common mistake: Choosing Option C (Zero-shot) because it seems simpler; however, without examples, the model may struggle with consistent classification boundaries compared to the guided approach of few-shot prompting.
Expert Analysis
The question asks for the prompt engineering strategy that meets the requirement of classifying sentiment using an LLM on Amazon Bedrock. The key constraint is the need for accurate classification of positive or negative sentiments.
Option A suggests providing examples of text passages with corresponding labels (few-shot prompting). Few-shot learning provides context and patterns, significantly improving model performance on specific tasks like sentiment analysis by demonstrating the expected input-output format and logic. This aligns with best practices for foundation models where explicit instructions alone may be insufficient for nuanced tasks.
Option B involves providing a detailed explanation of how LLMs work. This is irrelevant to the task of sentiment classification and wastes token context without guiding the model's output format or logic for this specific use case.
Option C suggests providing only the text passage without context (zero-shot prompting). While zero-shot can work for simple tasks, it often yields less consistent results than few-shot for specific classification boundaries, especially when precise labeling is required. It lacks the guidance provided by examples.
Option D includes examples of unrelated tasks. This introduces noise and confusion, potentially leading the model to prioritize the unrelated task patterns over the sentiment analysis goal, thereby degrading performance.
Therefore, Option A is the correct strategy as it leverages few-shot prompting to guide the model effectively.
Official Reference
https://docs.aws.amazon.com/bedrock/latest/userguide/prompting.html
This link opens the official vendor documentation in a new tab.
Exam Strategy
When asked about prompt engineering strategies for specific tasks, look for options that provide context or examples. Few-shot prompting is generally superior to zero-shot for complex or nuanced tasks because it reduces ambiguity. Avoid options that introduce irrelevant information or lack sufficient guidance.
Frequently Asked Questions
What is few-shot prompting?
Why not use zero-shot prompting for sentiment analysis?
Community Votes
100% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 8 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 8
-
Moon 👍 5 Answered AA: Provide examples of text passages with corresponding positive or negative labels in the prompt followed by the new text passage to be classified. Explanation: This strategy is known as few-shot prompting, where the prompt includes a few examples of labeled data (text passages with positive or negative sentiment) before asking the model to classify the new text passage. This helps the large language model (LLM) understand the task and align its output with the desired format. Why not the other options? B: Provide a detailed explanation of sentiment analysis and how LLMs work in the prompt: Explaining the concept of sentiment analysis is unnecessary for the model, as it does not improve the model's ability to classify text. C: Provide the new text passage to be classified without any additional context or examples: Without examples, the LLM might not correctly infer the task or format of the output, leading to inconsistent or incorrect results.
-
Jessiii 👍 4 Answered AProvide examples of text passages with corresponding positive or negative labels in the prompt followed by the new text passage to be classified: This approach uses few-shot learning, where you give the model clear examples of text passages labeled with sentiment (positive or negative). By providing these examples in the prompt, the model is better able to understand the task and generalize it to classify the new text passage correctly. This is a common and effective strategy for tasks like sentiment analysis.
-
jove 👍 4 Answered AExplanation: By providing examples of text passages along with their corresponding sentiment labels (positive or negative), the model can learn from these examples how to classify the sentiment of the new text passage effectively
-
Johnny0107 👍 2 Answered AThis approach is known as few-shot prompting, where you include a few labeled examples to guide the model on how to classify sentiment.
-
65703c1 👍 2 Answered AA is the correct answer
Show 3 more comments
-
Gianiluca 👍 1 Answered AThis approach uses few-shot learning, which is highly effective with large language models. By providing examples of text passages with their corresponding sentiment classifications, the LLM learns the context and pattern needed to classify the new passage.
-
85b5b55 👍 1 Answered ASet the proper label with a few examples to the prompts
-
VIJAY K T 👍 1 Answered AA is correct
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All AIF-C01 Questions
Access 100 questions with complete answers and detailed explanations.
View Full AIF-C01 Practice Test →