Mid-level interview questionAsked at Databricks · interview write-up
Design an ML system that detects harmful content in both the prompts users send to an LLM and the responses it gives.
Model answer
Run a classifier on both sides: on the prompt before the model, and on the response after, because a harmless prompt can still produce a harmful answer. Start from a taxonomy, such as violence, self-harm, hate and jailbreaks.
A small fast model scores every request; borderline ones go to a larger judge, samples to humans. Tune thresholds per category, since false positives block real users. Feed red-team findings back into training.
Practise the rest
12 Prompt injection questions, 492 in all, each with a model answer. Free.
More from Databricks interview questions.
More Prompt injection interview questions
- Why is prompt injection possible at all, and why can't it be fixed the way special-token injection is?
- What is the difference between direct and indirect prompt injection? Give an example of each.
- Your assistant has no tool that sends anything. Can an injected web page still leak the user's data?
- You're designing an email assistant that reads, summarises and forwards mail. Which defences do you put in, and where?
- A reviewer says: “The system prompt forbids following instructions in emails, so the forward tool is safe, and our red-team run had zero violations.” Do you accept that?
- What's the difference between a jailbreak and a prompt injection?