Cloudflare/clef
- License
- apache-2.0
- Size
- 51 GB
- Revision
- main
Mirrored from Cloudflare/clef
All models by Cloudflare →Mirrored from Cloudflare/clef
All models by Cloudflare →Clef is a 27B multimodal model that turns a state and a schema of typed questions into decisions. It reads the state as text, JSON, images, or video, and returns a probability for every allowed option of every question in a single forward pass. There is no free-form text generation and no output parsing.
The Clef API is fully compatible with Jev and SystemOne.
Clef is post-trained from Qwen/Qwen3.8-27B. See Clef-Flash for the smaller, faster variant.
Tested with torch 2.11 and transformers 5.10.2 on a single H200. Image and video inputs also
need pillow.
systemone takes a Jev/SystemOne POST /v1/systemone request body and returns the same response
body: model, answers keyed by question ID, and usage. A choice answer has choice,
confidence, and probabilities; a score answer has the expected score, confidence, legend,
and probabilities; a noul answer has the probability of true. instructions is optional, and
images and videos may be added to the request.
Add images (PIL images) or videos (frame arrays) to the record and pass the processor to
encode_record. Optional processor arguments go in media_kwargs.
Text-only and multimodal records can be mixed in the same batch.
Each question has:
type: noul (true/false), choice (named options), or score (ordered options)instructions: what to decide; optional, and the question ID is used when it is omittedcriteria: for choice, a mapping of option ID to description; for score, a list of option
descriptions indexed from 0; for noul, optional descriptions for true and falseencode_record accepts max_length (default 16,384 tokens) and max_state_tokens to bound the input.
Per-benchmark results from our internal run of the Decision Index 0.2.1 suite. Scores are percentages; ForecastBench is a Brier score, where lower is better. The last two rows are request latency in milliseconds, where lower is better. The best value in each row is in bold.
Decision accuracy on four end-to-end business workflows from Typesafe Evals, scored against consensus reference labels. All models are scored on the same dataset revision and case cohort.
Released under the Apache-2.0 license, following the base model Qwen/Qwen3.8-27B.
import sys
import torchfrom huggingface_hub import snapshot_download
path = snapshot_download("Cloudflare/clef")sys.path.insert(0, path)from joint_schema_model import collate_records, encode_record, load_release_model
model, processor = load_release_model(path, device="cuda")
record = { "state": {"invoice": {"vendor": "Acme", "total": 1250.0, "currency": "USD", "status": "overdue"}}, "questions": { "status": { "type": "choice", "instructions": "What is the invoice status?", "criteria": {"paid": "Invoice is paid.", "overdue": "Invoice is past due.", "draft": "Not sent."}, }, "large": {"type": "noul", "instructions": "Is the total above 1000 USD?"}, },}
encoded = encode_record(processor.tokenizer, record, processor=processor)batch = collate_records([encoded], processor.tokenizer.pad_token_id, torch.device("cuda"))with torch.inference_mode(): logits = model(batch)[0]
for question, question_logits in zip(encoded.questions, logits): probabilities = question_logits.float().softmax(-1).tolist() print(question.question_id, dict(zip(question.option_ids, probabilities)))from joint_schema_model import systemone
response = systemone(model, processor, { "model": "clef", "state": "Our checkout started returning errors and orders are blocked.", "questions": { "department": { "type": "choice", "instructions": "Which team should handle the message?", "criteria": {"billing": "Payments or invoices", "technical": "Bugs or outages"}, }, "urgency": {"type": "score", "criteria": ["Can wait", "This week", "Today"]}, "outage": {"type": "noul", "instructions": "Is a service down?"}, },})print(response["answers"])from PIL import Image
record = { "state": {"task": "Review the attached receipt."}, "images": [Image.open("receipt.jpg")], "questions": { "legible": {"type": "noul", "instructions": "Is the receipt total legible?"}, },}encoded = encode_record(processor.tokenizer, record, processor=processor)