Clef-Flash 9B for Core AI: document decisions on your Mac

Give a document and a checklist of allowed answers. This bundle returns a probability for each answer and can reuse the document while you change the checklist. It converts Cloudflare's Clef-Flash for Apple's Core AI framework. The public companion Swift app includes document review and a fridge-to-recipe demo.

Swift sample app · Document checklist · Fridge-to-recipe demo · Verification

For: Swift developers exploring local document classification and editable decision schemas. Not for: free-form chat, direct photo input, or a calibrated production decision service. Requirements: Apple silicon, macOS 27, Xcode 27 with Metal Toolchain; GPU execution. Tested on M4 Max with 128 GB. A minimum-memory configuration has not been established.

Quick start

Install the Hugging Face CLI, then download the bundle and the public sample app:

hf download okayuji/clef-flash-9b-coreai-decide --local-dir ./clef-flash-9b-decide-v1
git clone https://github.com/oka-yuji/coreai-samples.git

Open coreai-samples/CoreAISamples.xcodeproj, choose the CoreAISamples scheme and My Mac, set the Run build configuration to Release, and run. In the sidebar, choose Clef-Flash 9B with the description Check a document against an editable checklist, then Open decision bundle… and select the downloaded folder containing decision.json. Choose Maintenance agreement, then Run checklist. For Recipes, choose the Clef-Flash entry described as Can you make this recipe with what you have?, open the same bundle, and follow the recipe demo instructions.

The same app can run the recorded request without opening a window. Set DECIDE_APP to the built app executable:

COREAI_DECISION_BUNDLE="$PWD/clef-flash-9b-decide-v1" "$DECIDE_APP" --decide-json clef-flash-9b-decide-v1/examples/maintenance-request.json response.json

This command uses the app's tested JSON entry point. The Swift API and context-reuse contract are in the companion repository.

Recorded output

The complete request is a fictional Japanese maintenance agreement with five questions. One asks whether the agreement renews automatically: “契約期間の満了時に、合意をし直さず自動的に更新する定めがあるか。” The exact answer object for that question in the recorded response is:

{"type":"noul","noul":0.0107}

Here noul is the probability of true. The complete request used 2,645 input tokens and took 4.277018792 seconds for a complete read. Changing the questions while reusing the same document took 0.775898292 seconds and reused 2,067 tokens in the associated app scenario. These are recorded results from 2026-10-08 on M4 Max 128 GB, macOS 27.0 (26A428), Xcode 27 / Swift 6.4, Release, one model operation at a time. Opening the selected bundle is outside these timings; runtime preparation/reloads inside a request are included. See measurement sources.

Key numbers

The following integration measurements use this exact bundle, the companion Swift runtime, M4 Max 128 GB, macOS 27.0 (26A428), Xcode 27 / Swift 6.4, Release, and serialized model execution on 2026-10-07–08. They describe the fixed inputs in the verification record.

Check Observed result
Model payload 15 files, 7,278,548,313 bytes; documentation and examples are additional
Complete-request limit 9,216 rendered input tokens, including questions and options
Question frame 1–16 questions, 1–8 options per question
Same uint4 weights, PyTorch fp32 reference Maximum probability difference 0.016693930 across ten fixed documents; all 40 top options matched
Fixed four-question 8K document, 20 reuse calls p95 0.846601958 seconds
Alternating one and twelve questions on the same 8K document About 1.5–2.7 seconds per call, including runtime reloads

The sub-second result applies to the fixed four-question case. Larger changes to question shapes require reloading the Core AI models while retaining document state. These numbers do not establish accuracy on new documents or calibrate the probabilities.

How it works

The uint4 backbone reads the text and returns hidden states. A separate fp16 joint schema head scores the allowed options. Original BF16 lexical embeddings supply the option vectors. The runtime applies a softmax per question and keeps the document's recurrent/KV state for reuse.

The conversion uses fp32 gated-delta state updates inside the backbone, with the surrounding computation in BF16. It includes text assets only; the original model's vision encoder is omitted.

In the Recipes demo, Apple's on-device SystemLanguageModel reads the fridge photo. The user checks the suggested inventory. Clef-Flash reads the recipe text to classify ingredient requirements and equipment. Swift code matches confirmed stock and compares quantities. The developer panel shows the actual decision probabilities, logits, timings, and token counts. Recipe URLs need an internet connection; model inference runs on the Mac.

Input contract

Use the companion DecisionModel, not a chat loader or a generic Transformers pipeline. Requests contain state and ordered questions; question types are choice, noul (true/false), and score (ordered options). The included request demonstrates all three.

