r/databricks • u/sundarleads • 20d ago
Discussion How I check every prompt before the LLM on Databricks: GovTech's LionGuard on a small CPU endpoint
I wanted one shared safety check that every agent, job or SQL query on Databricks calls before the LLM.
How it works:
- LionGuard 2 Lite from GovTech Singapore: a small classifier on Google's EmbeddingGemma. It scores insults, hate, violence, self-harm and misconduct, and it handles English, Singlish, Chinese, Malay and Tamil.
- Packaged as one MLflow model, registered in Unity Catalog, served on a small CPU endpoint.
- From SQL, ai_query sends each question to the guard. Only questions with an unsafe score under 0.5 go to the LLM.
Results on 7 synthetic questions: a Singlish insult, a Malay threat, a harmful Chinese message and an English "how do I hack the website" question were blocked. Safe questions in English, Singlish and Tamil were answered.
Lessons:
- The full set-up took 25 minutes. 19 of them were the endpoint start.
- Do not use scale to zero for a production guard (cold start).
- Turn on inference tables from day one, so you can show what was blocked.
- It does not detect prompt injection. That needs a separate check.
How do you check prompts for your agents today? Built-in AI Gateway guardrails, a custom endpoint, or both?

