Why pattern matching alone falls short
Cloudflare's DLP engine inspects data leaving an organization across web, cloud, email and SaaS channels, and regular expressions carry much of that load. Patterns work well for many sensitive data types, but not all. U.S. Social Security Numbers follow the AAA-GG-SSSS structure, sometimes written without dashes, and are easily mistaken for U.S. taxpayer identification numbers, bank account numbers or phone numbers. Neither regexes nor similar deterministic methods can reliably separate PII from intellectual property, so detection noise accumulates.
Noisy alerts drive review fatigue and erode trust in the product, which in turn weakens the security posture the tool is meant to protect. Cloudflare has already shipped one mitigation: confidence thresholds, where a user picks low, medium or high tolerance and DLP surfaces only detections whose confidence score meets that minimum. The threshold is computed by examining the context around a match.

Hardcoded context analysis has its own ceiling. Searching for a keyword such as "SSN" near a candidate match breaks down because keyword lists are incomplete, users make typos, and plenty of true positives carry no nearby identifier at all — routing numbers appear without the word "bank," names appear without "SSN."
The feedback loop: embeddings plus nearest-neighbor search
Cloudflare's replacement is a self-improving algorithm that learns from the verdicts customers already render. When an admin reports a false positive from the decrypted payload logs, the system lowers future confidence for hits in similar contexts; a true-positive report raises it. Context similarity is computed with Workers AI, specifically a pretrained language model that turns text into a high-dimensional vector. Because the embeddings capture meaning rather than wording, sentences that say the same thing in different words land close together.

On each pattern match, the engine embeds the surrounding context and runs a nearest-neighbor search against previously logged true and false positives. Meaning-level similarity lets it reuse past judgments even when the phrasing differs. In experiments on Cloudflare employee traffic the approach handled pattern matches it had never seen before.

Platform choices and resource controls
The feature is built on Cloudflare Workers, with Workers AI for embeddings, Vectorize as the vector database, and D1 and Workers KV for storage — no infrastructure to provision. Embedding text takes a single line of code:
const result = await env.AI.run(model, {text: [text]}).data;
Tokenization through GPU inference is handled by the platform. Vectorize performs the neighbor lookup and also stores the current match's vector so future feedback can train against it.
Several techniques keep resource use in check. Rather than storing a vector per hit, online clustering groups vectors and persists only cluster centroids with hit and report counters, which cuts storage and speeds searches. Cloudflare Queues moves indexing off the DLP scanning hot path to keep the system responsive.

Privacy is enforced at several layers: matched text is redacted before embedding, and vectors and reports live in per-customer private namespaces across Vectorize, D1 and Workers KV, so each customer's learning is independent. Vectors untouched for 60 days are automatically removed.
Trade-offs, gaps and roadmap
Accuracy gains come with latency. Requests with no matching DLP entry see no increase; requests matching an entry in a profile with AI context analysis enabled typically add about 400ms. In rare extreme cases, such as a request matching multiple entries, the increase can reach 1.5 seconds. Cloudflare is working to bring the typical figure down, ideally to 250ms or better.
The current model supports English only. A multilingual model in development at Workers AI would extend coverage to more regions and languages. On transparency, users today cannot see how past reports shape decisions; Cloudflare plans tools and interfaces that explain how confidence scores are calculated. Availability is also narrow: AI context analysis currently covers Gateway HTTP traffic only, with CASB and Email Security targeted by the end of 2025.
The capability is in closed beta, with sign-up for early access available, and general availability planned for later.



