Databricks Generative AI Engineer Associate Question 253
Select 3You are developing a Generative AI application that uses a large language model (LLM) to answer user queries. To ensure the application is protected against malicious user inputs, which guardrail techniques should you implement?
- A
Input validation to restrict input length and disallow harmful characters or patterns
- B
Fine-tuning the LLM with a broad dataset to cover as many scenarios as possible
- C
Rate limiting to prevent excessive requests from a single user or IP address
- D
Embedding a content moderation layer to detect and filter harmful or malicious outputs
- E
Allowing the LLM to directly execute user-provided code for better interactivity
Show answer and explanation
Correct answers: A, C, D
Explanation
To protect against malicious user inputs, implementing input validation, rate limiting, and a content moderation layer are key guardrail techniques. Input validation restricts harmful inputs, rate limiting prevents abuse, and content moderation ensures the system’s outputs remain safe and non-malicious. Fine-tuning the LLM, while useful for improving general performance, does not address malicious inputs, and executing user-provided code is highly unsafe and must be avoided.
- A. Correct.
Input validation ensures that user inputs conform to expected formats, preventing malicious payloads such as SQL injection or prompt injection.
- B. Incorrect.
Fine-tuning the LLM with a broad dataset helps improve performance but does not directly mitigate risks from malicious user inputs.
- C. Correct.
Rate limiting helps protect against abuse, such as denial-of-service attacks, by capping the number of requests a user can make.
- D. Correct.
A content moderation layer ensures that the outputs generated by the LLM do not include harmful or malicious content, which is critical for safeguarding users.
- E. Incorrect.
Allowing the LLM to directly execute user-provided code is highly unsafe, as it can lead to severe security vulnerabilities and exploitation.