shiichan

A model that doesn't write text? Inside Clef and RL fine-tuning

Hi everyone, Shii-chan here! Today I'm sharing a Cloudflare Blog post that explains what's inside Clef!

Cloudflare Blog blog.cloudflare.com

What was announced?

The Cloudflare Blog introduced Clef and Clef-flash, open-source decision models hosted on Workers AI for high-speed classification and agentic workflows. It also announced a new reinforcement learning (RL) platform for fine-tuning decision models.

The Changelog post says the models are available. This one is the more technical piece about how they are built and why.

Why it matters

Decision models classify inputs and return typed answers with probabilities, so agents can decide how to act without a human checking every step. The decisions come in a form programs can use directly.

What changes

  • No need to generate and interpret text for every decision
  • You can pass images along with text
  • The weights are public on Hugging Face
  • There is a path to tune the model on your own data

Clef is non-autoregressive. It scores the schema choices in parallel instead of generating token by token, which is why it is fast.

Dive Deep

The models:

  • Clef: 27B parameters, 64K token context window
  • Clef-flash: 9B parameters, 64K token context window

The post also notes that Jev has a 32K context and no image support, while Clef handles both text and images.

There are three question types:

  • Yes/no: returns probabilities
  • Choice: returns a probability for each defined option
  • Score: rates against ordered rubrics

You can ask up to 64 questions per request and pass up to four images with the text. You call the models through a Workers AI binding or the REST API.

For training, Clef uses Qwen as the backbone with a two-stage attention routing process built on low-rank adapters. It uses label-smoothed cross-entropy and a custom optimization called Reinforcement Learning for Calibrated Decisions (RLCD).

In benchmarks, median latency was 209.3 ms for Clef, 38.8 ms for Clef-flash, and 524.1 ms for Jev. Clef leads in 7 of 10 decision benchmarks, with 94.20 macro-F1 on BANKING77 and 97.43 on CLINC150+OOS.

RL fine-tuning comes in two forms:

  • Hands-on partnership: Cloudflare engineers help with custom tuning
  • Self-serve: capture data, fine-tune, and redeploy (planned)

Pricing was not disclosed in the post.

Wrap-up

  • Clef (27B) and Clef-flash (9B) are decision models with 64K context
  • They return typed answers with probabilities instead of text
  • Up to 64 questions and four images per request
  • Open under Apache 2.0 on Hugging Face and available on Workers AI
  • RL fine-tuning offers a path to tune them for your own use

This is for anyone who wants to replace classification or routing with something low-latency!