decision.json fixes the rendering version to the upstream joint_schema_model.py at revision 17f0b0ad64efb65d273590632833508766b2aae6. The companion renderer implements that contract, including question/option spans. Do not substitute the ordinary Qwen chat template.

The reusable document context in the Decide screen reserves 1,024 tokens for the questions. Inputs that exceed either the reserved question budget or the complete-request limit are rejected without truncation. A model owns one current context; starting another document or making a complete read invalidates the previous context handle.

Files

The model payload is copied byte-for-byte from the verified clef-flash-9b-decide-v1 bundle. The main asset sizes were checked during packaging on 2026-10-09:

Path Purpose Bytes
backbone/clef_flash_9b_hidden_gdnfp32_qwen3_5_cfg_dynamic.aimodel/main.mlirb Text backbone 4,980,751,116
backbone/lexical.safetensors Original BF16 lexical vectors 2,034,237,672
head/clef_flash_9b_head_q16o8_fp16.aimodel/main.mlirb Decision head 243,542,718
backbone/tokenizer/tokenizer.json Tokenizer 19,989,325
decision.json Bundle contract and source/conversion versions 2,224
SHA256SUMS Checksums of the other 14 model-payload files 1,519

The payload also contains the model metadata/hash files, tokenizer settings/template, Apache license, and conversion notice. README.md, VERIFICATION.md, examples/, and verification/ document the payload; they are not model weights. backbone/metadata.json retains the converter's kind: llm, but the backbone outputs hidden states, not vocabulary logits. decision.json is the entry point.

Operational notes

  • Keep the complete directory structure. Loading verifies the manifest and every SHA256SUMS entry before model specialization. SHA-256 mismatch: <file>. indicates a changed or incomplete file; download that file again. Unsupported decision bundle contract. means the selected folder does not match this loader's contract.
  • The first load prepares the models for the GPU and may take longer. Core AI stores a prepared copy under its cache directory; a different executable or OS build can need another prepared copy. Leave disk space for both the download and specialization cache.
  • Use the companion runtime's document lifecycle and reload handling. An earlier implementation accumulated GPU workspace when alternating input shapes; the published Swift implementation was checked with twenty-call alternating workloads. That test is not an unlimited-session guarantee.
  • This document context is no longer current. means a newer document or complete read replaced the old context. Create a context for the document you want to use.

Limitations

  • This is a developer demo and a model conversion. The probabilities are uncalibrated scores over the supplied options, not measured chances of correctness. Include an unknown/not-stated option and human review where appropriate.
  • It has no vision encoder, audio input, free-form generation, or iOS validation. The recipe demo's photo model runs on the device, is separate from Clef, and requires Apple Intelligence availability. Fetching the recipe URL requires an internet connection.
  • The ten-document integration comparison covers the 1K/2K/4K/8K document groups. The at-or-below-512-token band was not tested by that integration run. It does not establish general Japanese or English task accuracy.
  • Comparison against the same quantized weights measures conversion fidelity; it does not remove quality changes caused by uint4 quantization.
  • Only the stated M4 Max configuration was measured. Smaller Macs, other OS/SDK versions, and long-running production workloads need their own validation.

Verification

VERIFICATION.md links the copied request/response, raw measurement summaries, fixed conditions, and the source-record identifiers. Bundle version is the SHA-256 of decision.json:

67f69d5bd401104fd594ba74d94622882341c138be6149132d68f9857def852d

The checks include numerical agreement with the lab reference, complete-read versus reuse, cancellation recovery, edited question shapes, and GUI/JSON-path agreement. The GUI and cancellation summary adds the original test outcomes and source hashes for the last two checks; it is a summary of the 2026-10-07–08 records, not a new run. They establish the tested integration behavior, not production readiness or probability calibration.

License and attribution

The model assets are distributed under Apache License 2.0, inherited from Cloudflare/clef-flash, which is post-trained from Qwen/Qwen3.5-9B. The upstream license and Alibaba Cloud copyright notice are retained unchanged. NOTICE.md lists the conversion changes and tool versions. The companion Swift code has its own MIT license.

Converted by Yuji Oka. This is an independent conversion, not a Cloudflare or Apple release. Clef-Flash, Cloudflare, Qwen, and Apple names identify their respective upstream models and platforms; no endorsement or trademark rights are implied.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for okayuji/clef-flash-9b-coreai-decide

Finetuned
Qwen/Qwen3.5-9B
Quantized
(58)
this model