mili-tan commited on
Commit
75f1591
·
verified ·
1 Parent(s): 218db46

Upload folder using huggingface_hub

Browse files
Files changed (5) hide show
  1. .gitattributes +2 -0
  2. README.md +149 -0
  3. kev-0.8b-q8_0.gguf +3 -0
  4. kev-head.f32 +3 -0
  5. kev.json +6 -0
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ kev-0.8b-q8_0.gguf filter=lfs diff=lfs merge=lfs -text
37
+ kev-head.f32 filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ license: apache-2.0
4
+ library_name: llama.cpp
5
+ base_model: Qwen/Qwen3.5-0.8B-Base
6
+ base_model_relation: quantized
7
+ pipeline_tag: text-classification
8
+ tags:
9
+ - decision-model
10
+ - calibration
11
+ - lora
12
+ - multiple-choice
13
+ - typesafe
14
+ - qwen3.5
15
+ - gguf
16
+ - llama.cpp
17
+ datasets:
18
+ - legacy-datasets/banking77
19
+ - google/boolq
20
+ - fancyzhx/ag_news
21
+ - nyu-mll/multi_nli
22
+ - SetFit/sst5
23
+ - Yelp/yelp_review_full
24
+ - CogComp/trec
25
+ - fancyzhx/dbpedia_14
26
+ - SetFit/amazon_reviews_multi_en
27
+ - stanfordnlp/imdb
28
+ metrics:
29
+ - accuracy
30
+ - brier_score
31
+ - expected_calibration_error
32
+ model-index:
33
+ - name: Kev-0.8B
34
+ results:
35
+ - task: { type: text-classification, name: typed decision (choice / noul / score) }
36
+ dataset: { type: mixed, name: "decision-v7 development (1,204 records; ten trained public sources + programmatic policy data)" }
37
+ metrics:
38
+ - { type: accuracy, value: 0.825 }
39
+ - { type: expected_calibration_error, value: 0.110, name: "ECE, raw probabilities" }
40
+ - task: { type: text-classification, name: typed decision, out-of-domain }
41
+ dataset: { type: mixed, name: "transfer-v4 development (764 records; six never-trained sources + held-out policy structures)" }
42
+ metrics:
43
+ - { type: accuracy, value: 0.652 }
44
+ - { type: brier_score, value: 0.499 }
45
+ ---
46
+
47
+ # Kev-0.8B
48
+
49
+ Kev-0.8B is a **decision model**: one document (the *state*) and a set of typed questions in, a probability distribution per question out, in one forward pass. No text generation. It is a LoRA adapter (r=16, 11.3M trainable parameters) plus a pointer head on `Qwen/Qwen3.5-0.8B-Base` (revision `dc7cdfe2`), serving TypeSafe's public `/v1/systemone` contract.
50
+
51
+ **The small member of the Kev family.** Same data and recipe as the 0.6B it replaces, on the Qwen3.5 base: in-distribution 0.825 (Kev-0.6B 0.801), out of domain 0.652 (0.620), and it is the first small Kev that learns any rule composition (held-out pairs 0.42 vs 0.08). Three seeds of the base recipe: transfer 0.622 / 0.634 / **0.643**; this checkpoint is seed 2 (selected on development accuracy) followed by a 9-minute **delta fine-tune** on 1,425 generated records (date-bearing policy cases with explicit day counts; evidence-free cases with uniform targets) mixed with 2,000 replayed training records — the same delta as Kev-4B and Kev-9B. Locked test against the pre-delta checkpoint: out of domain 0.668 → **0.684** (+2.2 pp [−0.8, +5.5]), Brier 0.473 → 0.460. Out of domain it is still a sub-1B model: use Kev-4B for accuracy; use this one where memory rules the 4B out, and measure on your own data.
52
+
53
+ - Hub: `jaredpalmer/kev-0.8b` (this repo; trial `night2-08b-du2/00-trial-0`). The pre-delta checkpoint is at revision `v7-base`.
54
+ - Demo: [huggingface.co/spaces/jaredpalmer/kev](https://huggingface.co/spaces/jaredpalmer/kev) runs Kev-4B and Kev-0.8B on ZeroGPU with the same encoder and API code as `kev.serve`.
55
+ - Code, suites, results, and the full research log: [github.com/jaredpalmer/kev](https://github.com/jaredpalmer/kev) — `PLAN_Qwen35.md`, `PLAN.md`, `runs/leaderboard.md`
56
+
57
+ ## Results (same frozen items for every row)
58
+
59
+ | | Kev-0.6B (Qwen3) | **Kev-0.8B** | Kev-4B | Kev-9B | Jev |
60
+ |---|---|---|---|---|---|
61
+ | in-distribution accuracy (decision-v7 dev, 1,204 records) | 0.801 | **0.825** | 0.872 | 0.872 | 0.845 |
62
+ | out-of-domain accuracy (transfer-v4 dev, 764 records) | 0.620 | **0.652** | 0.797 | 0.822 | 0.857 |
63
+ | out-of-domain Brier | 0.536 | **0.499** | 0.299 | 0.286 | 0.211 |
64
+ | confident errors out of domain (p ≥ 0.9 and wrong) | 10.8% | 9.9% | 6.9% | 8.7% | 3.7% |
65
+ | coverage at ≤ 5% error (share of decisions automatable) | – | 0.23 | 0.54 | 0.47 | 0.70 |
66
+ | held-out policy structures, both siblings correct | 0.08 | **0.42** | 0.78 | 0.83 | 0.86 |
67
+ | option-order flip rate | 0.07 | 0.08 | 0.08 | 0.03 | 0.00 |
68
+ | none-option present, accuracy | 0.80 | 0.83 | 0.92 | 0.90 | – |
69
+ | as served (built-in T = 2.41): Brier / ECE / confident errors | – | 0.430 / 0.054 / 0.3% | | | |
70
+
71
+ Per-source out-of-domain accuracy (Kev-0.8B / Jev): QNLI 0.85 / 0.93, SciQ 0.91 / 0.99, TweetEval-offensive 0.68 / 0.81, PAWS 0.55 / 0.79, MMLU 0.42 / 0.90, Emotion 0.54 / 0.59, authorization 0.97 / 1.00, deadline (3-level date arithmetic) 0.38 / 0.93, (A or B) and C 0.66 / 0.91, (A and B) or not C 0.56 / 0.97, if A then not B else C 0.59 / 0.78.
72
+
73
+ Paired against Kev-0.6B on the same items (record-clustered bootstrap), before the delta: +5.7 pp [+1.2, +10.0] out of domain; the delta adds +0.5 pp [−3.2, +3.8] on development and +2.2 pp on the locked test.
74
+
75
+ **Locked test, read once per checkpoint** (`runs/locked/kev-08b-night2-du-ungated/`; pre-delta `runs/locked/kev-08b-q35-ungated/`): in-distribution **0.834** (Brier 0.268, ECE 0.100), out-of-domain **0.684** (Brier 0.460, ECE 0.154, confident errors 8.7%, held-out pairs 0.45). Pre-delta: 0.827 / 0.668; Kev-0.6B on the same test items: 0.808 / 0.642.
76
+
77
+ ## Known limits
78
+
79
+ - **Out of domain it is a sub-1B model.** Knowledge (MMLU 0.41) and paraphrase (PAWS 0.59) are near the untrained base; the same recipe reaches 0.79 at 4B and 0.81 at 9B on these items.
80
+ - **Slow on a Mac for its size.** The DeltaNet kernels have no MPS implementation; a five-question request takes ~0.33 s in bf16 on an M5 (Kev-0.6B: 0.12 s). On CUDA with `flash-linear-attention` it is fast.
81
+ - Requires `transformers >= 5.17` and `peft >= 0.21`.
82
+ - Ordinal hedging on date arithmetic (`deadline` 0.38): collapses to the middle level. `KEV_DATE_FACTS=1` (day counts appended to the state) helps the larger models more than this one.
83
+ - Confident-error rate out of domain is 9.9% for the raw logits; the built-in temperature (T = 2.41, fitted on the in-distribution development rows and stored in `head.pt`) brings it to 0.3% and ECE from 0.179 to 0.054 without changing any answer. `KEV_TEMPERATURE=1.0` gives the raw values. Probabilities are usable in-domain; treat them as advisory elsewhere.
84
+
85
+ ## Training
86
+
87
+ Frozen suite `evals/v7/decision-v7`: 10,000 public records (1,000 per source), 896 policy minimal-pair records over nine template families, 1,680 records from 60 randomly generated rule structures in four rendering styles. Two epochs, LoRA r=16 α=32 on attention, MLP and DeltaNet projections; pointer head from scratch; cross-entropy on the option distribution; lr 1e-4 (OneCycle), batch 8, bf16 autocast with fp32 master weights; option permutation, none-of-the-above insertion, distractors, none minimal pairs on 25% of Choice records; ~20 min on one H100. Then the delta: `--init_from jaredpalmer/kev-0.8b@v7-base --data evals/night2/dates_unknowable.jsonl --replay 2000 --lr 4e-5 --epochs 1`, 9 minutes. No Jev outputs were used for training.
88
+
89
+ ## Evaluation protocol
90
+
91
+ Development partitions select models; the locked test partition is read at most once per candidate. Every number carries suite hash, code hashes and git commit in `result.json`.
92
+
93
+ ## Use
94
+
95
+ ```bash
96
+ uv run --extra serve python -m kev.serve --run jaredpalmer/kev-0.8b --port 8008
97
+ ```
98
+
99
+ Any TypeSafe-compatible client works: `TypeSafeClient(api_key="local", base_url="http://127.0.0.1:8008", model="kev-latest")`.
100
+
101
+ ## License
102
+
103
+ Apache-2.0 for the adapter and head; the Qwen3.5 base is Apache-2.0; datasets carry their own licenses.
104
+
105
+ ## GGUF
106
+
107
+ A merged, quantized GGUF for CPU inference is available through
108
+ [dohnuts.cpp](https://github.com/DreamBlooms/dohnuts.cpp), a native C++ port on
109
+ [llama.cpp](https://github.com/ggml-org/llama.cpp). It merges this LoRA into
110
+ `Qwen/Qwen3.5-0.8B-Base` and serves the same `POST /v1/systemone` wire format.
111
+ No GPU or Python runtime is needed.
112
+
113
+ | File | Contents | Size |
114
+ | --- | --- | ---: |
115
+ | `kev-0.8b-q8_0.gguf` | Q8_0 merged language model | 775 MB |
116
+ | `kev-head.f32` | bilinear pointer head (q then k, bias last) | 2.1 MB |
117
+ | `kev.json` | pointer dimension and fitted temperature | 101 B |
118
+
119
+ The pointer head and `kev.json` are required alongside the GGUF. The conversion
120
+ merges the adapter in fp32 before quantizing; this matches the torch `merge`
121
+ path. It has not been benchmarked against the PyTorch reference.
122
+
123
+ ```sh
124
+ git clone https://github.com/DreamBlooms/dohnuts.cpp
125
+ cd dohnuts.cpp
126
+ git submodule update --init --depth 1
127
+ cmake -B build -DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=ON
128
+ cmake --build build -j --target dohnuts-cli
129
+
130
+ build/dohnuts-cli --server --port 8080 --profile kev \
131
+ --model kev-0.8b-q8_0.gguf --head kev-head.f32 --metadata kev.json
132
+ ```
133
+
134
+ Ask one state several questions (the same request shape as `kev.serve`):
135
+
136
+ ```sh
137
+ curl http://127.0.0.1:8080/v1/systemone -H 'Content-Type: application/json' \
138
+ -d '{"state":"My card was charged twice for the same purchase.",
139
+ "questions":{"department":{"type":"choice","instructions":"Which team should handle this?",
140
+ "criteria":{"billing":null,"technical support":null,"sales":null}},
141
+ "refund_requested":{"type":"noul","instructions":"Is a refund requested?"}}}'
142
+ ```
143
+
144
+ The answer keeps the core fields (`type`, `choice`, `probabilities`, `noul`,
145
+ `confidence`) and adds this model's own confidence under `native`.
146
+
147
+ Rebuild from the upstream checkpoint with `scripts/build_kev_gguf.sh`, which
148
+ merges the LoRA into the base, exports `kev-head.f32` and `kev.json`, then
149
+ converts with `--no-mtp`. No retraining is involved.
kev-0.8b-q8_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bb280c1fe370a50a165ba1d2617e3549f33e97f05045ee4000fea6e92aedb584
3
+ size 811843040
kev-head.f32 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:81e93556686afce55e4aacc93428dede06e3909d47173e31e1b3a6fb78000171
3
+ size 2099200
kev.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "profile": "kev",
3
+ "pointer_dim": 256,
4
+ "temperature": 2.406050072164233,
5
+ "version": "0.8b"
6
+ }