DEV Community

RESK
RESK

Posted on

Building a Bitmask-Based LLM Security Firewall with reskSecure

Most LLM safety filters scan output after generation. We built reskSecure to stop unwanted tokens before they are sampled, using a bitmask-based firewall at the logits layer.

How It Works

Instead of regex-matching outputs, reskSecure intercepts the probability distribution right before token selection:

  • Block mode: Forbidden token probabilities set to -inf — can never be sampled
  • Penalty mode: Unwanted tokens scaled down (unlikely but possible)

This means the model literally cannot generate a blocked sequence.

Quick Start

pip install resksecure

Links

  • PyPI: pip install resksecure
  • GitHub: github.com/Resk-Security/reskSecure
  • Docs: resk.fr

Star on GitHub if this approach resonates with you. Contributions welcome.

Top comments (0)