DDoS mitigation, WAF vs AI model. The AI model is inside the WAF.

The framing assumes they live at the same layer. They do not. Cloudflare runs CatBoost ML models on every edge request and exposes the result as cf.bot_management.score, a 1 to 99 field your rules read. So when somebody pitches you “WAF or AI” the honest answer is that you already have both and the question is whether you need to bolt a second model on top. For most SMBs you do not.

M
Matthew Diakonov
8 min read

Direct answer, verified 2026-05-07

Pick a WAF. The ML scoring is already in it.

A modern edge WAF and an “AI model for DDoS mitigation” are not alternatives at the same layer. The WAF is the rule engine and the policy enforcement point. The ML model is one of the inputs the rule engine reads. Cloudflare bot management scores, Fastly Next-Gen WAF's Adaptive Threat Engine, and Akamai's Bot Manager all do this: a model emits a number, a rule decides what action to take with it.

Pick the WAF when
Volumetric, signature, or general bot abuse on web paths
Add a custom model when
Behavioral abuse only visible at the session or app layer

Source: Cloudflare bot management ML models docs, bot score concepts.

What actually happens to a request

The mental model that makes this whole question collapse is the request flow. A single HTTP request crosses several stages on the edge before it gets to your origin. The ML model sits in the middle. The rule engine reads its output. Neither is doing the other's job.

how a request actually crosses a modern edge

ClientEdge L4ML scorerRule engineOriginTCP/TLS handshakeL3/L4 DDoS filterfeature extractionscore 1-99match wirefilter ruleschallenge or block (if)forward requestresponse

The L3/L4 step is the volumetric DDoS layer; on Cloudflare, Fastly, AWS Shield Standard, and similar edges, this is unlimited and handled before your application or rules see anything. The ML scorer is a model the vendor maintains; on Cloudflare it is CatBoost, retrained on a periodic schedule against billions of daily requests across the network. The rule engine is what you actually edit. Your wirefilter rules read the score the same way they read country, ASN, path, or method.

The score is a feature input, not a verdict

This is the part vendor pitches blur. A rule expression like (http.request.uri.path matches “^/api/” and cf.bot_management.score lt 30)mixes a path predicate (rule logic) with a model output (ML score). Neither is doing the work alone. The model gives you a number. The rule decides whether 30 is the right line on this endpoint, whether to challenge or block, and whether to allowlist named good bots before the rule fires. Pull the rule out and you have a number with no policy. Pull the model out and you have a policy without sufficient signal on borderline traffic.

The numbers below are the inputs the rule engine actually receives on every request, and where each comes from. Two of them come from ML models the vendor maintains. The rest are deterministic. They are all readable in the same wirefilter expression on Cloudflare.

1-99

The range Cloudflare's CatBoost bot management model produces on every edge request. 1 means almost certainly automated, 99 almost certainly human. Your wirefilter rules read it as cf.bot_management.score, the same way they read country or path.

Cloudflare bot score docs, verified 2026-05-07

Two layers, two jobs

Strip the vendor copy and the picture is simple. Each layer has a job. Each job has a different shape of failure. Each is bad at the other's job and gets dragged in the wrong direction when you ask it to do both.

Rule engine (the WAF)

Decides actions on signals

  • Sub-millisecond decision per request, no extra inference cost
  • Deterministic: a clause either matches or it does not
  • You write the threshold (rate limit, country, score cutoff)
  • Allowlist named bots, region-specific carve-outs, write paths versus read
  • Fails by being too coarse on borderline traffic
  • Pricing: included with Cloudflare Pro at $25/mo/zone

ML scorer (the “AI”)

Predicts probability from features

  • Reads request features the rule engine cannot reason about (TLS fingerprint, session shape)
  • Trained against multi-tenant signal across the network
  • Output is a number; it does not pick the action
  • Retrained on a periodic schedule by the vendor
  • Fails by being uncalibrated on niche or low-traffic endpoints
  • Pricing: bundled into the WAF tier; no separate model bill

