GENERATIVE-AI-ENGINEER-ASSOCIATE practice question 10 of 15

A Generative AI Engineer is developing an LLM application that users can use to generate personalized birthday poems based on their names. Which technique would be most effective in safeguarding the application, given the potential for malicious user inputs?

Full set: 61 questions
Answer options
A: Implement a safety filter that detects any harmful inputs and ask the LLM to respond that it is unable to assist Correct answer
B: Reduce the time that the users can interact with the LLM
C: Ask the LLM to remind the user that the input is malicious but continue the conversation with the user
D: Increase the amount of compute that powers the LLM to process input faster
Correct Answer:
A. Implement a safety filter that detects any harmful inputs and ask the LLM to respond that it is unable to assist
Explanation

The most effective and standard technique for safeguarding an LLM application is to implement input guardrails. A safety filter acts as such a guardrail by analyzing user input for malicious or harmful content before it reaches the LLM. If such content is detected, the system should refuse to process the request and provide a safe, generic response, such as stating it is unable to assist. This approach directly mitigates risks like prompt injection and the generation of inappropriate content, forming a critical component of a Responsible AI framework.

Why Incorrect

B. Reducing interaction time is a rate-limiting strategy, which can help against denial-of-service attacks but does not prevent a user from submitting a single, well-crafted malicious prompt.
C. Continuing the conversation after detecting a malicious prompt is a significant security risk, as it allows the user to rephrase or refine their attempt to bypass the LLM's safety alignment.
D. Increasing compute power relates to performance (latency and throughput) and has no bearing on the security or safety of the application's content processing. ---

References

1. Official Databricks Documentation: In the guide for developing LLMs on Databricks, the importance of a multi-layered approach to safety is emphasized. This includes "safety filters on user inputs (for example, to block prompts that contain PII or toxic language) and model outputs." This directly supports the implementation of a safety filter as a primary safeguarding technique.

Source: Databricks Documentation, "Develop large language models on Databricks," Section: "Responsible AI."

2. Official Databricks Blog: The post on LLM Guardrails explicitly describes this pattern: "Input guardrails are checks on the prompts sent by a user... If a user’s prompt is flagged by an input guardrail, the application can either reject the prompt outright or try to rephrase it." Rejecting the prompt is the most secure action described in option A.

Source: Databricks Blog, "Implementing LLM Guardrails with a Lakehouse Architecture," Section: "What are LLM guardrails?"

3. University Courseware: Stanford University's course CS224N discusses LLM safety, highlighting the necessity of content filtering and refusal as key mechanisms to prevent harm. The lecture on "Safety, Bias, and Ethics" covers methods to filter inputs and generate refusals for out-of-scope or dangerous queries.

Source: Stanford University, CS224N: NLP with Deep Learning, Winter 2023, Lecture 18: "Safety, Bias, and Ethics."

4. Academic Publication: Research on LLM vulnerabilities consistently identifies input validation and filtering as a primary defense. Adversarial attacks like prompt injection are best mitigated by sanitizing or blocking the input before it is processed by the core model.

Source: Wei, A., et al. (2023). "Jailbroken: How Does LLM Safety Training Fail?" arXiv preprint arXiv:2307.02483. Section 5, "Defenses," discusses input filtering as a foundational mitigation strategy.

Scroll to Top