Sole Backend EngineerHapminds2026Confidential · details generalised
AI safety guardrails
Missed crisis phrasings went from 21 of 27 to 0 of 24 test cases, with zero false alarms.
✓ VERIFIED0 / 24
Missed crisis phrasings, down from 21 of 27English test cases, before and after. Zero false alarms.✓ VERIFIED7 → 1
Missed multi-turn escalationsMulti-turn escalation test cases, before and after.✓ VERIFIED9,000
Active users in the pilotActive users on the B2B student-wellness pilot.The problem
The wellness assistant missed 21 of 27 English crisis phrasings in testing. High-risk messages also waited on a model call that could take 3 to 30 seconds.
What I built
I rewrote the guardrails and tested them against English crisis phrasings and multi-turn escalations. The highest-risk messages now get a rule-based reply in milliseconds, with no LLM call.
Architecture
How a message is checked
High-risk messages skip the model call.
01
MessageSent by the student.02
Rule checkMatches known crisis phrasings.03
Rule-based replyReturned in milliseconds.04
LLM replyUsed for all other messages.Message → Rule check · every messageRule check → Rule-based reply · high riskRule check → LLM reply · everything else
Decision log
What I chose, and what I gave up
01Rule-based reply for the highest-risk messagesover sending every message to the modelA model call could take 3 to 30 seconds.
A crisis reply should be immediate and give the same answer every time. Rules can be tested case by case.
+ The phrasing list needs regular updates− Waiting on a model call for crisis messages
Scaling story
How it grew
01
Wrote the test casesEnglish crisis phrasings and multi-turn escalations, run before and after each change.
02
Closed the gapsMissed phrasings dropped to 0 of 24 and missed escalations from 7 to 1, with zero false alarms.
Next case studyLLM layer and capacityhap_ai: one LLM interface with Gemini failover, a daily token cap, and model calls moved out of database transactions.