Skip to main content
Cloudflare's Clef: When a Decision Model Beats an LLM Call

Cloudflare's Clef: When a Decision Model Beats an LLM Call

KU
· Founder & Chief Editor
• 8 min read•Updated •65 views

Most moderation, routing, and triage calls aren't generation problems. Clef proves it by answering in 38.8 milliseconds instead of seconds.

Key takeaways

  • Use a decision model like Cloudflare's Clef whenever the valid answers are known before the request arrives, such as moderation, routing, triage or intent classification.
  • Clef-flash returns typed probabilities in 38.8 ms median and bills only input tokens.
  • Keep an LLM call for anything that has to write, summarize or reason in open-ended prose.

A decision model beats an LLM call whenever you could write the valid answers into an enum before the request arrives. Cloudflare's Clef and Clef-flash, on Workers AI since October 1, 2026, take your data plus typed questions and return probabilities, not text. Clef-flash answers in 38.8 ms at the median. Moderation, routing and triage belong there.

Verified against

Workers AI @cf/cloudflare/clef and @cf/cloudflare/clef-flash, against Cloudflare's October 1, 2026 changelog, the launch blog post and both Workers AI model pages. Checked October 2026.

If your pipeline burns a full LLM call on something that's really a yes/no, a category pick, or a 1-10 score, you're paying generation prices for a classification problem, and Clef is the clearest evidence yet that the two should be billed and built differently.

What a decision model actually returns

Clef comes in two sizes: Clef at 27 billion parameters on a frozen Qwen3.8-27B backbone, and Clef-flash at 9 billion parameters on Qwen3.5-9B. Cloudflare's model pages list a 65,536-token context window for Clef and 24,576 tokens for Clef-flash, and you can pass up to four images alongside the text state. The mechanism is what matters: instead of generating tokens one at a time, Clef does a single prefill-only pass over your input and scores the valid schema options in parallel. You ask it noul questions (a 0-1 probability of yes), choice questions (pick one option, with a probability per option), or score questions (place the input on an ordered scale), up to 64 questions per request. There's no sampling and nothing to parse out of a text response, because the answer is already shaped like your schema.

That's the whole difference from an LLM call. An LLM generates a sequence and you hope the JSON it produces matches your schema. A decision model skips generation and scores the schema directly. Clef follows the same API as Jev, Typesafe's decision model, so teams already calling Jev can switch by changing the endpoint and model name.

The latency gap is the real headline

Cloudflare's published numbers, as of October 2026:

ModelParametersMedian / p95 latencyBANKING77 macro-F1Price (Workers AI)Output
Clef-flash9B38.8 ms / 122.4 ms90.93$0.038 per 1M input tokensTyped probabilities
Clef27B209.3 ms / 238.6 ms94.20$0.24 per 1M input tokensTyped probabilities
Jev (Typesafe)n/a524.1 ms / 536.0 ms79.74Vendor pricingTyped probabilities
General LLM chat callVariesGrows with output lengthDepends on promptInput plus output tokensFree text you must parse

Clef-flash is roughly 13x faster than Jev at the median, and both Clef sizes beat Jev on BANKING77 intent classification, so the speed isn't costing correctness on tasks the models are built for. Cloudflare's results put Clef on top for several decision benchmarks, including BANKING77 and CLINC150+OOS, though Jev still wins some individual ones. Output tokens are not billed at all, which is the structural pricing difference from a chat completion.

Put a moderation check or a fraud flag in the hot path of a user request, and an LLM round trip is often the single biggest latency line item on the page. Swap it for a call that resolves in about 40 ms and that line item mostly disappears from your waterfall.

Where this genuinely replaces an LLM call

The honest list of candidates is anything that is already a bounded decision, meaning the set of possible answers is fixed before the request arrives:

  • Moderation: is this content policy-violating, yes/no or a severity score.
  • Routing: which of our five support queues does this ticket belong to.
  • Fraud and risk flags: does this transaction match a known-bad pattern, as a probability.
  • Triage and prioritization: score this input on an urgency scale.
  • Intent classification: pick the right tool or workflow branch from a known list.

All of these share a property: you could write the output options into an enum before the request arrives. That's the test. If your prompt's job is "pick from this list" or "score this on this scale," you're already describing a choice or score question, and paying LLM prices for an answer a schema head could score directly.

The request shape, following the Workers AI model page:

