SBW is the reference implementation of Stateless Bernoulli Watermarking, the scheme introduced in Flip, Don’t Shuffle: Watermarking LLMs at the Speed of Inference . It is published on PyPI and designed to be used both as a research tool and in production inference pipelines.

SBW ships as two packages. sbw is the core library: model-agnostic and inference-engine-agnostic, it implements the classes for watermark application and detection without assumptions about how the model is served. vllm-sbw is a vLLM logits processor that injects the watermark at generation time, with near-zero overhead and full compatibility with vLLM’s CUDAGraph optimisations.

pip install sbw          # core library
pip install vllm-sbw     # generation via vLLM

Usage instructions and vLLM integration examples are in the repository README .

The design priorities are speed and correctness. Membership assignment is O(1) per token: a single comparison against a counter-based RNG, no intermediate allocations, and the detection test is a standard z-score with provably correct null calibration. The Philox PRNG and a GPU-native Jenkins hash are used for the pseudorandom function, with hash function choice exposed as a configurable axis1.

The code is open source. Check it out on GitHub.

Links: GitHub · PyPI (sbw) · PyPI (vllm-sbw) · Paper


  1. Hash function choice matters more than you might expect. Check the paper . ↩︎