Databricks Generative AI Engineer Associate Question 256
Select 3You are tasked with deploying a generative AI application that allows users to input text prompts to generate responses. To ensure the application is safeguarded against malicious user inputs such as SQL injection, harmful content, or prompt manipulation, which guardrail techniques should you implement?
- A
Input sanitization to remove or escape special characters
- B
Rate limiting to control the number of requests from a single user
- C
Using a content moderation API to filter harmful or inappropriate inputs
- D
Storing and logging all prompts without any preprocessing to ensure auditing
- E
Implementing prompt filtering to detect and block suspicious queries before processing
Show answer and explanation
Correct answers: A, C, E
Explanation
Protecting generative AI applications from malicious user inputs requires a combination of techniques such as input sanitization, content moderation, and prompt filtering. Input sanitization ensures harmful characters are removed, content moderation identifies unsafe inputs, and prompt filtering blocks suspicious queries. These techniques together help safeguard the system while maintaining functionality.
- A. Correct.
Input sanitization is crucial to mitigate risks like SQL injection or prompt injection by removing or escaping harmful special characters, ensuring user inputs are safe for processing.
- B. Incorrect.
Rate limiting helps prevent abuse of the system but does not directly address malicious user inputs or harmful content filtering.
- C. Correct.
Using a content moderation API can identify and block harmful or inappropriate inputs, reducing risks of generating unsafe outputs.
- D. Incorrect.
Storing and logging all prompts without preprocessing can lead to security issues as malicious inputs are stored in raw format, which might pose risks for auditing or future use.
- E. Correct.
Prompt filtering detects suspicious queries, such as those designed for prompt injection or manipulation, and blocks them before they reach the model, ensuring safer processing.