JavaScript
// src/worker.js: route a support ticket with Clef-flash
const result = await env.AI.run("@cf/cloudflare/clef-flash", {
  model: "clef-flash",
  state: ticketBody,
  questions: {
    queue: {
      type: "choice",
      instructions: "Which support queue does this ticket belong to?",
      criteria: {
        billing: "Payments, invoices, refunds",
        bug: "Something is broken or erroring",
        feature: "A request for new functionality",
        abuse: "Spam, fraud or policy violations",
      },
    },
    urgent: { type: "noul", instructions: "Does this need a reply within 1 hour?" },
  },
});
// result.answers.queue.choice -> "bug", with a probability per option
// result.answers.urgent.noul  -> probability of yes

Typed questions in, probabilities out, no prompt engineering to coax valid JSON out of a chat model. One failure mode to plan for: if the state is longer than the context window, Clef-flash truncates state to fit, while oversized images make the request fail outright.

Where you still need the LLM

Decision models fail the moment the task stops being bounded. If you need the system to write a reply, summarize a document, explain its reasoning in prose, or handle a request where the valid answers aren't knowable in advance, a schema head has nothing to score against. Clef doesn't generate text, so anything downstream that needs language output still routes to a generation model. The tradeoff is that Clef is less flexible by design: you trade open-ended reasoning for speed and determinism, and that only pays off when the task was never open-ended to begin with.

Teams running a mixed pipeline, say a moderation gate in front of a chat model, win most, because the gate is a decision and the chat turn is generation, and conflating the two into one LLM call was always doing the expensive job twice. If the generation step is also simple, a small fast LLM may be enough, the case we make in routing down to Claude Haiku 5.5.

If you're already running multiple providers behind a gateway, this is a routing decision, not a provider decision: see our AI gateway comparison for how LiteLLM, Portkey, and Cloudflare's own AI Gateway handle that split, and our guide to multi-provider LLM routing and failover for keeping both model types reachable through one path.

Questions people ask

What is a decision model?

A decision model takes input data plus typed questions and returns probabilities for a fixed set of answers instead of generating text. Cloudflare's Clef scores every valid option in one prefill-only pass, so there is no sampling and no JSON to parse. It fits yes/no checks, picking one option from a list, and placing input on a scale, but it cannot write replies or summaries.

How much does Cloudflare Clef cost?

As of October 2026, Workers AI lists Clef at $0.24 per million input tokens and Clef-flash at $0.038 per million input tokens. Output tokens are not charged, and images are billed as input tokens. Because a decision call produces no generated text, the bill depends almost entirely on how much state you send per request.

Can Clef replace an LLM for content moderation?

Yes, if your moderation policy can be expressed as fixed categories or a severity scale. A noul question gives the probability that content violates policy, and a score question can rate severity, with Clef-flash answering in 38.8 ms median. Keep an LLM only for the step that has to explain a decision to the user or draft a response.

The decision, concretely

  • Is the output a fixed set of options, a probability, or a scale score? Use a decision model like Clef or Clef-flash. Test accuracy on your own labeled sample, but expect a large latency win on classification-shaped tasks.
  • Does the task require generating new text or handling genuinely open-ended input? Keep the LLM call. A schema head can't write a sentence it wasn't asked to score.
  • Is latency the complaint on a classification step inside a larger pipeline? Replace just that step. Clef-flash in front of a generation model is a gate, not a replacement for the model doing the writing.
  • Are you already paying a general LLM to do intent classification or moderation? That's the easiest win here: no output-token charges and a fraction of the latency.

The call we'd make

Default to a decision model for any step where you could write the valid outputs into an enum today, and keep the LLM for every step that has to produce language. Clef-flash's 38.8 ms median makes the case alone: that's a different latency class for work that was never generation to begin with. The mistake isn't picking the wrong model. It's not noticing that half of what's running through your LLM gateway was a classification call wearing a chat completion's clothes.

Sources

Explore topics:LLMAIInfrastructure
React
Share this post
Cite this article
Plain text

Kiril Urbonas (2026). Cloudflare's Clef: When a Decision Model Beats an LLM Call. DevOpsNess. Updated 2026-11-15. https://www.devopsness.com/blog/cloudflare-clef-decision-models-vs-llm-calls

Markdown

[Cloudflare's Clef: When a Decision Model Beats an LLM Call](https://www.devopsness.com/blog/cloudflare-clef-decision-models-vs-llm-calls) (Kiril Urbonas, DevOpsNess, updated 2026-11-15)

KU

Kiril Urbonas

Founder & Chief Editor

601 articles
View all articles by Kiril Urbonas

You might have missed

Evergreen posts worth revisiting.