File size: 3,270 Bytes
9eeb9cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
license: apache-2.0
base_model: Qwen/Qwen3-0.6B
base_model_relation: finetune
pipeline_tag: text-classification
library_name: transformers
tags:
- decision-model
- typed-output
- classification
- clef
- systemone
- distillation
- qwen3
- fluidinference
---

# clef-text-0.6b

A 0.70B-parameter text decision model distilled from Cloudflare's
[clef-flash](https://huggingface.co/Cloudflare/clef-flash) (9B): [Qwen3-0.6B](https://huggingface.co/Qwen/Qwen3-0.6B)
(LoRA merged) + Clef's joint schema head. Same Jev / SystemOne contract: one probability per option of every typed
question, one forward pass. Good at routing and classification; not a knowledge model (see the table).

Apple silicon / Neural Engine build: [FluidInference/clef-text-0.6b-coreml](https://huggingface.co/FluidInference/clef-text-0.6b-coreml).

## Usage

`joint_schema_model.py` is Cloudflare's unchanged Clef module (record encoding, head, `ClefModel`).

```python
import json, sys, torch
from huggingface_hub import snapshot_download
from safetensors.torch import load_file
from transformers import AutoModelForCausalLM, AutoTokenizer

path = snapshot_download("FluidInference/clef-text-0.6b")
sys.path.insert(0, path)
from joint_schema_model import ClefModel, JointSchemaHead, collate_records, encode_record

tokenizer = AutoTokenizer.from_pretrained(path)
backbone = AutoModelForCausalLM.from_pretrained(path, dtype=torch.float32)
head = JointSchemaHead(**json.loads(open(f"{path}/joint_head_config.json").read()))
head.load_state_dict(load_file(f"{path}/joint_head.safetensors"))
model = ClefModel(backbone, head).eval()

record = {"state": "Our checkout is down and customers can't pay.",
          "questions": {"team": {"type": "choice", "instructions": "Which team should handle this?",
                                 "criteria": {"billing": "Payments", "engineering": "Bugs or outages"}},
                        "urgency": {"type": "score", "criteria": ["Low", "Normal", "High", "Critical"]}}}
encoded = encode_record(tokenizer, record)
with torch.inference_mode():
    logits = model(collate_records([encoded], tokenizer.pad_token_id, torch.device("cpu")))[0]
for question, question_logits in zip(encoded.questions, logits):
    print(question.question_id, dict(zip(question.option_ids, question_logits.softmax(-1).tolist())))
```

## Quality (held-out test splits, gold accuracy)

| Task | this model | clef-flash 9B |
|---|---:|---:|
| DBpedia-14 | 99.7 | 100.0 |
| AG News | 90.7 | 92.0 |
| SST-2 | 90.0 | 94.0 |
| BANKING77 | 86.4 | 94.5 |
| TweetEval offensive | 85.0 | 82.3 |
| Yelp stars | 69.0 | 70.7 |
| Emotion | 68.0 | 58.0 |
| BoolQ | 82.3 | 90.7 |
| MNLI | 72.3 | 84.3 |
| ARC-Easy | 80.0 | 100.0 |
| CommonsenseQA | 65.0 | 94.3 |
| ARC-Challenge | 60.7 | 97.3 |
| **all (5,124 q)** | **79.1** | **88.2** |

Training: 24,208 records from 12 public datasets (train splits) labelled by clef-flash, KL (T = 2) + 0.3 gold CE,
LoRA r64 + full head, 2 epochs on an M5 Pro.

## License and credits

Apache-2.0. `joint_schema_model.py` and `LICENSE` are Cloudflare's (Apache-2.0). Teacher
[Cloudflare/clef-flash](https://huggingface.co/Cloudflare/clef-flash); base [Qwen/Qwen3-0.6B](https://huggingface.co/Qwen/Qwen3-0.6B).
By [Fluid Inference](https://fluidinference.com).