nerdexam
Amazon

AIF-C01 · Question #113

Which prompting technique can protect against prompt injection attacks?

The correct answer is A. Adversarial prompting. Adversarial prompting is a defense strategy that involves adding specific instructions or warnings to a system prompt to make an LLM more resilient to prompt injection attacks.

Submitted by lukas.cz· Mar 30, 2026Responsible AI and Security

Question

Which prompting technique can protect against prompt injection attacks?

Options

  • AAdversarial prompting
  • BZero-shot prompting
  • CLeast-to-most prompting
  • DChain-of-thought prompting

How the community answered

(33 responses)
  • A
    91% (30)
  • C
    3% (1)
  • D
    6% (2)

Why each option

Adversarial prompting is a defense strategy that involves adding specific instructions or warnings to a system prompt to make an LLM more resilient to prompt injection attacks.

AAdversarial promptingCorrect

Adversarial prompting, or defensive prompting, involves designing system prompts with explicit instructions and warnings to the LLM about potential prompt injection attempts, thereby training it to identify and resist malicious or conflicting user inputs. This technique aims to fortify the model's adherence to its original directives.

BZero-shot prompting

Zero-shot prompting is a technique where an LLM performs a task without any examples in the prompt, relying solely on its pre-trained knowledge, and does not inherently protect against prompt injection.

CLeast-to-most prompting

Least-to-most prompting is a strategy for complex tasks where the model breaks down the problem into sub-problems and solves them sequentially, which is not a defense against prompt injection.

DChain-of-thought prompting

Chain-of-thought prompting involves guiding the model to generate a series of intermediate reasoning steps to arrive at a final answer, which enhances reasoning but not necessarily prompt injection defenses.

Concept tested: LLM security defenses, adversarial prompting

Source: https://docs.aws.amazon.com/whitepapers/latest/generative-ai-security/prompt-injection.html

Topics

#Prompt injection#AI security#Adversarial prompting#Generative AI

Community Discussion

No community discussion yet for this question.

Full AIF-C01 Practice