Bitzu

AIF-C01 ยท Prompt engineering

Prompt best practices and risks

Specificity, concision, experimentation and guardrails, versus prompt exposure, poisoning, hijacking and jailbreaking.

Key points

  • Best practice: be specific and concise, give clear instructions, and experiment and iterate.
  • Risks: exposure or leaking (revealing the prompt), poisoning (tainted data or examples steering outputs), hijacking or injection (user text overrides your instructions) and jailbreaking (bypassing safety behaviour).
  • Guardrails help filter such attacks.

Source: https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management.html

Practice questions

Single choice

Which habit most improves the quality of prompts over time?

  1. Testing variations and comparing the outputs
  2. Making every prompt as long as possible
  3. Reusing one wording for every model
  4. Avoiding specific details to stay flexible
Show answer

Answer: A. Testing variations and comparing the outputs

Experimenting with variations and comparing results is how prompts improve. Longer is not better, and fixed wording ignores model differences.

Select all that apply

Which measures help defend a Bedrock-based application against prompt attacks?

  1. Attach a guardrail with the prompt attack filter
  2. Validate and sanitize user input before sending it
  3. Trust user input because the model is safe by default
  4. Merge user text directly into the system prompt unmarked
  5. Rely only on a longer prompt
Show answer

Answer: A. Attach a guardrail with the prompt attack filter, B. Validate and sanitize user input before sending it

Guardrails with prompt-attack filters and input validation are recommended defences. Hiding the prompt in the UI does not stop injection, and removing all instructions would remove the app's behaviour.

True or false

True or false: because AWS secures the Bedrock service, preventing prompt injection in your application is AWS's responsibility.

Show answer

Answer: False

False. Under the shared responsibility model, prompt injection is an application-level concern that the customer must address, much like SQL injection.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More AIF-C01 topics in this module