Cloudflare

Making WAF ML models go brrr: saving decades of processing time

Jul 25, 2024Alex Bocharov
Making WAF ML models go brrr: saving decades of processing time
SummaryAI, from the source post

This post details performance optimizations for Cloudflare's WAF ML models, achieving a 5.5x speedup (82% reduction in execution time) by optimizing the feature extraction process. The primary optimization involved replacing `std::collections::HashMap` lookups with the Aho-Corasick algorithm (specifically using `AhoCorasickKind::DFA`) for ngram processing, reducing lookup time and improving cache efficiency. Additionally, the post mentions optimizations for `regex::regex::bytes::Regex::replace_all` and discusses the overall system design of the WAF Attack Score, including normalization, feature extraction, and model inference.

More from the Artificial Intelligence Integration & Impact trail