The reason the “vs” framing keeps showing up is that independent vendors sell the model layer as a standalone product (Datadome, Kasada, HUMAN, Arkose, Imperva Bot Protection). They are not lying when they market “AI-driven DDoS defense.” They are selling a behavioral model that runs alongside a WAF and scores the part of traffic the WAF could not call confidently. That is a real product. It is rarely the right buy under SMB volume.

When a custom AI model on top earns its place

A second model is a real engineering investment, not a setting. You pay for it in MRR (third-party) or in headcount (self-built) and in label maintenance. The four cases below are the ones I have seen genuinely justify it on real engagements. Most of them are not SMB problems.

Behavioral abuse only visible per session

Account farming, ticket-flipping, content scraping that respects robots.txt and rotates through residential IPs. The single-request features the WAF model sees look human. A model that watches a session over minutes catches it.

Niche endpoint volume

A new B2B API with 50 requests per second sees too few examples for a global model to score it well. A custom scorer trained on your own labels handles the long tail.

App-layer signal the edge cannot see

Time on page, scroll velocity, mouse-move entropy, partial form fills, in-app event order. These exist in your origin or client SDK, not at the edge. A model in your origin reads them.

You can keep it fresh

If you cannot retrain weekly with fresh labels, you do not have a model, you have a static heuristic that decays. The bar is real headcount or a vendor SLA, not a side project.

The 2026 SMB stack, with the AI part already inside it

For a 5 to 15 person business with a real cart, a login, a search endpoint, and an SEO surface that needs to be readable by named AI assistants, the realistic stack does not involve picking a side. It involves picking the WAF that already has the right ML behind it and writing five to ten honest rules.

what a working SMB DDoS stack actually contains

⚙️

Cloudflare Pro on the zone

$25 per zone per month. Unlocks the managed ruleset, Super Bot Fight Mode, page rules, real rate-limit ceilings, and the cf.bot_management.score field.

Allowlist named good bots

ClaudeBot, GPTBot, PerplexityBot, OAI-SearchBot, Googlebot. Skip rule, placed first. Without this the bot-score rule will eat your indexing traffic.

🔒

Rate limit the hot endpoints

/api/login at 10/min/ip, /api/cart at 60/min/ip, /search at 120/min/ip. Action: managed_challenge on exceed. Anchored in your access logs, not in defaults.

↪️

Country and bot-score lines

Challenge below score 30 on protected paths, block below 5. Country challenge for traffic outside your customer base on /api or /account paths.

24h log mode, then promote

Run rules in log mode for one day. Read the action log. Promote the rules that fire on real attacks, lower the threshold on the false-positive ones, drop what does not match.

Five steps. One ML model in the loop. No second model needed. Total recurring cost for the security layer: $25 per zone per month plus the one-time small-integration scope on the services page. If you are quoted ten times that for an “AI-powered DDoS mitigation platform” before the engineer has read your access logs, the price tag is for the marketing, not the mitigation.

The case where the WAF is genuinely not enough

Three engagements in the last twelve months hit the wall on the WAF alone. A ticket-resale site whose attackers throttled to one request every 1.8 seconds with rotating residential IPs, never tripping any rate limit and scoring above 40 on every request. A B2B SaaS API where partners legitimately ran 200 requests per minute from headless Chrome with a low bot score, and abusive scrapers ran the same shape under the same IPs. A consumer content site where the abuse was a slow scrape that respected robots.txt, used a real ClaudeBot user-agent without permission, and was distinguishable only by the order of pages requested.

On all three, the answer was a behavioral model running in the origin or in a Cloudflare Worker, scoring sequences of requests inside a session and either rejecting at the app layer or feeding a Worker-side challenge. The WAF stayed in front, did its volume and signature work, and handed the survivors to the model. That is what an “AI model for DDoS mitigation” actually looks like in production. It is not a replacement for the WAF and it is not a checkbox. It is engineering work that has to justify its MRR and its label-maintenance cost.

What this looks like as a c0nsl engagement

