Text Classification
PEFT
Safetensors
English
decision-model
calibration
lora
multiple-choice
typesafe
qwen3.5
Eval Results (legacy)
Instructions to use jaredpalmer/kev-4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use jaredpalmer/kev-4b with PEFT:
from peft import PeftModel from transformers import AutoModel base_model = AutoModel.from_pretrained("Qwen/Qwen3.5-4B-Base") model = PeftModel.from_pretrained(base_model, "jaredpalmer/kev-4b") - Notebooks
- Google Colab
- Kaggle
kev-4b preview, decision-v7 recipe (transfer 0.790 dev / 0.806 locked; held-out pairs 0.73)
2bd3bb9 verified |
Download README.md from jaredpalmer/kev-4b: direct link, hf CLI and curl.
- Browser
- Download file 7.07 kB
-
https://huggingface.co/jaredpalmer/kev-4b/resolve/2bd3bb9a9957aff9a4803be7ce91a521cdff0a31/README.md
- Command line
-
hf download hf://jaredpalmer/kev-4b@2bd3bb9a9957aff9a4803be7ce91a521cdff0a31/README.md
-
curl -L -o README.md https://huggingface.co/jaredpalmer/kev-4b/resolve/2bd3bb9a9957aff9a4803be7ce91a521cdff0a31/README.md
7.07 kB
| language: en | |
| license: apache-2.0 | |
| library_name: peft | |
| base_model: Qwen/Qwen3-4B-Base | |
| base_model_relation: adapter | |
| pipeline_tag: text-classification | |
| tags: | |
| - decision-model | |
| - calibration | |
| - lora | |
| - multiple-choice | |
| - typesafe | |
| - research-preview | |
| datasets: | |
| - legacy-datasets/banking77 | |
| - google/boolq | |
| - fancyzhx/ag_news | |
| - nyu-mll/multi_nli | |
| - SetFit/sst5 | |
| - Yelp/yelp_review_full | |
| - CogComp/trec | |
| - fancyzhx/dbpedia_14 | |
| - SetFit/amazon_reviews_multi_en | |
| - stanfordnlp/imdb | |
| metrics: | |
| - accuracy | |
| - brier_score | |
| - expected_calibration_error | |
| model-index: | |
| - name: kev-4b (research preview) | |
| results: | |
| - task: { type: text-classification, name: typed decision (choice / noul / score) } | |
| dataset: { type: mixed, name: "decision-v4 development (1,204 records; ten trained public sources + programmatic policy pairs)" } | |
| metrics: | |
| - { type: accuracy, value: 0.854 } | |
| - { type: expected_calibration_error, value: 0.065, name: "ECE, raw probabilities" } | |
| - task: { type: text-classification, name: typed decision, out-of-domain } | |
| dataset: { type: mixed, name: "transfer-v4 development (764 records; six never-trained sources + held-out policy structures)" } | |
| metrics: | |
| - { type: accuracy, value: 0.790 } | |
| - { type: brier_score, value: 0.328 } | |
| # kev-4b β research preview | |
| `kev-4b` 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) plus a pointer head on `Qwen/Qwen3-4B-Base`, serving TypeSafe's public `/v1/systemone` contract. | |
| **Research preview, not a versioned release.** It is the best 4B checkpoint under a frozen, checksummed protocol after ~40 controlled 4B trials, and the first kev whose out-of-domain accuracy is within ten points of Jev on the same items. This checkpoint clears the release screen we set in advance (held-out policy pairs 0.73 both-correct, screen 70%), but the other two seeds of the same recipe do not (0.62, 0.67), and our rule is every seed; so it stays a preview. | |
| - Hub: `jaredpalmer/kev-4b` (this repo; trial `v7-rc3/01-trial-1`) | |
| - Code, suites, every trial with hashes and paired bootstraps: [github.com/jaredpalmer/kev](https://github.com/jaredpalmer/kev) β `PLAN.md`, `runs/leaderboard.md` | |
| ## Results (same frozen items for every row) | |
| | | kev-0.5b | kev-0.6b preview | **kev-4b preview** | Jev | | |
| |---|---|---|---|---| | |
| | in-distribution accuracy (decision-v4 dev, 1,200 q) | 0.712 | 0.805 | **0.854** | 0.845 | | |
| | out-of-domain accuracy (transfer-v4 dev, 560 q) | 0.575 | 0.598 | **0.790** | 0.857 | | |
| | out-of-domain Brier | 0.50 | 0.521 | **0.328** | 0.211 | | |
| | confident errors out of domain (p β₯ 0.9 and wrong) | β | 5.2% | 8.2% | 3.7% | | |
| | held-out policy structures, both siblings correct | β | 0.11 | 0.73 | 0.86 | | |
| | option-order flip rate | 0.21 | 0.02 | 0.06 | 0.00 | | |
| Per-source out-of-domain accuracy (kev-4b / Jev): QNLI 0.89 / 0.93, SciQ 0.99 / 0.99, TweetEval-offensive 0.75 / 0.81, PAWS 0.72 / 0.79, MMLU 0.65 / 0.90, Emotion 0.66 / 0.59, deadline (3-level date arithmetic) 0.53 / 0.93, (A and B) or not C 0.97 / 0.97, if A then not B else C 0.88 / 0.78. | |
| Seeds: three seeds on decision-v7: transfer 0.773 / **0.790** / 0.770, held-out pairs 0.62 / **0.73** / 0.67; this checkpoint is seed 1, selected on development transfer accuracy. Trained on `decision-v7` (10k public records + 896 policy records over nine template families incl. four ordinal Score threshold families + 1,680 records from 60 random rule structures with negation anywhere); development/test items are byte-identical to v4, so every number here is comparable with earlier previews. | |
| **Locked test, one exploratory read** (`runs/locked/kev-4b-v7-preview-ungated/`, labelled ungated because the screen is not met on every seed): in-distribution **0.856** (Brier 0.211), out-of-domain **0.806** (Brier 0.294, confident errors 6.6%, held-out pairs 0.66). This partition will not be read again for this checkpoint. | |
| ## What we learned building it | |
| - **Capacity dominates out of domain.** With public examples and synthetic budget held equal, 0.6B β 4B is +14β19 pp; 4B β 8B is +1β7 pp. | |
| - **Fine-tuning erodes base capability, and the learning rate controls it.** The 4B base, zero-shot with a letter readout, scores 0.688 on the same MMLU items and 0.787 on PAWS; the default recipe (lr 2e-4) trained down to 0.60β0.66 / 0.56β0.71. Lowering lr to 5e-5 recovers most of it and is the single largest recipe improvement we found; fewer LoRA target modules and smaller ranks help less. | |
| - **More public training data raises in-distribution accuracy and lowers transfer** at 4B (10k vs 3.4k records: β3 pp). Knowledge MCQ sources (ARC, OpenBookQA, CommonsenseQA) raise in-distribution accuracy to 0.86 without moving transfer. | |
| - Programmatic contrastive policy pairs teach the trained rule structures (both-correct 0.85β1.0) but transfer to unseen structures only partially (0.5β0.6 at 4B, 0.03β0.11 at 0.6B). | |
| ## Known limits | |
| - Held-out policy reasoning (unseen rule compositions, date arithmetic with grace periods) is far from Jev. | |
| - Product-shaped questions with no training analogue are not guaranteed: on the TypeSafe docs example ("two charges on my card" β *Is there a billing problem?*) this checkpoint answers 0.22 while kev-0.6b answers 0.97 and picks the return reason (wrong size, 0.54) correctly. Lower drift from the base means fewer task-specific priors; measure on your own inputs. | |
| - Out-of-domain probabilities are usable but not calibrated (raw ECE 0.096); temperature fitted in-domain does not transfer. | |
| - 4B fp32 needs ~16 GB; on a 32 GB Mac use `KEV_DTYPE=bf16`. Latency on an H100 is ~45 ms per packed request; on an M5 several hundred ms. | |
| ## Training | |
| Frozen suite `evals/v4/decision-v4`: 10,000 public records (1,000 per source, ten sources) plus two programmatic policy arms of 448 records, two epochs, LoRA r=16 on attention and MLP projections, pointer head from scratch, cross-entropy on the option distribution, **lr 5e-5** (OneCycle), effective batch 8, bf16 autocast with fp32 master weights, gradient checkpointing, one H100 (~40 min). Augmentation: option permutation, none-of-the-above insertion, distractors, none minimal pairs on 25% of Choice records. No Jev outputs were used for training. | |
| ## Evaluation protocol | |
| 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`. See `PLAN.md` for the corrections we made to our own earlier claims. | |
| ## Use | |
| ```bash | |
| uv run --extra serve python -m kev.serve --run jaredpalmer/kev-4b --port 8008 # KEV_DTYPE=bf16 on a 32 GB Mac | |
| ``` | |
| Any TypeSafe-compatible client works: `TypeSafeClient(api_key="local", base_url="http://127.0.0.1:8008", model="kev-latest")`. | |
| ## License | |
| Apache-2.0 for the adapter and head; Qwen3 base is Apache-2.0; datasets carry their own licenses. | |