Q54 — AWS AIF-C01 Ch.2

Question 54 of 100 | ← Chapter 2

A company wants to use a large language model (LLM) to develop a conversational AI agent. It needs to prevent the LLM from being manipulated by common prompt injection techniques, which could cause undesirable behavior or leakage of sensitive information. What action can reduce these risks?

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

Explanation

Creating a prompt template to train the LLM to detect attack patterns is the most effective mitigation. Such templates enable the model to recognize adversarial prompts during training or inference—enhancing robustness against prompt injection. Increasing temperature increases randomness and harms reliability. Restricting LLM selection doesn’t inherently improve security. Reducing input tokens may truncate context but does not address prompt injection. Therefore, option A directly targets and reduces the specified risks.