The honest scope for most SMB sites is a small-integration tier: review the access logs, name the threat model in writing, draft five to ten wirefilter rules with the bot-score and country lines picked from real traffic, deploy in log mode for 24 hours, read the action log, and promote. That fits the published $500 to $2,000 small integration tier. If your shape needs a Cloudflare Worker that runs custom request-shape logic, multi-zone alignment across staging and prod, a Fastly VCL component, or a behavioral model integration, that is a custom-system engagement at $2,000 to $10,000 plus. Either way the rate is on the page, the deliverable is named in the scope, and the work happens with a named engineer, not a course graduate. Adjacent reading on this site: what Claude Code can and cannot do for edge WAF rule writing, and the broader Claude Code consulting workflow.

Bring your access logs, leave with a real ruleset

30 days of edge logs, your customer geography, one paragraph on what you are protecting. I come back with the wirefilter rules, the picked thresholds, and a quote at the published rate. No AI-DDoS upsell.

Frequently asked questions

Is a WAF and an AI-based DDoS mitigation system the same thing in 2026?

No, but they are not opposing choices either. A modern edge WAF (Cloudflare, Fastly Next-Gen, Akamai App and API Protector) ships with one or more ML models built in. Cloudflare runs CatBoost models on every request and exposes the result as cf.bot_management.score, a 1 to 99 field your rule expressions can match against. So when a vendor pitches you an 'AI-based DDoS solution' the honest description is one of two things: their own WAF that includes ML scoring, or a separate model that runs alongside a WAF and feeds it custom signals. There is no realistic 2026 deployment where you replace the rule engine entirely with a model.

What does the bot_management.score field actually represent?

It is the output of supervised CatBoost models running on Cloudflare's edge for every request. The model takes request features (headers, JA3/JA4 fingerprint, session shape, browser signals, inter-request patterns) and predicts the probability the client is human, mapped to 1 to 99. 1 means almost certainly automated, 99 means almost certainly human. Cloudflare runs multiple models in shadow mode and one in active mode that drives the visible score. The score is then used as an input variable inside wirefilter rules; you can write 'cf.bot_management.score lt 30' the same way you write 'ip.src.country in {"CN" "RU"}'. That is the actual integration. The ML output is a feature input to the rule engine, not a replacement for it.

Then when would I add my own AI model on top of a WAF for DDoS mitigation?

Three concrete cases. First, you have application-specific signals the WAF cannot see: time on page, scroll velocity, mouse-move entropy, in-app event sequences, partial form fills. A custom scorer running in your origin can read those and reject or downgrade requests the WAF passed. Second, you have a request shape the WAF's score is bad at, such as a niche domain (low-traffic API where the global model sees too few examples to score well) or a domain where automation is expected (your own legitimate scrapers, partner integrations). A custom model trained on your own labels handles the long tail. Third, you have the volume and labelers to keep the model fresh; if you cannot retrain on a weekly cadence you do not have a model, you have a static heuristic that decays. For an SMB doing under 100 requests per second sustained, none of these usually applies.

What does an SMB-scale DDoS mitigation stack actually look like in 2026?

For a 5 to 15 person SMB on a Shopify or Next.js stack, the realistic stack is: Cloudflare Pro at $25 per zone per month for the managed ruleset, Super Bot Fight Mode, page rules, and the bot management score; six to ten custom wirefilter rules tuned to the site's traffic; rate limits on /api/login, /api/cart, /search, and any webhook endpoint; a country challenge for traffic outside the customer base; and a hard block on the very-low-bot-score tail (under 5) for protected paths. The 'AI' in this stack is Cloudflare's CatBoost model, which you do not deploy or maintain; it is already running. You do not buy a separate AI DDoS product on top. The published $500 to $2,000 small-integration tier on this site covers a real ruleset with thresholds picked from the access logs, not a vendor swap.

What about the 'AI is supercharging DDoS attacks, you need an AI defense' marketing pitch?

