ML engineering · 2025
Warden
A self-hosted moderation service that answers in under 50 ms by accepting first and scoring text and images for toxicity and NSFW content in the background.
- ingest response, p95
- <50ms
- pHash fast path for known media
- O(1)
- models: text toxicity + NSFW vision
- 2

Intended use
Community platforms need to stop harmful posts without making every user wait for a model.
Warden is a plug-and-play moderation service. A client posts text or an image, Warden answers in under 50 ms, and isolated workers score the content in the background. Flagged items are held or removed as soon as a score lands, and the client hears about it over a WebSocket.
It is built for small teams who want moderation as a service they run themselves, not a third-party API with per-call pricing.
Architecture
Decisions
- Accept first, judge later. The HTTP path never waits for inference. It validates, enqueues and returns, so a traffic spike slows the queue, not the users.
- Hash before you think. Every image gets a perceptual hash checked against a Redis set of banned media. Known spam is rejected in O(1) without touching the GPU.
- Two stores for two jobs. PostgreSQL holds the lifecycle of each request; MongoDB takes the noisy per-model confidence telemetry.
- Lazy weights. Model weights are baked into the image but loaded on the first task, which keeps idle workers small.
Results & evaluation
- ingest response, p95
- <50ms
- pHash fast path for known media
- O(1)
- models: text toxicity + NSFW vision
- 2


Limitations & next steps
- The p95 figure comes from local load tests, not production traffic.
- Toxicity models carry the biases of their training data; borderline scores go to a human review queue rather than auto-removal.
- Next: per-tenant thresholds and a small dashboard for reviewers.