Back

ResearchJul 2025 to Oct 2025

Malicious prompt classifier

Stop harmful prompts before they reach a language model, and say why.

  • Markov chains
  • NLP
  • Interpretable classification
  • AI safety
  • Python

Impact

precision
98.84%
accuracy
90.79%
F1 score
89.96%

Published in Procedia Computer Science, 2026.

What I did

  • Built an interpretable Markov-chain classifier, trained on 39,234 balanced prompts.
  • Scored each prompt by likelihood ratio, surfacing the word sequences behind each flag.
  • Reached 90.79% accuracy, 98.84% precision, 82.54% recall and an 89.96% F1 score.
  • Kept the simpler model, after a higher-order ensemble reached only 89.3% accuracy.
  • Published the paper in Procedia Computer Science (2026).

The aim

Chatbots can be tricked by prompts written to make them misbehave. This research catches those prompts before they get through, and says why each one was flagged.

Move across it to run the belt.