It is half right. AI is genuinely accelerating reconnaissance, payload generation, and bypass discovery for application-layer attacks. The 2026 trend reports show large multi-vector growth and DDoS being used as cover for targeted intrusions. What that does not imply is that a small team should swap a WAF for a custom model. The defensive answer to 'attackers automate faster' is that the WAF's ML model also retrains continuously across every customer's traffic. Cloudflare publishes monitoring posts about retraining cadence; you get the benefit without owning the pipeline. The case for a custom model is application-specific signal, not a generic 'AI vs AI' framing.

Are there scenarios where the WAF is genuinely the wrong tool and a model is right?

Yes, but they are narrow. Layer 7 abuse where the request shape is indistinguishable from legitimate traffic and only behavior over a session reveals abuse: ticket-buying bots that throttle themselves to one request every two seconds, account farming that spreads across thousands of residential IPs, content scrapers that respect robots.txt and rotate through known-good user-agents. WAF rules cannot catch those without false positives. A behavioral model running at the application layer (Datadome, Kasada, HUMAN, Arkose, or a self-built one) can. Even then, the model is still a co-tenant with the WAF, not a replacement; the WAF handles volume and basic signal so the model only sees the part of traffic worth scoring.

How does this compare to Vercel's built-in firewall, Fastly Next-Gen WAF, or AWS Shield?

Same shape, different vendors. Vercel's firewall on Pro and Enterprise includes DDoS mitigation and a managed WAF; the ML pieces are vendor-managed. Fastly Next-Gen WAF (formerly Signal Sciences) ships with an Adaptive Threat Engine that scores requests against multi-tenant signal at the edge. AWS Shield Standard handles volumetric L3/L4 free with every account; Shield Advanced adds AWS WAF managed rules and 24/7 incident response. None of these is a 'WAF or AI' choice. Each is a WAF with vendor ML inside. The decision is mostly about where your origin already lives and how much custom telemetry you want, not whether the product is rule-based or model-based.

What is the realistic budget for getting this right on a small site?

If you start from a Cloudflare zone with no custom rules, 30 days of access logs to look at, and a written threat model (login brute force, cart scraping, foreign country abuse, webhook flooding), the work fits the published $500 to $2,000 small-integration tier on c0nsl.com. The deliverable is a written ruleset, the wrangler or Terraform config to deploy it, a 24-hour log-mode run, a reading of the action log, and a final promote-or-tune pass. If your stack also requires a Cloudflare Worker with custom request-shape logic, multi-zone alignment, a Fastly VCL component, or behavioral model integration, that is a custom-system tier engagement, $2,000 to $10,000 plus. Adding a third-party behavioral model (Datadome, Kasada, HUMAN) is its own line item with its own MRR and is rarely the right call for an SMB.

Can I just turn on every AI feature in my WAF and forget about rules?

No, and this is the most common mistake on small sites. Cloudflare's Super Bot Fight Mode at default settings will challenge or block traffic from low-bot-score IPs on every path, including paths you want indexed by named bots (Googlebot, ClaudeBot, GPTBot, PerplexityBot). Without a user-agent allowlist before the bot rule, you can find your search traffic dropping in a week and not know why. The right pattern is: explicit allowlist of named good bots first, then the bot-score rule. The model gives you a number, the rule decides what to do with it. Skipping the rule layer because 'the AI handles it' lands you in conversion outages and SEO regressions.

What should I do tomorrow if I just want a starting point?

Three steps. One, turn on Cloudflare Pro on your zone; the cost is $25 per month per zone and you get the bot management score field, the managed ruleset, and rate limiting that does not embarrass you. Two, write an allowlist rule for ClaudeBot, GPTBot, PerplexityBot, OAI-SearchBot, and Googlebot that bypasses your custom ruleset, and put it first in the rule order. Three, write one rate limit (10 per minute per IP, managed challenge on exceed) on /api/login. That is the 80 percent. The remaining work is the per-endpoint thresholds and the country and bot-score lines, which take an hour with the access logs in front of you. None of it requires picking 'WAF or AI model.' Both are already in the box.

How did this page land for you?

React to reveal totals

Comments ()

Leave a comment to see what others are saying.

Public and anonymous. No signup.