reskSecure Blocks LLM Jailbreaks at Token Level Using Bitmask Policy Engine
A new open-source Python library called reskSecure offers a token-level security firewall for large language models, blocking forbidden outputs before they are ever sampled rather than scanning text after generation. The tool uses a bitmask-based policy engine with YAML-defined rules, applying either hard blocks or configurable bias penalties to token probabilities when a matching pattern is detected. It leverages the Aho-Corasick algorithm to simultaneously search thousands of patterns with minimal latency impact. reskSecure integrates with any HuggingFace model via the logits processor API and supports hot-reloadable policies without requiring a restart. The library is available on PyPI under the package name resksecure and requires Python 3.13 and PyTorch 2.0 or higher.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in