Q24 — AWS AIF-C01 Ch.1

Question 24 of 100 | ← Chapter 1

A company wants to use a large language model (LLM) to develop custom code. It needs to prevent the LLM from being manipulated by common prompt engineering techniques to perform harmful actions or expose sensitive information. Which action reduces these risks?

Correct Answer: A. Create a prompt template that teaches the LLM to detect attack patterns.

Explanation

This question tests understanding of LLM security best practices. Prompt injection attacks exploit LLMs’ reliance on instructions in prompts. Teaching the model—via robust prompt engineering, system-level instructions, or guardrails—to recognize and reject adversarial prompts is a key mitigation. Option A describes such a proactive defense: embedding detection logic into the prompt design. Temperature (B) controls output randomness—not security. Restricting LLM selection (C) improves trust but doesn’t prevent prompt manipulation. Reducing input tokens (D) may limit context but weakens functionality and doesn’t address prompt injection. Thus, option A is the most effective risk-reduction action.