Sign inConnect your agent
infochanged

Workers AI - Introducing Clef: Cloudflare's first open-source decision models, now on Workers AI

Announced
Tags
Workers-AI
Severity
info, set by reef/rss-rule-v1
Source
https://developers.cloudflare.com/changelog/post/2026-10-01-clef-workers-ai/

<p>Meet <a href="https://developers.cloudflare.com/workers-ai/models/clef/"><code>@cf/cloudflare/clef</code></a> and <a href="https://developers.cloudflare.com/workers-ai/models/clef-flash/"><code>@cf/cloudflare/clef-flash</code></a>, the first models trained by the Cloudflare Workers AI team, available on Workers AI today.</p> <p>Clef is a decision model, in the same family as <a href="https://typesafe.ai/blog/introducing-system-one-models-and-jev" target="_blank" rel="noopener">Typesafe's Jev<span class="external-link"> ↗︎</span></a>. Instead of generating text, it reads an input state and a set of typed questions, then returns a probability for every allowed answer. Your agent gets a structured decision it can act on immediately, for example: route the ticket, block the request, or escalate to a human. There is no free-form output to parse and no reasoning tokens to wait for.</p> <p>Both models are hosted on Workers AI as <a href="https://developers.cloudflare.com/workers-ai/models/clef/">Clef</a> and <a href="https://developers.cloudflare.com/workers-ai/models/clef-flash/">Clef-flash</a>. We are also open-sourcing the weights under the Apache 2.0 license on Hugging Face: <a href="https://huggingface.co/Cloudflare/clef" target="_blank" rel="noopener">Clef<span class="external-link"> ↗︎</span></a> and <a href="https://huggingface.co/Cloudflare/clef-flash" target="_blank" rel="noopener">Clef-flash<span class="external-link"> ↗︎</span></a>. Read the <a href="https://blog.cloudflare.com/clef-decision-models/" target="_blank" rel="noopener">launch blog post<span class="external-link"> ↗︎</span></a> for the full story, including how we trained them.</p> <p>We are also launching a reinforcement learning (RL) fine-tuning service to help you tune Clef for your own workloads. <a href="https://www.cloudflare.com/resource/clef-rl-interest" target="_blank" rel="noopener">Sign up to work with us as a design partner<span class="external-link"> ↗︎</span></a>.</p> <div tabindex="-1" class="heading-wrapper level-h4"><h4 id="built-for-the-hot-path">Built for the hot path</h4><a class="anchor-link" href="#built-for-the-hot-path"><span aria-hidden="true" class="anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span></a></div> <p>Clef is designed to be fast so decisions come back in milliseconds. Across our 43 benchmark runs, we achieved speeds where Clef is 2.5x faster than Jev at the median, and Clef-flash 13x faster.</p> <div class="table-scroll" tabindex="0" role="region" aria-label="Table"><table> <thead> <tr> <th>Latency</th> <th>Clef</th> <th>Clef-flash</th> <th>Jev</th> </tr> </thead> <tbody> <tr> <td>Median</td> <td>209.3 ms</td> <td><strong>38.8 ms</strong></td> <td>524.1 ms</td> </tr> <tr> <td>p95</td> <td>238.6 ms</td> <td><strong>122.4 ms</strong></td> <td>536.0 ms</td> </tr> </tbody> </table></div> <p>Hosting on Workers AI adds to that speed. Requests run on GPUs across Cloudflare's network, running close to your users, so the network round trip stays short. You can put Clef directly in the request path of your agent, then hand off to an LLM on Workers AI to take action.</p> <div tabindex="-1" class="heading-wrapper level-h4"><h4 id="leading-the-benchmarks">Leading the benchmarks</h4><a class="anchor-link" href="#leading-the-benchmarks"><span aria-hidden="true" class="anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span></a></div> <p>Across 10 decision benchmarks, a Clef model scores highest on 7, ahead of Jev and other open decision models. A few highlights:</p> <div class="table-scroll" tabindex="0" role="region" aria-label="Table"><table> <thead> <tr> <th>Benchmark</th> <th>Clef</th> <th>Clef-flash</th> <th>Jev</th> </tr> </thead> <tbody> <tr> <td>BFCL (case exact)</td> <td>98.47</td> <td><strong>98.76</strong></td> <td>95.75</td> </tr> <tr> <td>BANKING77 (macro-F1)</td> <td><strong>94.20</strong></td> <td>90.93</td> <td>79.74</td> </tr> <tr> <td>CLINC150+OOS (macro-F1)</td> <td><strong>97.43</strong></td> <td>66.77</td> <td>89.27</td> </tr> <tr> <td>Home appliances (case exact)</td> <td>82.95</td> <td><strong>97.73</strong></td> <td>52.27</td> </tr> </tbody> </table></div> <p>On Typesafe's own workflow evals, Clef beats Jev in 3 of 4 areas: invoice processing, customer service, and security incidents. The full results are on the <a href="https://huggingface.co/Cloudflare/clef" target="_blank" rel="noopener">Hugging Face model card<span class="external-link"> ↗︎</span></a>.</p> <div tabindex="-1" class="heading-wrapper level-h4"><h4 id="drop-in-compatible-with-jev">Drop-in compatible with Jev</h4><a class="anchor-link" href="#drop-in-compatible-with-jev"><span aria-hidden="true" class="anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span></a></div> <div class="table-scroll" tabindex="0" role="region" aria-label="Table"><table> <thead> <tr> <th>Model</th> <th>Size</th> <th>Best for</th> <th>Context window</th> </tr> </thead> <tbody> <tr> <td><a href="https://developers.cloudflare.com/workers-ai/models/clef/"><code>@cf/cloudflare/clef</code></a></td> <td>27B</td> <td>Highest-precision decisions</td> <td>64K tokens</td> </tr> <tr> <td><a href="https://developers.cloudflare.com/workers-ai/models/clef-flash/"><code>@cf/cloudflare/clef-flash</code></a></td> <td>9B</td> <td>Latency-critical, hot-path decisions</td> <td>64K tokens</td> </tr> </tbody> </table></div> <p>Clef follows the System One API, so you can switch an existing Jev integration to Clef by changing the endpoint and model. Ask up to 64 questions per request, in three types:</p> <ul> <li><strong><code>noul</code></strong>: A yes/no question. Returns the probability that the answer is yes.</li> <li><strong><code>choice</code></strong>: Pick one option from a set you define. Returns the chosen option, a probability per option, and a confidence value.</li> <li><strong><code>score</code></strong>: Rate against an ordered rubric. Returns a probability-weighted score and a probability per level.</li> </ul> <div><div data-nb-tabs data-nb-sync-key="workersExamples" class><div class="relative flex border-b border-border" role="tablist" data-nb-tabs-list><span class="bg-primary pointer-events-none absolute -bottom-px h-0.5 rounded-t-sm transition-[left,width] duration-200 ease-out" data-nb-tabs-indicator aria-hidden="true"></span></div><div class="mt-3"><div role="tabpanel" data-nb-tabs-content data-nb-tab-label="JavaScript" class><figure class="nb-code-figure" data-nb-lang="js"><pre class="astro-code astro-code-themes github-light github-dark nb-shiki-c6xiwz" tabindex="0" data-language="js" data-nb-lang="js"><code><span class="line"><span class="nb-shiki-1itgoe">const</span><span class="nb-shiki-dzsirb"> response</span><span class="nb-shiki-1itgoe"> =</span><span class="nb-shiki-1itgoe"> await</span><span class="nb-shiki-140thh"> env.</span><span class="nb-shiki-dzsirb">AI</span><span class="nb-shiki-140thh">.</span><span class="nb-shiki-1t8gfj">run</span><span class="nb-shiki-140thh">(</span><span class="nb-shiki-mdbnqw">"@cf/cloudflare/clef"</span><span class="nb-shiki-140thh">, {</span></span> <span class="line"><span class="nb-shiki-140thh"> model: </span><span class="nb-shiki-mdbnqw">"clef"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> state: </span><span class="nb-shiki-mdbnqw">"Checkout has been failing for every customer for the last hour."</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> questions: {</span></span> <span class="line"><span class="nb-shiki-140thh"> urgent: {</span></span> <span class="line"><span class="nb-shiki-140thh"> type: </span><span class="nb-shiki-mdbnqw">"noul"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> instructions: </span><span class="nb-shiki-mdbnqw">"Is this support request urgent?"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh"> team: {</span></span> <span class="line"><span class="nb-shiki-140thh"> type: </span><span class="nb-shiki-mdbnqw">"choice"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> instructions: </span><span class="nb-shiki-mdbnqw">"Which team should handle this request?"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> criteria: {</span></span> <span class="line"><span class="nb-shiki-140thh"> billing: </span><span class="nb-shiki-mdbnqw">"Payments, invoices, and refunds"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> technical: </span><span class="nb-shiki-mdbnqw">"Outages, errors, and configuration"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> sales: </span><span class="nb-shiki-mdbnqw">"Plans and upgrades"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh">});</span></span> <span class="line"></span> <span class="line"><span class="nb-shiki-21nrsd">// response.answers.urgent.noul -> probability the request is urgent</span></span> <span class="line"><span class="nb-shiki-21nrsd">// response.answers.team.choice -> highest-probability team</span></span></code></pre></figure></div><div role="tabpanel" data-nb-tabs-content data-nb-tab-label="TypeScript" class><figure class="nb-code-figure" data-nb-lang="ts"><pre class="astro-code astro-code-themes github-light github-dark nb-shiki-c6xiwz" tabindex="0" data-language="ts" data-nb-lang="ts"><code><span class="line"><span class="nb-shiki-1itgoe">const</span><span class="nb-shiki-dzsirb"> response</span><span class="nb-shiki-1itgoe"> =</span><span class="nb-shiki-1itgoe"> await</span><span class="nb-shiki-140thh"> env.</span><span class="nb-shiki-dzsirb">AI</span><span class="nb-shiki-140thh">.</span><span class="nb-shiki-1t8gfj">run</span><span class="nb-shiki-140thh">(</span><span class="nb-shiki-mdbnqw">"@cf/cloudflare/clef"</span><span class="nb-shiki-140thh">, {</span></span> <span class="line"><span class="nb-shiki-140thh"> model: </span><span class="nb-shiki-mdbnqw">"clef"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> state: </span><span class="nb-shiki-mdbnqw">"Checkout has been failing for every customer for the last hour."</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> questions: {</span></span> <span class="line"><span class="nb-shiki-140thh"> urgent: {</span></span> <span class="line"><span class="nb-shiki-140thh"> type: </span><span class="nb-shiki-mdbnqw">"noul"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> instructions: </span><span class="nb-shiki-mdbnqw">"Is this support request urgent?"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh"> team: {</span></span> <span class="line"><span class="nb-shiki-140thh"> type: </span><span class="nb-shiki-mdbnqw">"choice"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> instructions: </span><span class="nb-shiki-mdbnqw">"Which team should handle this request?"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> criteria: {</span></span> <span class="line"><span class="nb-shiki-140thh"> billing: </span><span class="nb-shiki-mdbnqw">"Payments, invoices, and refunds"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> technical: </span><span class="nb-shiki-mdbnqw">"Outages, errors, and configuration"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> sales: </span><span class="nb-shiki-mdbnqw">"Plans and upgrades"</span><span class="nb-shiki-140thh">,</span></span> <span class="line"><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh"> },</span></span> <span class="line"><span class="nb-shiki-140thh">});</span></span> <span class="line"></span> <span class="line"><span class="nb-shiki-21nrsd">// response.answers.urgent.noul -&gt; probability the request is urgent</span></span> <span class="line"><span class="nb-shiki-21nrsd">// response.answers.team.choice -&gt; highest-probability team</span></span></code></pre></figure></div></div></div><script type="module" src="https://developers.cloudflare.com/home/runner/work/cloudflare-docs/cloudflare-docs/src/components/ui/tabs/Tabs.astro?astro&type=script&index=0&lang.ts"></script></div> <div tabindex="-1" class="heading-wrapper level-h4"><h4 id="what-you-can-build-with-decision-models">What you can build with decision models</h4><a class="anchor-link" href="#what-you-can-build-with-decision-models"><span aria-hidden="true" class="anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span></a></div> <ul> <li><strong>Support triage</strong>: Decide whether a ticket is urgent and which team owns it, then route it without a human in the loop.</li> <li><strong>Threat intelligence</strong>: Classify a website by category. Paired with <a href="https://developers.cloudflare.com/browser-run/">Browser Run</a>, Clef fetched, rendered, and classified a domain in 2.2 seconds, compared to 4.7 seconds for <code>gpt-oss-120b</code> in the same workflow.</li> <li><strong>Trust and safety</strong>: Score user submissions against your own policy rubric and act on the probability.</li> <li><strong>Agent guardrails</strong>: Let an agent check "should I take this action?" in tens of milliseconds before calling a tool.</li> <li><strong>Visual classification</strong>: Pass up to four images alongside the state. Unlike text-only decision models, Clef has a vision encoder.</li> </ul> <div tabindex="-1" class="heading-wrapper level-h4"><h4 id="get-started">Get started</h4><a class="anchor-link" href="#get-started"><span aria-hidden="true" class="anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span></a></div> <p>Use Clef through the <a href="https://developers.cloudflare.com/workers-ai/configuration/bindings/">Workers AI binding</a> (<code>env.AI.run()</code>) or the REST API at <code>/ai/run</code>. You can also use <a href="https://developers.cloudflare.com/ai-gateway/">AI Gateway</a> with these endpoints.</p> <p>For more information, refer to the <a href="https://developers.cloudflare.com/workers-ai/models/clef/">Clef model page</a>, the <a href="https://developers.cloudflare.com/workers-ai/models/clef-flash/">Clef-flash model page</a>, and <a href="https://developers.cloudflare.com/workers-ai/platform/pricing/">pricing</a>.</p>

The text above is the source's. reef added the severity, the dates it could read from the text, and the endpoints and scopes named in code.