Clef-ANE-LUT6
Model architecture
A mixed-precision conversion of Cloudflare/clef for the Apple Neural Engine (ANE) on Apple Silicon Macs. It answers questions about text, images and short videos with yes/no, choice and score outputs; it does not generate text.
| Component | Structure |
|---|---|
| Text backbone | 64 layers; hidden size 5,120; MLP intermediate size 17,408 |
| Attention layout | 48 Gated DeltaNet linear-attention layers (16 key and 48 value heads, head size 128) and 16 full-attention layers (24 query and 4 key-value heads, head size 256), with full attention every fourth layer |
| Decision head | 4 layers; width 1,024; 16 heads; 2 routing layers |
| Vocabulary | 248,320 tokens |
| Vision encoder | 27 layers; hidden size 1,152; 16 heads; 16×16 patches with two-frame temporal patches; 2×2 merge into the 5,120-wide text embedding space. Shared by images and video |
| Context | Up to 16,384 tokens, processed 128 tokens per ANE call; full-attention programs for 1,024, 2,048, 4,096, 8,192 and 16,384 tokens |
| ANE programs | 97 for text. Each run of three linear-attention layers is one program, together with the MLP of the full-attention layer before it, because macOS keeps at most 127 programs on the ANE across all apps. The vision encoder adds 27 |
The payload is approximately 22.94 GiB: ANE programs 17.09 GiB, token embeddings and LM head 4.74 GiB, decision head 0.24 GiB, vision encoder 0.86 GiB. These are on-disk sizes, not RAM requirements. On an M5 Pro with 64 GB of memory, loading every program took about 7 minutes, and the loaded model held about 24 GiB of wired memory, plus about 3 GiB in the serving process.
| Component | Runs on |
|---|---|
| Text backbone (64 layers) | ANE |
| Vision transformer (27 layers) | ANE, FP16. One fixed program per layer over 1,024 patches; images and video frame pairs are packed with a block-diagonal attention mask |
| Patch embedding, vision positions and 2×2 merger | CPU |
| Token embedding lookup and decision head | CPU |
No GPU is used.
Format compatibility: this is a custom artifact, not a standard Transformers, MLX or Core ML .mlpackage checkpoint. The text layers are stored as MIL program descriptions with packed weights, compiled on the destination Mac when loaded. Other tensors are safetensors. Loading uses Apple's private ANE interface, which may change with macOS updates; only an M5 Pro running macOS 27 has been tested.
Weight precision
| Component | Stored precision |
|---|---|
| Large text linear layers: MLP gate/up/down, linear-attention QKV/Z/output, full-attention Q/K/V/O | LUT-6: 6-bit indices with one 64-entry FP16 table per 16 output channels |
| Other text-program weights: normalization, short convolution, small gate projections and decay parameters | FP16, converted from BF16 |
| Token embeddings, LM head and final normalization | Original BF16 |
| Decision head | Original BF16 |
| Vision encoder | Original BF16; converted to FP16 when loaded onto the ANE. Not LUT-quantized |
LUT-6 text weights
- Every linear layer with at least 1,048,576 weights is quantized. Each group of 16 output channels has its own 64-value table, found by 40 rounds of one-dimensional k-means. Half of the starting values are quantiles; the other half are spread evenly between the group's minimum and maximum, so that outlying weights also get table values.
- Four 6-bit indices are packed into three bytes in Core ML's little-endian layout. Including the tables, a layer with 5,120 inputs stores about 6.01 bits per weight.
- Activations run in FP16 on the ANE. The MLP down-projection input is scaled up by as much as 16× and attention probabilities by 16× to keep precision in FP16; both are scaled back afterwards.
- Quantization is lossy; the original BF16 weights cannot be reconstructed exactly.
Vision weights
- The vision layers are not LUT-quantized. LUT-6 was rejected for them on Clef-Flash, whose encoder has the same shape; it was not measured again for this model.
- Inputs that overflow FP16 in the vision encoder are rejected rather than answered.
- The vision programs are built from these weights on the destination Mac when the first image or video arrives, which took about 11 seconds on an M5 Pro.
The original tokenizer, chat template, configuration and image/video processor settings are retained. File sizes and SHA-256 checksums are recorded in the bundle manifest.
Validation
The original BF16 multimodal model was the reference, with identical preprocessing. It does not fit in the test Mac's memory at once, so it was run one decoder layer at a time; on Clef-Flash, that procedure reproduces the whole-model result bit for bit.
- On a fixed regression set of 17 synthetic text, image and video requests (27 questions), the selected answer matched on 27 of 27 questions; the largest probability difference was 0.004. Both models met all 27 synthetic expectations.
- On 8 text-only requests (29 questions), two of them about 4,900 and 15,300 tokens long, the selected answer matched on 28 of 29 questions; the largest probability difference was 0.038. The one differing question is a near-tie in the original model, whose top two options are 0.019 apart.
- During the 17 requests, repeated twice, the serving process recorded 0 ns of GPU time on an M5 Pro running macOS 27.
This is a regression check, not a general accuracy benchmark. Images were resized with Pillow to at most 262,144 pixels (256 visual tokens). Video was sampled about twice per second by presentation timestamp, up to 64 frames of at most 65,536 pixels each. Audio is not used.
Source and license
Source revision: 0b331204bb13fbd2ca93a64df1956f5b55478ce5.
Original model Clef by Cloudflare, post-trained from Qwen3.8-27B by Qwen. Conversion by Yanun. Released under Apache-2.0, the license of the source model. Redistributions must retain LICENSE and NOTICE.
This is not an official Cloudflare, Qwen or Apple release.
- Downloads last month
- 23