Databricks Generative AI Engineer Associate Question 255
Select 3You are designing a Generative AI application that accepts text prompts from users. To mitigate the risks of malicious user inputs, such as injection attacks or harmful content generation, which guardrail techniques should you implement?
- A
Validate and sanitize user inputs before passing them to the model
- B
Implement rate limiting and user authentication to restrict access
- C
Allow the model to handle user inputs directly without preprocessing to ensure high performance
- D
Use prompt-based constraints or templates to guide model behavior
- E
Log all user inputs and outputs for auditing purposes
Show answer and explanation
Correct answers: A, B, D
Explanation
Guardrail techniques are essential to protect Generative AI applications from malicious user inputs. Validating and sanitizing inputs helps filter harmful content before the model processes it. Rate limiting and authentication reduce the risk of exploitation by limiting access. Prompt-based constraints or templates enforce safe behavior by guiding the model's output. These combined measures help mitigate risks effectively. Logging, while useful for monitoring, does not actively prevent malicious inputs, and directly passing inputs to the model without preprocessing is unsafe.
- A. Correct.
Validating and sanitizing user inputs ensures that malicious inputs, such as SQL injection or adversarial prompts, do not exploit the system or produce harmful outputs. This is a critical guardrail.
- B. Correct.
Rate limiting and user authentication protect the system from abuse, such as spamming the model with malicious queries. While not directly sanitizing inputs, this limits the exposure to malicious actors.
- C. Incorrect.
Allowing the model to handle user inputs directly without preprocessing is risky because it leaves the system vulnerable to malicious inputs or unintended outputs. This is not a recommended practice.
- D. Correct.
Prompt-based constraints or templates guide the model to stay within safe operational boundaries, reducing the risk of generating harmful or unintended content.
- E. Incorrect.
Logging user inputs and outputs is useful for auditing and debugging but does not directly prevent harmful inputs. It is more of a monitoring tool than a guardrail.