Which prompt engineering strategy enables sentiment analysis on Amazon Bedrock?

Prompt Engineering

A company wants to use a large language model (LLM) on Amazon Bedrock for sentiment analysis. The company wants to classify the sentiment of text passages as positive or negative. Which prompt engineering strategy meets these requirements?

  1. Provide examples of text passages with corresponding positive or negative labels in the prompt followed by the new text passage to be classified. Source Reference Answer
  2. Provide a detailed explanation of sentiment analysis and how LLMs work in the prompt.
  3. Provide the new text passage to be classified without any additional context or examples.
  4. Provide the new text passage with a few examples of unrelated tasks, such as text summarization or question answering.

Community Votes

A
100%

100% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

The exam tests your understanding of few-shot prompting versus zero-shot prompting; the common trap is assuming that a detailed explanation of the task (option B) or simply providing raw text (option C) is sufficient without demonstrating the expected input-output pattern.

Few-shot prompting is the recommended strategy for sentiment analysis on Amazon Bedrock because providing labeled examples of positive and negative text passages helps the LLM understand the classification pattern. Community consensus confirms that few-shot learning significantly improves accuracy by guiding the model with clear context before presenting the new input.

Option C is a common wrong answer because candidates assume the LLM inherently understands sentiment analysis without needing explicit examples, overlooking that zero-shot prompting often yields inconsistent results compared to few-shot prompting.

Community Discussion (6 comments)

Johnny0107 👍 2 Selected: A
This approach is known as few-shot prompting, where you include a few labeled examples to guide the model on how to classify sentiment.
Jessiii 👍 1 Selected: A
Provide 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.
85b5b55 👍 1 Selected: A
Set the proper label with a few examples to the prompts
Moon 👍 4 Selected: A
A: 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.
Gianiluca 👍 1 Selected: A
This 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.
jove 👍 4 Selected: A
Explanation: 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

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

Option A demonstrates few-shot prompting, a proven technique where labeled examples are included in the prompt to guide the LLM's output format and reasoning. By showing text passages paired with positive or negative labels, the model learns the exact classification pattern expected. This approach is explicitly recommended in AWS documentation for improving accuracy on classification tasks using Amazon Bedrock.

Why the Other Options Are Wrong

Option B provides theoretical context but no practical examples, leaving the model without a clear demonstration of the desired input-output mapping. Option C relies on zero-shot prompting, which may produce inconsistent or incorrectly formatted responses since the model lacks explicit guidance. Option D introduces unrelated task examples, which confuse the model by providing irrelevant patterns that do not align with sentiment classification.

Community Comment Notes

Community members unanimously support option A, with multiple comments highlighting that few-shot prompting is the most effective strategy for guiding LLMs on classification tasks. Commenters emphasize that providing labeled examples helps the model understand both the task context and the expected output format, reducing ambiguity and improving reliability.

Official Reference

Exam Strategy

When evaluating prompt engineering strategies, always prioritize approaches that provide concrete examples of the expected input-output pattern. Few-shot prompting consistently outperforms zero-shot or overly verbose explanations for classification tasks on AWS certification exams.

Related Analysis

Practice All AIF-C01 Questions

Access 100 questions with complete answers and detailed explanations.

View Full AIF-C01 Practice Test →

← Back to AIF-C01 Study Guide