Jwuthrich commited on
Commit
742f98f
·
verified ·
1 Parent(s): 2d22924

Add visual model card with verified dataset and model-size comparisons

Browse files
.gitattributes CHANGED
@@ -33,3 +33,7 @@ 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
+ assets/accuracy-size.png filter=lfs diff=lfs merge=lfs -text
37
+ assets/overview.png filter=lfs diff=lfs merge=lfs -text
38
+ assets/public-datasets.png filter=lfs diff=lfs merge=lfs -text
39
+ assets/research-path.png filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -10,19 +10,108 @@ tags:
10
  - selfjev
11
  ---
12
 
 
 
13
  # SelfJev-4B
14
 
15
- SelfJev turns text and questions into structured decisions: yes/no probabilities, one choice, an ordered score, or every option that applies. It runs on your own GPU and exposes a Python SDK and HTTP API.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
- This repository contains the **trained LoRA adapter** (230 MB), its PEFT configuration, and its model manifest. The base model is **Qwen/Qwen3.5-4B**, pinned to revision `851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a`; the base weights download separately.
18
 
19
- [Source code](https://github.com/Jwuthri/SelfJev) · [API reference](https://github.com/Jwuthri/SelfJev/blob/master/docs/api.md) · [Research notebook](https://jwuthri.github.io/SelfJev/)
20
 
21
- ## Use it
22
 
23
- SelfJev requires its custom serving engine. It reuses the document computation across questions and scores answer choices directly, with no generated text. A generic Transformers text-generation or text-classification pipeline does not reproduce this API or the reported scores.
24
 
25
- On a Linux machine with an NVIDIA GPU, Git and uv installed:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  ```bash
28
  GIT_LFS_SKIP_SMUDGE=1 git clone https://github.com/Jwuthri/SelfJev.git
@@ -33,16 +122,17 @@ from huggingface_hub import snapshot_download
33
  snapshot_download(
34
  "Jwuthrich/selfjev-4b",
35
  local_dir="weights/selfjev_4b_hf",
36
- allow_patterns=["adapter_model.safetensors", "adapter_config.json", "model.json", "README.md"],
37
  )
38
  PYTHON
39
 
40
  # Choose a secret for your own server.
41
  export SELFJEV_API_KEYS="replace-with-your-long-random-secret"
42
- uv run --no-sync selfjev serve --adapter weights/selfjev_4b_hf --host 127.0.0.1 --port 8000
 
43
  ```
44
 
45
- In a separate terminal, use the same secret with the client:
46
 
47
  ```python
48
  from selfjev import SelfJev, Noul, Choice
@@ -65,38 +155,66 @@ print(result.nouls["refund"].noul)
65
  print(result.choices["team"].choice)
66
  ```
67
 
68
- A 24 GB NVIDIA GPU is a practical starting recommendation, not a measured minimum. Plan for 16–32 GB host RAM and at least 50 GB free disk. Current-model GPU latency and a full-model CPU minimum have not been established. See the [deployment guide](https://github.com/Jwuthri/SelfJev/blob/master/docs/deploy.md) for Docker and AWS.
69
 
70
- ## Architecture and training
71
 
72
- - Base: Qwen3.5-4B, with a rank-64 LoRA on attention and DeltaNet projections.
73
- - Shared-prefix tree: read the document once, then evaluate questions and their answer choices in separate branches.
74
- - Training: 79,943 non-test questions, one epoch, learning rate 2e-4, texts up to 16K tokens.
75
- - Targets: 50% checked labels and 50% stored Jev probabilities as a teacher signal. Authored labels were checked by an AI judge; Jev predictions did not determine authored labels.
76
- - All answer options are included in each question. The serving engine applies this transformation automatically.
77
 
78
- See [model.json](./model.json) for the original manifest, checkpoint and provenance. Independent project; not affiliated with TypeSafe or Qwen.
79
 
80
- ## Recorded results
 
 
 
 
 
 
 
 
 
81
 
82
- These are results from the **current TreeServer engine**:
83
 
84
- | Task | Questions | Accuracy | Evidence |
85
- |---|---:|---:|---|
86
- | Text decisions | 1,991 | 95.7% | [report](https://github.com/Jwuthri/SelfJev/blob/master/reports/selfjev_4b_treeserver/eval2/report.json) |
87
- | AI response review | 946 | 93.1% | [report](https://github.com/Jwuthri/SelfJev/blob/master/reports/selfjev_4b_treeserver/eval_llm/report.json) |
88
- | Broader text tasks (development benchmark) | 3,471 | 83.8% | [report](https://github.com/Jwuthri/SelfJev/blob/master/reports/selfjev_4b_treeserver/test/report.json) |
89
 
90
- Accuracy is the share of questions matching the expected answer. For select-all questions, the entire set must match. The two focused test sets were authored and checked by AI; their labels are not human ground truth. They have informed research direction, and a fresh final holdout remains necessary. The broader text benchmark was repeatedly used during development. Scores are single-run observations, not guarantees on application data.
91
 
92
- The same adapter scored 95.8% on text decisions under the original evaluation engine. `model.json` preserves those original scores; the table above reports current serving-engine measurements. Historic latency results for earlier Qwen3 prototypes do not establish current SelfJev-4B latency.
93
 
94
- ## Artifact integrity
95
 
96
- `adapter_model.safetensors` SHA-256:
97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  ```
99
- dfbf2834d883987893ec305a6093a345fd79c77f903f60f2f914cbe3b6058d1b
100
- ```
101
 
102
- The adapter uses the Qwen base model linked above. No separate adapter license is declared in this repository.
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  - selfjev
11
  ---
12
 
13
+ ![SelfJev-4B: read the document once, branch across questions, and score their candidate answers.](assets/hero.png)
14
+
15
  # SelfJev-4B
16
 
17
+ **Structured decisions from text. A 4B backbone. Your own GPU.**
18
+
19
+ Route a customer message. Check a claim. Review an AI response. SelfJev answers questions over the options you supply and returns probabilities through a Python SDK or HTTP API. Its default engine shares the document computation across questions and scores candidates directly, without generating an answer token by token.
20
+
21
+ [Quickstart](#quickstart) · [Results](#results) · [Public datasets](#public-datasets) · [Model size](#accuracy-and-model-size) · [Architecture](#architecture) · [Research](#the-research-path) · [Source code](https://github.com/Jwuthri/SelfJev)
22
+
23
+ | Ask for | Get back | Use it for |
24
+ |---|---|---|
25
+ | Yes / no | Probability of yes | Verification, guardrails, detection |
26
+ | One choice | Selected option and probabilities | Routing, intent, categorization |
27
+ | An ordered score | Score and probabilities over your levels | Review and grading |
28
+ | Every matching option | Selected set and per-option probabilities | Tags, checklists, multiple issues |
29
+
30
+ This repository contains the **230 MB LoRA adapter**, not the entire model. The Qwen3.5-4B base weights download separately. The 4B model size refers to the backbone; the adapter stores the learned update.
31
+
32
+ ## Results
33
+
34
+ ![SelfJev and Jev accuracy on two authored test suites and the public-source development tasks; exact values below.](assets/overview.png)
35
+
36
+ | Evaluation | Questions | SelfJev-4B | Jev API | SelfJev evidence |
37
+ |---|---:|---:|---:|---|
38
+ | Text decisions | 1,991 | **95.7%** | 97.2% | [report](https://github.com/Jwuthri/SelfJev/blob/master/reports/selfjev_4b_treeserver/eval2/report.json) |
39
+ | AI response review | 946 | **93.1%** | 92.5% | [report](https://github.com/Jwuthri/SelfJev/blob/master/reports/selfjev_4b_treeserver/eval_llm/report.json) |
40
+ | Public-source tasks | 3,300 | **83.4%** | 82.1% | [report](https://github.com/Jwuthri/SelfJev/blob/master/reports/selfjev_4b_treeserver/test/report.json) |
41
+
42
+ **What these measure.** Text decisions cover authored routing, policy, evidence and difficult language cases. AI response review covers verification, judging, scoring, guardrails and jailbreak detection. Public-source tasks cover 11 adapted datasets. Each score counts a question as correct only when the expected answer matches; for multiple selections, the entire set must match.
43
+
44
+ These are recorded results from the current **TreeServer** engine and matched Jev predictions, not scores from a newly merged vLLM release. The authored sets use AI-checked labels, not human ground truth. Both have informed research direction. The public-source set is a repeatedly reused development benchmark. A fresh independent evaluation remains necessary.
45
+
46
+ ### How does it compare with another open model?
47
+
48
+ On the same 1,991 text-decision questions, the recorded **Eikos-4B** run scored **92.8%** using our task adapter and its letter-based readout. This is a comparison under this project's protocol, not a general ranking of open models. [Eikos report](https://github.com/Jwuthri/SelfJev/blob/master/reports/eikos_4b/eval2/report.json)
49
+
50
+ There is **no SelfJev S1Bench result yet**. Lev's published S1Bench scores cannot be compared with our authored-test scores. Comparing SelfJev, Lev, Reflex and other decision models requires the same dataset revision, item IDs, candidate sets, scoring rules and coverage.
51
+
52
+ ## Public datasets
53
+
54
+ ![Accuracy for all 11 public-source datasets. Orange circles are SelfJev; green squares are Jev. Values are also available in the table below.](assets/public-datasets.png)
55
+
56
+ **83.4% across 3,300 questions.** There are 300 questions per source, so the macro average over sources and the question-weighted average are equal. The 171 authored development questions are excluded here; the full 3,471-question development benchmark remains available in the reports.
57
+
58
+ | Source dataset | Task in our protocol | Training exposure | Questions | SelfJev | Jev |
59
+ |---|---|---|---:|---:|---:|
60
+ | [CLINC150](https://huggingface.co/datasets/clinc/clinc_oos) | Intent routing | held-out source | 300 | 95.0% | 94.3% |
61
+ | [DBpedia](https://huggingface.co/datasets/fancyzhx/dbpedia_14) | Topic classification | held-out source | 300 | 98.0% | 98.0% |
62
+ | [TREC](https://huggingface.co/datasets/SetFit/TREC-QC) | Question type | held-out source | 300 | 91.3% | 94.0% |
63
+ | [Emotion](https://huggingface.co/datasets/dair-ai/emotion) | Emotion classification | held-out source | 300 | 57.3% | 57.7% |
64
+ | [BoolQ](https://huggingface.co/datasets/google/boolq) | Reading comprehension | held-out source | 300 | 87.7% | 90.7% |
65
+ | [SST-2](https://huggingface.co/datasets/stanfordnlp/sst2) | Sentiment | held-out source | 300 | 91.3% | 96.7% |
66
+ | [Banking77](https://huggingface.co/datasets/mteb/banking77) | Banking intent | seen source | 300 | 96.3% | 95.7% |
67
+ | [AG News](https://huggingface.co/datasets/fancyzhx/ag_news) | News topic | seen source | 300 | 90.3% | 87.3% |
68
+ | [TweetEval](https://huggingface.co/datasets/cardiffnlp/tweet_eval) | Tweet sentiment | seen source | 300 | 67.3% | 64.3% |
69
+ | [MNLI](https://huggingface.co/datasets/nyu-mll/glue) | Entailment (binary) | seen source | 300 | 95.0% | 92.7% |
70
+ | [GoEmotions](https://huggingface.co/datasets/google-research-datasets/go_emotions) | Emotion tags (exact set) | seen source | 300 | 47.7% | 31.7% |
71
+
72
+ “Held-out source” means that dataset was excluded from SelfJev's task-specific training. “Seen source” means other rows from that source were used in training. Neither establishes absence from Qwen's pretraining.
73
+
74
+ **These are adapted tasks, not official dataset leaderboard scores.** For example, Banking77 uses eight candidate options per question, CLINC uses seven or eight, and DBpedia uses six. MNLI is recast as binary entailment. GoEmotions scores exact matching over six candidate tags. Our preprocessing, sampling and answer sets are part of the evaluation and must accompany the numbers.
75
 
76
+ Known development-data issues include shared MNLI premises across splits and near-duplicate authored policy texts. See [data methodology](https://github.com/Jwuthri/SelfJev/blob/master/docs/data.md). All 11 slices are shown, including weaker emotion and sentiment results.
77
 
78
+ [Download chart data](assets/public-datasets.csv) · [SelfJev predictions](https://github.com/Jwuthri/SelfJev/blob/master/reports/selfjev_4b_treeserver/test/report.json) · [Matched Jev predictions](https://github.com/Jwuthri/SelfJev/blob/master/reports/external/full/typesafe_jev-latest/report.json)
79
 
80
+ ## Accuracy and model size
81
 
82
+ ![Accuracy against nominal backbone parameters for seven measured systems on identical public-source questions. Full results below.](assets/accuracy-size.png)
83
 
84
+ | Model / recipe | Backbone size | Training | Accuracy | Evidence |
85
+ |---|---:|---|---:|---|
86
+ | Qwen3 reranker 0.6B | 0.6B | stock | 62.2% | [report](https://github.com/Jwuthri/SelfJev/blob/master/reports/baseline/test/report.json) |
87
+ | Qwen3 reranker 4B | 4B | stock | 63.8% | [report](https://github.com/Jwuthri/SelfJev/blob/master/reports/baseline_4b/test/report.json) |
88
+ | Qwen3 reranker 8B | 8B | stock | 67.0% | [report](https://github.com/Jwuthri/SelfJev/blob/master/reports/baseline_8b/test/report.json) |
89
+ | Qwen3 + LoRA 0.6B | 0.6B | early fine-tune | 74.5% | [report](https://github.com/Jwuthri/SelfJev/blob/master/reports/lora_pilot/test/report.json) |
90
+ | Qwen3 + LoRA 4B | 4B | early fine-tune | 80.8% | [report](https://github.com/Jwuthri/SelfJev/blob/master/reports/lora_4b/test/report.json) |
91
+ | Qwen3 + LoRA 8B | 8B | early fine-tune | 81.0% | [report](https://github.com/Jwuthri/SelfJev/blob/master/reports/lora_8b/test/report.json) |
92
+ | SelfJev-4B | 4B | current release | 83.4% | [report](https://github.com/Jwuthri/SelfJev/blob/master/reports/selfjev_4b_treeserver/test/report.json) |
93
+
94
+ All points use the same 3,300 question IDs, labels and candidate sets. The stock models are rerankers mapped to our decision tasks. The earlier LoRA runs use older training recipes; SelfJev uses a different backbone generation and more training data. This shows the measured systems' trade-off between size and accuracy. It does **not** isolate the effect of parameter count or establish that a 4B model outperforms larger models generally.
95
+
96
+ Sizes are nominal backbone parameter counts, not checkpoint megabytes or runtime memory. Jev appears as a horizontal reference because its parameter count is undisclosed. We do not assign a guessed size to proprietary models.
97
+
98
+ ## AI response review
99
+
100
+ Breakdown of the 946-question authored suite, using the same current-engine predictions as the overview:
101
+
102
+ | Task | Questions | SelfJev | Jev |
103
+ |---|---:|---:|---:|
104
+ | Factual verification | 165 | 87.3% | 86.7% |
105
+ | Response judging | 222 | 94.1% | 94.6% |
106
+ | Quality scoring | 200 | 92.5% | 93.0% |
107
+ | Policy guardrails | 170 | 96.5% | 92.9% |
108
+ | Jailbreak detection | 189 | 94.7% | 94.2% |
109
+
110
+ Labels were authored and checked with AI judges. Questions about one document are correlated; small differences should not be read as proof of superiority. This suite measures our defined answer choices and criteria, not unrestricted judgment quality. [Dataset design](https://github.com/Jwuthri/SelfJev/blob/master/docs/llm_eval_data.md) · [Predictions](https://github.com/Jwuthri/SelfJev/blob/master/reports/selfjev_4b_treeserver/eval_llm/report.json)
111
+
112
+ ## Quickstart
113
+
114
+ On Linux with an NVIDIA GPU, Git and uv installed:
115
 
116
  ```bash
117
  GIT_LFS_SKIP_SMUDGE=1 git clone https://github.com/Jwuthri/SelfJev.git
 
122
  snapshot_download(
123
  "Jwuthrich/selfjev-4b",
124
  local_dir="weights/selfjev_4b_hf",
125
+ allow_patterns=["adapter_model.safetensors", "adapter_config.json", "model.json"],
126
  )
127
  PYTHON
128
 
129
  # Choose a secret for your own server.
130
  export SELFJEV_API_KEYS="replace-with-your-long-random-secret"
131
+ uv run --no-sync selfjev serve \
132
+ --adapter weights/selfjev_4b_hf --host 127.0.0.1 --port 8000
133
  ```
134
 
135
+ In another terminal, use the same secret:
136
 
137
  ```python
138
  from selfjev import SelfJev, Noul, Choice
 
155
  print(result.choices["team"].choice)
156
  ```
157
 
158
+ The example shows the interface; it does not present fabricated model output. A generic Transformers text-generation or classification pipeline does not reproduce SelfJev's prompts, scoring rules or API. The server key is a secret you choose for your deployment, unrelated to Hugging Face credentials.
159
 
160
+ [HTTP API](https://github.com/Jwuthri/SelfJev/blob/master/docs/api.md) · [Self-hosting and AWS](https://github.com/Jwuthri/SelfJev/blob/master/docs/deploy.md) · [Fine-tuning](https://github.com/Jwuthri/SelfJev/blob/master/docs/finetune.md)
161
 
162
+ ## Architecture
 
 
 
 
163
 
164
+ The default engine builds a **shared-prefix tree**: compute the document once, branch for each question, then branch for candidate answers. It reads yes/no evidence from the logits and converts those scores into the requested answer type. The server includes every candidate in the question, matching training.
165
 
166
+ | Component | Current release |
167
+ |---|---|
168
+ | Backbone | Qwen3.5-4B |
169
+ | Base revision | `851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a` |
170
+ | Fine-tuning | Rank-64 LoRA on attention and DeltaNet projections |
171
+ | Default serving | TreeServer, shared document and question computation |
172
+ | Alternative serving | vLLM with a merged checkpoint and prefix caching |
173
+ | Training examples | 79,943 non-test questions; texts up to 16K tokens |
174
+ | Training target | 50% checked labels + 50% stored Jev probabilities |
175
+ | Training schedule | One epoch, learning rate 2e-4 |
176
 
177
+ Jev probabilities served as a teacher signal; they did not decide the authored training labels. Authored labels were checked by an AI judge. Full lineage is recorded in [model.json](model.json), with architecture detail in the [research documentation](https://github.com/Jwuthri/SelfJev/blob/master/docs/tree_model.md).
178
 
179
+ ## The research path
 
 
 
 
180
 
181
+ ![Recorded accuracy for selected research checkpoints, from the first shared-prefix tree to the current serving engine.](assets/research-path.png)
182
 
183
+ The improvements came from several changes: verified difficult examples, the instruct backbone, explicit option lists, broader training coverage, tree-aware training and soft teacher targets. The chart is a history of complete systems, not an ablation assigning each gain to one change.
184
 
185
+ The research also includes smaller stock rerankers, 8B models, Jina, T5Gemma, custom architectures, distillation and RLCD. The [full experiment ledger](https://github.com/Jwuthri/SelfJev/blob/master/docs/experiments.md) records results and dead ends; earlier implementations remain at the archive tag documented there. The checkpoint's original engine recorded a slightly different text-decision score; this card consistently uses the current engine for SelfJev's headline results.
186
 
187
+ ## Hardware and speed
188
 
189
+ A **24 GB NVIDIA GPU** is a practical starting recommendation, not a measured minimum. Plan for 16–32 GB host RAM and at least 50 GB free disk. The adapter download size does not describe inference memory: the full backbone and runtime state must fit too.
190
+
191
+ The default engine avoids token-by-token answer generation and shares work across questions. Latency still depends on input length, question count, candidate count, GPU and concurrency. The current release does not yet have a controlled GPU latency sweep or an established CPU minimum. Earlier A10G/L40S/H100 results used archived models and engines and are labeled accordingly in the [speed research](https://github.com/Jwuthri/SelfJev/blob/master/docs/speed.md).
192
+
193
+ ## Limits and reproducibility
194
+
195
+ - **Probability is not a guarantee.** The reported current-engine runs have no fitted calibration attached. Validate thresholds on application data before acting on confidence.
196
+ - **Some tasks remain weak.** Emotion labeling, fine-grained sentiment and selecting an exact set of labels are visibly harder than topic and intent classification.
197
+ - **Benchmarks have a scope.** AI-authored tests, reused development sets, sampled options and known overlap issues limit the conclusions. We make no S1Bench or general state-of-the-art claim.
198
+ - **Engine versions matter.** These accuracy results refer to the recorded current TreeServer runs. A merged checkpoint, quantization or another serving backend needs its own verification.
199
+
200
+ Every plotted value is regenerated from saved predictions. The generator checks matched IDs, targets, question types and candidate sets for report-to-report comparisons. [Chart data and source SHA-256 hashes](assets/chart-data.json) · [Generator](reproduce/build_model_card.py) · [Card template](reproduce/model_card.template.md)
201
+
202
+ Place the downloadable generator and template in `scripts/docs/` of a SelfJev source checkout, then run:
203
+
204
+ ```bash
205
+ uv run --no-project --with matplotlib==3.11.1 python scripts/docs/build_model_card.py
206
  ```
 
 
207
 
208
+ This builds figures from reports and the canonical `data/all.jsonl.gz`; it performs no model inference. Rebuild the canonical file using the [data instructions](https://github.com/Jwuthri/SelfJev/blob/master/data/README.md) if absent.
209
+
210
+ | File | Purpose |
211
+ |---|---|
212
+ | `adapter_model.safetensors` | Trained LoRA weights |
213
+ | `adapter_config.json` | PEFT configuration |
214
+ | `model.json` | Base revision, training provenance and original recorded scores |
215
+ | `assets/*.png`, `assets/*.svg` | Model-card figures, raster and vector |
216
+ | `assets/chart-data.json`, `assets/public-datasets.csv` | Underlying results and source provenance |
217
+
218
+ Adapter SHA-256: `dfbf2834d883987893ec305a6093a345fd79c77f903f60f2f914cbe3b6058d1b`.
219
+
220
+ The adapter uses the Qwen base model linked above. No separate adapter license is declared in this repository. Independent project; not affiliated with TypeSafe or Qwen.
assets/accuracy-size.png ADDED

Git LFS Details

  • SHA256: 0a2ca5062ffce62d7b1ac77ba689a8e3101717b8f9dd9d5567362bb1654064d0
  • Pointer size: 131 Bytes
  • Size of remote file: 151 kB
assets/accuracy-size.svg ADDED
assets/chart-data.json ADDED
@@ -0,0 +1,286 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": 1,
3
+ "overview": [
4
+ {
5
+ "label": "Text decisions",
6
+ "n": 1991,
7
+ "ours": 95.68056253139126,
8
+ "jev": 97.23756906077348,
9
+ "source": "reports/selfjev_4b_treeserver/eval2/report.json",
10
+ "reference": "reports/external/eval2/typesafe_jev-latest/report.json"
11
+ },
12
+ {
13
+ "label": "AI response review",
14
+ "n": 946,
15
+ "ours": 93.12896405919662,
16
+ "jev": 92.49471458773785,
17
+ "source": "reports/selfjev_4b_treeserver/eval_llm/report.json",
18
+ "reference": "data/all.jsonl.gz: eval_llm / jev",
19
+ "reference_model": "typesafe/jev-1.13-20260917"
20
+ },
21
+ {
22
+ "label": "Public-source tasks",
23
+ "n": 3300,
24
+ "ours": 83.39393939393939,
25
+ "jev": 82.0909090909091,
26
+ "source": "reports/selfjev_4b_treeserver/test/report.json",
27
+ "reference": "reports/external/full/typesafe_jev-latest/report.json"
28
+ }
29
+ ],
30
+ "public_datasets": [
31
+ {
32
+ "family": "heldout_intent_clinc",
33
+ "dataset": "CLINC150",
34
+ "task": "Intent routing",
35
+ "exposure": "held-out source",
36
+ "n": 300,
37
+ "ours": 95.0,
38
+ "jev": 94.33333333333333,
39
+ "dataset_url": "https://huggingface.co/datasets/clinc/clinc_oos",
40
+ "source": "reports/selfjev_4b_treeserver/test/report.json",
41
+ "reference": "reports/external/full/typesafe_jev-latest/report.json"
42
+ },
43
+ {
44
+ "family": "heldout_topic_dbpedia",
45
+ "dataset": "DBpedia",
46
+ "task": "Topic classification",
47
+ "exposure": "held-out source",
48
+ "n": 300,
49
+ "ours": 98.0,
50
+ "jev": 98.0,
51
+ "dataset_url": "https://huggingface.co/datasets/fancyzhx/dbpedia_14",
52
+ "source": "reports/selfjev_4b_treeserver/test/report.json",
53
+ "reference": "reports/external/full/typesafe_jev-latest/report.json"
54
+ },
55
+ {
56
+ "family": "heldout_question_type_trec",
57
+ "dataset": "TREC",
58
+ "task": "Question type",
59
+ "exposure": "held-out source",
60
+ "n": 300,
61
+ "ours": 91.33333333333333,
62
+ "jev": 94.0,
63
+ "dataset_url": "https://huggingface.co/datasets/SetFit/TREC-QC",
64
+ "source": "reports/selfjev_4b_treeserver/test/report.json",
65
+ "reference": "reports/external/full/typesafe_jev-latest/report.json"
66
+ },
67
+ {
68
+ "family": "heldout_emotion_multiclass",
69
+ "dataset": "Emotion",
70
+ "task": "Emotion classification",
71
+ "exposure": "held-out source",
72
+ "n": 300,
73
+ "ours": 57.333333333333336,
74
+ "jev": 57.666666666666664,
75
+ "dataset_url": "https://huggingface.co/datasets/dair-ai/emotion",
76
+ "source": "reports/selfjev_4b_treeserver/test/report.json",
77
+ "reference": "reports/external/full/typesafe_jev-latest/report.json"
78
+ },
79
+ {
80
+ "family": "heldout_boolq",
81
+ "dataset": "BoolQ",
82
+ "task": "Reading comprehension",
83
+ "exposure": "held-out source",
84
+ "n": 300,
85
+ "ours": 87.66666666666667,
86
+ "jev": 90.66666666666667,
87
+ "dataset_url": "https://huggingface.co/datasets/google/boolq",
88
+ "source": "reports/selfjev_4b_treeserver/test/report.json",
89
+ "reference": "reports/external/full/typesafe_jev-latest/report.json"
90
+ },
91
+ {
92
+ "family": "heldout_sentiment_sst2",
93
+ "dataset": "SST-2",
94
+ "task": "Sentiment",
95
+ "exposure": "held-out source",
96
+ "n": 300,
97
+ "ours": 91.33333333333333,
98
+ "jev": 96.66666666666667,
99
+ "dataset_url": "https://huggingface.co/datasets/stanfordnlp/sst2",
100
+ "source": "reports/selfjev_4b_treeserver/test/report.json",
101
+ "reference": "reports/external/full/typesafe_jev-latest/report.json"
102
+ },
103
+ {
104
+ "family": "hf_intent_banking77",
105
+ "dataset": "Banking77",
106
+ "task": "Banking intent",
107
+ "exposure": "seen source",
108
+ "n": 300,
109
+ "ours": 96.33333333333333,
110
+ "jev": 95.66666666666667,
111
+ "dataset_url": "https://huggingface.co/datasets/mteb/banking77",
112
+ "source": "reports/selfjev_4b_treeserver/test/report.json",
113
+ "reference": "reports/external/full/typesafe_jev-latest/report.json"
114
+ },
115
+ {
116
+ "family": "hf_topic_agnews",
117
+ "dataset": "AG News",
118
+ "task": "News topic",
119
+ "exposure": "seen source",
120
+ "n": 300,
121
+ "ours": 90.33333333333333,
122
+ "jev": 87.33333333333333,
123
+ "dataset_url": "https://huggingface.co/datasets/fancyzhx/ag_news",
124
+ "source": "reports/selfjev_4b_treeserver/test/report.json",
125
+ "reference": "reports/external/full/typesafe_jev-latest/report.json"
126
+ },
127
+ {
128
+ "family": "hf_sentiment_tweets",
129
+ "dataset": "TweetEval",
130
+ "task": "Tweet sentiment",
131
+ "exposure": "seen source",
132
+ "n": 300,
133
+ "ours": 67.33333333333333,
134
+ "jev": 64.33333333333333,
135
+ "dataset_url": "https://huggingface.co/datasets/cardiffnlp/tweet_eval",
136
+ "source": "reports/selfjev_4b_treeserver/test/report.json",
137
+ "reference": "reports/external/full/typesafe_jev-latest/report.json"
138
+ },
139
+ {
140
+ "family": "hf_nli",
141
+ "dataset": "MNLI",
142
+ "task": "Entailment (binary)",
143
+ "exposure": "seen source",
144
+ "n": 300,
145
+ "ours": 95.0,
146
+ "jev": 92.66666666666667,
147
+ "dataset_url": "https://huggingface.co/datasets/nyu-mll/glue",
148
+ "source": "reports/selfjev_4b_treeserver/test/report.json",
149
+ "reference": "reports/external/full/typesafe_jev-latest/report.json"
150
+ },
151
+ {
152
+ "family": "hf_emotions_multilabel",
153
+ "dataset": "GoEmotions",
154
+ "task": "Emotion tags (exact set)",
155
+ "exposure": "seen source",
156
+ "n": 300,
157
+ "ours": 47.666666666666664,
158
+ "jev": 31.666666666666668,
159
+ "dataset_url": "https://huggingface.co/datasets/google-research-datasets/go_emotions",
160
+ "source": "reports/selfjev_4b_treeserver/test/report.json",
161
+ "reference": "reports/external/full/typesafe_jev-latest/report.json"
162
+ }
163
+ ],
164
+ "accuracy_vs_size": [
165
+ {
166
+ "model": "Qwen3 reranker 0.6B",
167
+ "nominal_backbone_billions": 0.6,
168
+ "regime": "stock",
169
+ "accuracy": 62.18181818181818,
170
+ "n": 3300,
171
+ "source": "reports/baseline/test/report.json"
172
+ },
173
+ {
174
+ "model": "Qwen3 reranker 4B",
175
+ "nominal_backbone_billions": 4,
176
+ "regime": "stock",
177
+ "accuracy": 63.78787878787879,
178
+ "n": 3300,
179
+ "source": "reports/baseline_4b/test/report.json"
180
+ },
181
+ {
182
+ "model": "Qwen3 reranker 8B",
183
+ "nominal_backbone_billions": 8,
184
+ "regime": "stock",
185
+ "accuracy": 67.03030303030303,
186
+ "n": 3300,
187
+ "source": "reports/baseline_8b/test/report.json"
188
+ },
189
+ {
190
+ "model": "Qwen3 + LoRA 0.6B",
191
+ "nominal_backbone_billions": 0.6,
192
+ "regime": "early fine-tune",
193
+ "accuracy": 74.48484848484848,
194
+ "n": 3300,
195
+ "source": "reports/lora_pilot/test/report.json"
196
+ },
197
+ {
198
+ "model": "Qwen3 + LoRA 4B",
199
+ "nominal_backbone_billions": 4,
200
+ "regime": "early fine-tune",
201
+ "accuracy": 80.81818181818181,
202
+ "n": 3300,
203
+ "source": "reports/lora_4b/test/report.json"
204
+ },
205
+ {
206
+ "model": "Qwen3 + LoRA 8B",
207
+ "nominal_backbone_billions": 8,
208
+ "regime": "early fine-tune",
209
+ "accuracy": 80.96969696969697,
210
+ "n": 3300,
211
+ "source": "reports/lora_8b/test/report.json"
212
+ },
213
+ {
214
+ "model": "SelfJev-4B",
215
+ "nominal_backbone_billions": 4,
216
+ "regime": "current release",
217
+ "accuracy": 83.39393939393939,
218
+ "n": 3300,
219
+ "source": "reports/selfjev_4b_treeserver/test/report.json"
220
+ }
221
+ ],
222
+ "research_path": [
223
+ {
224
+ "model": "Initial tree",
225
+ "accuracy": 85.13309894525364,
226
+ "source": "reports/tree_4b/eval2/report.json",
227
+ "n": 1991
228
+ },
229
+ {
230
+ "model": "Verified hard cases",
231
+ "accuracy": 90.55750878955298,
232
+ "source": "reports/tree_4b_r2b/eval2/report.json",
233
+ "n": 1991
234
+ },
235
+ {
236
+ "model": "Instruct backbone",
237
+ "accuracy": 92.71722752385736,
238
+ "source": "reports/tree_4b_instruct_r2x64/eval2/report.json",
239
+ "n": 1991
240
+ },
241
+ {
242
+ "model": "Broader data + options",
243
+ "accuracy": 94.47513812154696,
244
+ "source": "reports/tree_4b_combo/eval2/report.json",
245
+ "n": 1991
246
+ },
247
+ {
248
+ "model": "Qwen3.5 + tree training",
249
+ "accuracy": 95.58011049723757,
250
+ "source": "reports/qwen35_4b_tree/eval2/report.json",
251
+ "n": 1991
252
+ },
253
+ {
254
+ "model": "SelfJev / current engine",
255
+ "accuracy": 95.68056253139126,
256
+ "source": "reports/selfjev_4b_treeserver/eval2/report.json",
257
+ "n": 1991
258
+ }
259
+ ],
260
+ "external_text_decisions": {
261
+ "model": "Eikos-4B",
262
+ "accuracy": 92.7674535409342,
263
+ "source": "reports/eikos_4b/eval2/report.json"
264
+ },
265
+ "provenance_sha256": {
266
+ "data/all.jsonl.gz": "cc1db4b3c8c72832c128600c1213486cb01d6880df8cfdd8eda3710ca6712b20",
267
+ "reports/selfjev_4b_treeserver/test/report.json": "ec3da777a49358850820115c6e9d98a4a7a25d736bb7a23f74edb904462e751e",
268
+ "reports/external/full/typesafe_jev-latest/report.json": "02c56f7564b5d257194d996a0831d22f78f168b4247b14ac868c7106acf3add0",
269
+ "reports/selfjev_4b_treeserver/eval2/report.json": "6d3990d0f77e94985edb9d9c174e9a9a326671bc045d578761993da51dcdfa13",
270
+ "reports/external/eval2/typesafe_jev-latest/report.json": "a632fd3a6a5628b89aa7a371587bac0d362b8de846c4327c2174c796b4b6ae4a",
271
+ "reports/selfjev_4b_treeserver/eval_llm/report.json": "e98db0fbee4109e6fdb8585334662754abd747357d8474598bcf61e966cb8f6d",
272
+ "reports/baseline/test/report.json": "8659d24af1f35e9fe29b7b54b73f44080d445277a8fe74d01b581c0b8ed0dbc7",
273
+ "reports/baseline_4b/test/report.json": "db31f7e9b922590955d7056475732e68763f4aabca0b5d78fd1cf180a5db3b3a",
274
+ "reports/baseline_8b/test/report.json": "459c908e69636e6cae3d49f50801be5463e27c8d7777c18c7ed9ca4165e61ad9",
275
+ "reports/lora_pilot/test/report.json": "4cc1dfc68e954155fcb017a478ee19b30a9f91c204f79d906bac02cba00e4051",
276
+ "reports/lora_4b/test/report.json": "d385af3b3b180b003d9f11a613305c2293ac1d35a0866b304bd881ef42a1c487",
277
+ "reports/lora_8b/test/report.json": "2749882e4717d8310b2aced826bd8712279d0b8258ca5317e5e0d6ab25322ecb",
278
+ "reports/tree_4b/eval2/report.json": "a61afe4c7ebd85e37684b9b74a7f938375a7d252973be028d0f822b1d1d4cf8c",
279
+ "reports/tree_4b_r2b/eval2/report.json": "6438041ed5b3818b2a324de2356a20fd1394f6e1efdd1daaee7ed6499e3cf578",
280
+ "reports/tree_4b_instruct_r2x64/eval2/report.json": "2f2b94c58f1640bd6fc55831f35f7b937745763fbd5e825cebdcdf890d2f33af",
281
+ "reports/tree_4b_combo/eval2/report.json": "9bc9eed004d3a9477041925549b03e369efb4e73896fc1e0020ef609c6633dd7",
282
+ "reports/qwen35_4b_tree/eval2/report.json": "5ec21f63b8e4fe33986a5c110b5ed4558b8c50f8a9ca4eaa1dacdbee0991e55e",
283
+ "reports/eikos_4b/eval2/report.json": "ebd207e342f94c7a2d3bb4047fdcfd10dc802a2cf986eff820dd23217a9e19f9"
284
+ },
285
+ "scope": "Saved results only. No new inference. Public datasets adapted; no S1Bench claim."
286
+ }
assets/hero.png ADDED
assets/hero.svg ADDED
assets/overview.png ADDED

Git LFS Details

  • SHA256: 4d844dc0ca033612777dabd751dba7c7bee59728213d0a6c6f85bc2cd3df3200
  • Pointer size: 131 Bytes
  • Size of remote file: 105 kB
assets/overview.svg ADDED
assets/public-datasets.csv ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ family,dataset,task,exposure,n,ours,jev,dataset_url,source,reference
2
+ heldout_intent_clinc,CLINC150,Intent routing,held-out source,300,95.0,94.33333333333333,https://huggingface.co/datasets/clinc/clinc_oos,reports/selfjev_4b_treeserver/test/report.json,reports/external/full/typesafe_jev-latest/report.json
3
+ heldout_topic_dbpedia,DBpedia,Topic classification,held-out source,300,98.0,98.0,https://huggingface.co/datasets/fancyzhx/dbpedia_14,reports/selfjev_4b_treeserver/test/report.json,reports/external/full/typesafe_jev-latest/report.json
4
+ heldout_question_type_trec,TREC,Question type,held-out source,300,91.33333333333333,94.0,https://huggingface.co/datasets/SetFit/TREC-QC,reports/selfjev_4b_treeserver/test/report.json,reports/external/full/typesafe_jev-latest/report.json
5
+ heldout_emotion_multiclass,Emotion,Emotion classification,held-out source,300,57.333333333333336,57.666666666666664,https://huggingface.co/datasets/dair-ai/emotion,reports/selfjev_4b_treeserver/test/report.json,reports/external/full/typesafe_jev-latest/report.json
6
+ heldout_boolq,BoolQ,Reading comprehension,held-out source,300,87.66666666666667,90.66666666666667,https://huggingface.co/datasets/google/boolq,reports/selfjev_4b_treeserver/test/report.json,reports/external/full/typesafe_jev-latest/report.json
7
+ heldout_sentiment_sst2,SST-2,Sentiment,held-out source,300,91.33333333333333,96.66666666666667,https://huggingface.co/datasets/stanfordnlp/sst2,reports/selfjev_4b_treeserver/test/report.json,reports/external/full/typesafe_jev-latest/report.json
8
+ hf_intent_banking77,Banking77,Banking intent,seen source,300,96.33333333333333,95.66666666666667,https://huggingface.co/datasets/mteb/banking77,reports/selfjev_4b_treeserver/test/report.json,reports/external/full/typesafe_jev-latest/report.json
9
+ hf_topic_agnews,AG News,News topic,seen source,300,90.33333333333333,87.33333333333333,https://huggingface.co/datasets/fancyzhx/ag_news,reports/selfjev_4b_treeserver/test/report.json,reports/external/full/typesafe_jev-latest/report.json
10
+ hf_sentiment_tweets,TweetEval,Tweet sentiment,seen source,300,67.33333333333333,64.33333333333333,https://huggingface.co/datasets/cardiffnlp/tweet_eval,reports/selfjev_4b_treeserver/test/report.json,reports/external/full/typesafe_jev-latest/report.json
11
+ hf_nli,MNLI,Entailment (binary),seen source,300,95.0,92.66666666666667,https://huggingface.co/datasets/nyu-mll/glue,reports/selfjev_4b_treeserver/test/report.json,reports/external/full/typesafe_jev-latest/report.json
12
+ hf_emotions_multilabel,GoEmotions,Emotion tags (exact set),seen source,300,47.666666666666664,31.666666666666668,https://huggingface.co/datasets/google-research-datasets/go_emotions,reports/selfjev_4b_treeserver/test/report.json,reports/external/full/typesafe_jev-latest/report.json
assets/public-datasets.png ADDED

Git LFS Details

  • SHA256: cf5bfe9522b66c70637260ad7ce17d528fe2757b31e2107620192dd1d511c946
  • Pointer size: 131 Bytes
  • Size of remote file: 146 kB
assets/public-datasets.svg ADDED
assets/research-path.png ADDED

Git LFS Details

  • SHA256: 0bdf7618e6accb629c6f1ff0403228208da838dab244e2755ad81b5c8fe6eaa6
  • Pointer size: 131 Bytes
  • Size of remote file: 101 kB
assets/research-path.svg ADDED
reproduce/build_model_card.py ADDED
@@ -0,0 +1,400 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Build the HF card and figures from saved predictions; never loads a model.
2
+
3
+ Run: uv run --no-project --with matplotlib==3.11.1 python scripts/docs/build_model_card.py
4
+ Requires the canonical data/all.jsonl.gz. Generated assets ship alongside README.md on HF.
5
+ """
6
+
7
+ import csv
8
+ import gzip
9
+ import hashlib
10
+ import json
11
+ import shutil
12
+ from collections import defaultdict
13
+ from pathlib import Path
14
+
15
+ import matplotlib
16
+
17
+ matplotlib.use("Agg")
18
+ import matplotlib.pyplot as plt
19
+ from matplotlib.patches import FancyArrowPatch, FancyBboxPatch
20
+
21
+ ROOT = Path(__file__).resolve().parents[2]
22
+ OUT = ROOT / "weights/selfjev_4b"
23
+ ASSETS = OUT / "assets"
24
+ BG, PANEL, FG, MUTED, GRID = "#111211", "#1c201b", "#eeeee7", "#a9afa1", "#343c32"
25
+ ORANGE, GREEN, BLUE = "#ff7547", "#bad68e", "#9eb9d3"
26
+ GH = "https://github.com/Jwuthri/SelfJev/blob/master/"
27
+ SOURCES = {}
28
+ FAMILIES = [
29
+ ("heldout_intent_clinc", "CLINC150", "Intent routing", "held-out source"),
30
+ ("heldout_topic_dbpedia", "DBpedia", "Topic classification", "held-out source"),
31
+ ("heldout_question_type_trec", "TREC", "Question type", "held-out source"),
32
+ ("heldout_emotion_multiclass", "Emotion", "Emotion classification", "held-out source"),
33
+ ("heldout_boolq", "BoolQ", "Reading comprehension", "held-out source"),
34
+ ("heldout_sentiment_sst2", "SST-2", "Sentiment", "held-out source"),
35
+ ("hf_intent_banking77", "Banking77", "Banking intent", "seen source"),
36
+ ("hf_topic_agnews", "AG News", "News topic", "seen source"),
37
+ ("hf_sentiment_tweets", "TweetEval", "Tweet sentiment", "seen source"),
38
+ ("hf_nli", "MNLI", "Entailment (binary)", "seen source"),
39
+ ("hf_emotions_multilabel", "GoEmotions", "Emotion tags (exact set)", "seen source"),
40
+ ]
41
+
42
+
43
+ def record(path):
44
+ p = ROOT / path
45
+ SOURCES[path] = hashlib.sha256(p.read_bytes()).hexdigest()
46
+ return p
47
+
48
+
49
+ def report(run, split="test", ids=None):
50
+ path = f"reports/{run}/{split}/report.json"
51
+ d = json.loads(record(path).read_text())
52
+ ps = {p["id"]: p for p in d["predictions"]}
53
+ assert len(ps) == len(d["predictions"]) == d["meta"]["n"], path
54
+ assert abs(sum(p["correct"] for p in ps.values()) / len(ps) - d["metrics"]["question_accuracy"]) < 1e-10, path
55
+ if ids is not None:
56
+ assert set(ids) <= ps.keys(), path
57
+ ps = {i: ps[i] for i in ids}
58
+ return ps, path
59
+
60
+
61
+ def accuracy(ps):
62
+ return 100 * sum(p["correct"] for p in ps.values()) / len(ps)
63
+
64
+
65
+ def same_questions(a, b):
66
+ assert a.keys() == b.keys()
67
+ for i, p in a.items():
68
+ q = b[i]
69
+ assert p["target"] == q["target"] and p["type"] == q["type"], i
70
+ assert set(p["candidate_ids"]) == set(q["candidate_ids"]), i
71
+
72
+
73
+ def frame(title, subtitle, height=6.8):
74
+ fig = plt.figure(figsize=(14, height), facecolor=BG)
75
+ fig.text(0.045, 0.94, "SELFJEV / RESEARCH NOTES", color=ORANGE, size=10, weight="bold")
76
+ fig.text(0.045, 0.865, title, color=FG, size=24, weight="bold")
77
+ fig.text(0.045, 0.81, subtitle, color=MUTED, size=11)
78
+ return fig
79
+
80
+
81
+ def save(fig, name):
82
+ for ext in ("png", "svg"):
83
+ fig.savefig(ASSETS / f"{name}.{ext}", dpi=160, facecolor=BG, metadata={"Date": None} if ext == "svg" else None)
84
+ plt.close(fig)
85
+
86
+
87
+ def axes_style(ax):
88
+ ax.set_facecolor(BG)
89
+ for spine in ax.spines.values():
90
+ spine.set_visible(False)
91
+ ax.tick_params(colors=MUTED, length=0, pad=8)
92
+ ax.xaxis.label.set_color(MUTED)
93
+ ax.yaxis.label.set_color(MUTED)
94
+ ax.grid(axis="x", color=GRID, lw=0.7)
95
+ ax.set_axisbelow(True)
96
+
97
+
98
+ def main():
99
+ ASSETS.mkdir(exist_ok=True)
100
+ plt.rcParams.update({"font.family": "DejaVu Sans", "font.size": 11, "svg.fonttype": "none", "svg.hashsalt": "selfjev-model-card"})
101
+ rows = defaultdict(dict)
102
+ source = record("data/all.jsonl.gz")
103
+ with gzip.open(source, "rt") as f:
104
+ for line in f:
105
+ r = json.loads(line)
106
+ if r["dataset"] in {"hf", "eval2", "eval_llm"} and r["split"] == "test":
107
+ assert r["id"] not in rows[r["dataset"]]
108
+ rows[r["dataset"]][r["id"]] = r
109
+
110
+ public, public_path = report("selfjev_4b_treeserver", ids=rows["hf"])
111
+ jev, jev_path = report("external/full", "typesafe_jev-latest", ids=public)
112
+ same_questions(public, jev)
113
+ e2, e2_path = report("selfjev_4b_treeserver", "eval2")
114
+ je2, je2_path = report("external/eval2", "typesafe_jev-latest")
115
+ llm, llm_path = report("selfjev_4b_treeserver", "eval_llm")
116
+ same_questions(e2, je2)
117
+ for ds, ps in (("hf", public), ("eval2", e2), ("eval_llm", llm)):
118
+ assert ps.keys() == rows[ds].keys()
119
+ assert all(p["target"] == rows[ds][i]["target"] for i, p in ps.items())
120
+ jllm = {i: r["jev"] for i, r in rows["eval_llm"].items()}
121
+ assert len({p["model"] for p in jllm.values()}) == 1
122
+ overview = [
123
+ {"label": "Text decisions", "n": len(e2), "ours": accuracy(e2), "jev": accuracy(je2), "source": e2_path, "reference": je2_path},
124
+ {
125
+ "label": "AI response review",
126
+ "n": len(llm),
127
+ "ours": accuracy(llm),
128
+ "jev": accuracy(jllm),
129
+ "source": llm_path,
130
+ "reference": "data/all.jsonl.gz: eval_llm / jev",
131
+ "reference_model": next(iter(jllm.values()))["model"],
132
+ },
133
+ {
134
+ "label": "Public-source tasks",
135
+ "n": len(public),
136
+ "ours": accuracy(public),
137
+ "jev": accuracy(jev),
138
+ "source": public_path,
139
+ "reference": jev_path,
140
+ },
141
+ ]
142
+
143
+ public_rows = []
144
+ for family, label, task, exposure in FAMILIES:
145
+ subset = {i: p for i, p in public.items() if p["family"] == family}
146
+ ref = {i: jev[i] for i in subset}
147
+ assert len(subset) == 300
148
+ provenance = rows["hf"][next(iter(subset))]["provenance"]
149
+ public_rows.append(
150
+ {
151
+ "family": family,
152
+ "dataset": label,
153
+ "task": task,
154
+ "exposure": exposure,
155
+ "n": len(subset),
156
+ "ours": accuracy(subset),
157
+ "jev": accuracy(ref),
158
+ "dataset_url": "https://huggingface.co/datasets/" + provenance.split("hf:")[1].split("@")[0],
159
+ "source": public_path,
160
+ "reference": jev_path,
161
+ }
162
+ )
163
+ assert sum(r["n"] for r in public_rows) == len(public)
164
+
165
+ size_rows = []
166
+ for run, size, label, regime in [
167
+ ("baseline", 0.6, "Qwen3 reranker 0.6B", "stock"),
168
+ ("baseline_4b", 4, "Qwen3 reranker 4B", "stock"),
169
+ ("baseline_8b", 8, "Qwen3 reranker 8B", "stock"),
170
+ ("lora_pilot", 0.6, "Qwen3 + LoRA 0.6B", "early fine-tune"),
171
+ ("lora_4b", 4, "Qwen3 + LoRA 4B", "early fine-tune"),
172
+ ("lora_8b", 8, "Qwen3 + LoRA 8B", "early fine-tune"),
173
+ ("selfjev_4b_treeserver", 4, "SelfJev-4B", "current release"),
174
+ ]:
175
+ ps, path = report(run, ids=public)
176
+ same_questions(public, ps)
177
+ size_rows.append(
178
+ {"model": label, "nominal_backbone_billions": size, "regime": regime, "accuracy": accuracy(ps), "n": len(ps), "source": path}
179
+ )
180
+
181
+ journey = []
182
+ for run, label, split in [
183
+ ("tree_4b", "Initial tree", "eval2"),
184
+ ("tree_4b_r2b", "Verified hard cases", "eval2"),
185
+ ("tree_4b_instruct_r2x64", "Instruct backbone", "eval2"),
186
+ ("tree_4b_combo", "Broader data + options", "eval2"),
187
+ ("qwen35_4b_tree", "Qwen3.5 + tree training", "eval2"),
188
+ ("selfjev_4b_treeserver", "SelfJev / current engine", "eval2"),
189
+ ]:
190
+ ps, path = report(run, split)
191
+ same_questions(e2, ps)
192
+ journey.append({"model": label, "accuracy": accuracy(ps), "source": path, "n": len(ps)})
193
+ eikos, eikos_path = report("eikos_4b", "eval2")
194
+ same_questions(e2, eikos)
195
+
196
+ # Hero: a diagram of the shared-prefix computation, not an inference trace.
197
+ fig = plt.figure(figsize=(14, 4.6), facecolor=BG)
198
+ ax = fig.add_axes([0, 0, 1, 1])
199
+ ax.set(xlim=(0, 14), ylim=(0, 4.6))
200
+ ax.axis("off")
201
+ ax.text(0.6, 3.96, "SELFJEV / 4B", color=ORANGE, fontsize=13, weight="bold")
202
+ ax.text(0.6, 3.18, "Read once.\nDecide across questions.", color=FG, fontsize=29, weight="bold", va="top")
203
+ ax.text(0.6, 0.82, "YOUR TEXT / YOUR OPTIONS / YOUR GPU", color=MUTED, fontsize=10)
204
+
205
+ def box(x, y, w, h, text, color=FG):
206
+ ax.add_patch(FancyBboxPatch((x, y), w, h, boxstyle="round,pad=0.13", facecolor=PANEL, edgecolor=GRID))
207
+ ax.text(x + w / 2, y + h / 2, text, color=color, fontsize=11, ha="center", va="center", linespacing=1.6)
208
+
209
+ box(7.1, 1.8, 1.7, 0.9, "Shared\ndocument", ORANGE)
210
+ for y, label in [(3.35, "Route"), (2.05, "Verify"), (0.75, "Review")]:
211
+ ax.add_patch(FancyArrowPatch((8.95, 2.25), (10, y + 0.23), arrowstyle="->", mutation_scale=10, color=ORANGE))
212
+ box(10.1, y, 1.35, 0.46, label)
213
+ for dy in [-0.16, 0.16]:
214
+ ax.plot([11.6, 12.1, 12.6], [y + 0.23, y + 0.23 + dy, y + 0.23 + dy], color=GRID)
215
+ ax.scatter([12.75], [y + 0.23 + dy], s=24, color=GREEN)
216
+ ax.text(10.05, 0.17, "Questions Candidate scores", color=MUTED, fontsize=9)
217
+ save(fig, "hero")
218
+
219
+ fig = frame("Three views of decision quality", "Current SelfJev engine and Jev on matching questions. Higher is better.")
220
+ ax = fig.add_axes([0.235, 0.22, 0.65, 0.51])
221
+ axes_style(ax)
222
+ for i, r in enumerate(overview):
223
+ y = 2 - i
224
+ ax.barh(y + 0.15, r["ours"], 0.23, color=ORANGE, label="SelfJev-4B" if i == 0 else None)
225
+ ax.barh(y - 0.15, r["jev"], 0.23, color=GREEN, label="Jev API" if i == 0 else None)
226
+ ax.text(r["ours"] + 1, y + 0.15, f"{r['ours']:.1f}", color=ORANGE, va="center", weight="bold")
227
+ ax.text(r["jev"] + 1, y - 0.15, f"{r['jev']:.1f}", color=GREEN, va="center")
228
+ ax.set(
229
+ xlim=(0, 108),
230
+ xticks=[0, 25, 50, 75, 100],
231
+ yticks=[2, 1, 0],
232
+ yticklabels=[f"{r['label']}\n{r['n']:,} questions" for r in overview],
233
+ xlabel="Question accuracy (%)",
234
+ )
235
+ ax.legend(loc="lower left", bbox_to_anchor=(0, 1.03), ncol=2, frameon=False, labelcolor=FG)
236
+ fig.text(
237
+ 0.045,
238
+ 0.06,
239
+ "Public-source tasks: our adapted development benchmark. Authored tests use AI-checked labels.\n"
240
+ "Different suites measure different tasks; do not combine these scores into one ranking.",
241
+ color=MUTED,
242
+ size=10,
243
+ )
244
+ save(fig, "overview")
245
+
246
+ fig = frame(
247
+ "Public datasets, task by task",
248
+ "11 sources · 300 adapted questions each · identical questions and answer sets for both models",
249
+ 9.5,
250
+ )
251
+ ax = fig.add_axes([0.23, 0.22, 0.51, 0.53])
252
+ axes_style(ax)
253
+ for i, r in enumerate(public_rows):
254
+ y = 10 - i
255
+ ax.plot([r["ours"], r["jev"]], [y, y], color=GRID, lw=3)
256
+ ax.scatter(r["jev"], y, marker="s", s=38, color=GREEN, zorder=3)
257
+ ax.scatter(r["ours"], y, marker="o", s=47, color=ORANGE, zorder=4)
258
+ ax.text(106, y, f"{r['ours']:.1f}", color=ORANGE, va="center", ha="right")
259
+ ax.text(121, y, f"{r['jev']:.1f}", color=GREEN, va="center", ha="right")
260
+ ax.axhline(4.5, color=GRID, ls="--")
261
+ ax.set(
262
+ xlim=(0, 100),
263
+ ylim=(-0.6, 11),
264
+ xticks=[0, 25, 50, 75, 100],
265
+ yticks=list(range(10, -1, -1)),
266
+ yticklabels=[r["dataset"] for r in public_rows],
267
+ xlabel="Accuracy / exact set match (%)",
268
+ )
269
+ ax.text(106, 10.85, "SelfJev", color=ORANGE, ha="right", fontsize=10, weight="bold")
270
+ ax.text(121, 10.85, "Jev", color=GREEN, ha="right", fontsize=10, weight="bold")
271
+ fig.text(
272
+ 0.045,
273
+ 0.095,
274
+ "Above divider: sources excluded from task-specific training. Below: held-out rows from training sources.\n"
275
+ "All rows belong to a reused development benchmark; these are not official full-dataset leaderboard scores.",
276
+ color=MUTED,
277
+ size=10,
278
+ )
279
+ save(fig, "public-datasets")
280
+
281
+ fig = frame(
282
+ "What does model size buy you?",
283
+ "Same 3,300 public-source questions · our adapted development protocol · nominal backbone size",
284
+ 7.4,
285
+ )
286
+ ax = fig.add_axes([0.08, 0.24, 0.84, 0.49])
287
+ axes_style(ax)
288
+ styles = {"stock": (BLUE, "s"), "early fine-tune": (GREEN, "o"), "current release": (ORANGE, "*")}
289
+ offsets = [(12, -17), (-12, -18), (-12, -18), (12, 9), (-15, -26), (-12, 10), (14, 11)]
290
+ for r, offset in zip(size_rows, offsets):
291
+ c, m = styles[r["regime"]]
292
+ x, y = r["nominal_backbone_billions"], r["accuracy"]
293
+ ax.scatter(x, y, s=200 if m == "*" else 65, marker=m, color=c, zorder=3)
294
+ ax.annotate(
295
+ f"{r['model']} {y:.1f}%",
296
+ (x, y),
297
+ xytext=offset,
298
+ textcoords="offset points",
299
+ color=c,
300
+ size=10,
301
+ ha="right" if x == 8 or (x == 4 and m != "*") else "left",
302
+ weight="bold" if m == "*" else "normal",
303
+ )
304
+ ax.axhline(accuracy(jev), color=MUTED, ls="--", lw=0.8)
305
+ ax.text(0.35, accuracy(jev) + 0.5, f"Jev API {accuracy(jev):.1f}% · size undisclosed", color=MUTED, size=9)
306
+ ax.set(
307
+ xlim=(0.2, 8.8),
308
+ ylim=(56, 91),
309
+ xticks=[0.6, 2, 4, 6, 8],
310
+ xlabel="Nominal backbone parameters (billions)",
311
+ ylabel="Question accuracy (%)",
312
+ )
313
+ ax.grid(axis="y", color=GRID, lw=0.7)
314
+ fig.text(0.08, 0.13, "■ Stock rerankers ● Earlier fine-tunes ★ Current SelfJev", color=FG, size=10)
315
+ fig.text(
316
+ 0.045,
317
+ 0.055,
318
+ "Recipes, data and backbones differ: this is a comparison of measured systems, not a controlled scaling study.\n"
319
+ "Parameter count includes the backbone; the 230 MB adapter is not the size of the complete model.",
320
+ color=MUTED,
321
+ size=10,
322
+ )
323
+ save(fig, "accuracy-size")
324
+
325
+ fig = frame("How we arrived at SelfJev", "Selected research checkpoints · same 1,991 text-decision questions · accuracy (%)", 7.2)
326
+ ax = fig.add_axes([0.31, 0.22, 0.57, 0.51])
327
+ axes_style(ax)
328
+ for i, r in enumerate(journey):
329
+ c = ORANGE if i == len(journey) - 1 else GREEN
330
+ ax.barh(5 - i, r["accuracy"], 0.5, color=c, alpha=1 if c == ORANGE else 0.75)
331
+ ax.text(r["accuracy"] + 1, 5 - i, f"{r['accuracy']:.1f}", color=c, va="center", weight="bold")
332
+ ax.set(xlim=(0, 105), xticks=[0, 25, 50, 75, 100], yticks=list(range(5, -1, -1)), yticklabels=[r["model"] for r in journey])
333
+ fig.text(
334
+ 0.045,
335
+ 0.075,
336
+ "These runs change multiple ingredients; differences are not isolated causal gains.\n"
337
+ "The final point uses the current TreeServer. Earlier checkpoints use their recorded historical engines.",
338
+ color=MUTED,
339
+ size=10,
340
+ )
341
+ save(fig, "research-path")
342
+
343
+ bundle = {
344
+ "schema_version": 1,
345
+ "overview": overview,
346
+ "public_datasets": public_rows,
347
+ "accuracy_vs_size": size_rows,
348
+ "research_path": journey,
349
+ "external_text_decisions": {"model": "Eikos-4B", "accuracy": accuracy(eikos), "source": eikos_path},
350
+ "provenance_sha256": SOURCES,
351
+ "scope": "Saved results only. No new inference. Public datasets adapted; no S1Bench claim.",
352
+ }
353
+ (ASSETS / "chart-data.json").write_text(json.dumps(bundle, indent=2) + "\n")
354
+ with (ASSETS / "public-datasets.csv").open("w") as f:
355
+ writer = csv.DictWriter(f, fieldnames=list(public_rows[0]))
356
+ writer.writeheader()
357
+ writer.writerows(public_rows)
358
+
359
+ public_table = "\n".join(
360
+ f"| [{r['dataset']}]({r['dataset_url']}) | {r['task']} | {r['exposure']} | {r['n']} | {r['ours']:.1f}% | {r['jev']:.1f}% |"
361
+ for r in public_rows
362
+ )
363
+ overview_table = "\n".join(
364
+ f"| {r['label']} | {r['n']:,} | **{r['ours']:.1f}%** | {r['jev']:.1f}% | [report]({GH}{r['source']}) |" for r in overview
365
+ )
366
+ size_table = "\n".join(
367
+ f"| {r['model']} | {r['nominal_backbone_billions']:g}B | {r['regime']} | {r['accuracy']:.1f}% | [report]({GH}{r['source']}) |"
368
+ for r in size_rows
369
+ )
370
+ llm_table = []
371
+ for slug, label in [
372
+ ("verify", "Factual verification"),
373
+ ("judge", "Response judging"),
374
+ ("score", "Quality scoring"),
375
+ ("guardrail", "Policy guardrails"),
376
+ ("jailbreak", "Jailbreak detection"),
377
+ ]:
378
+ ps = {i: p for i, p in llm.items() if p["family"].startswith(f"tllm_{slug}_")}
379
+ llm_table.append(f"| {label} | {len(ps)} | {accuracy(ps):.1f}% | {accuracy({i: jllm[i] for i in ps}):.1f}% |")
380
+ card = (ROOT / "scripts/docs/model_card.template.md").read_text()
381
+ for key, value in {
382
+ "OVERVIEW": overview_table,
383
+ "PUBLIC": public_table,
384
+ "SIZE": size_table,
385
+ "LLM": "\n".join(llm_table),
386
+ "EIKOS": f"{accuracy(eikos):.1f}",
387
+ "PUBLIC_SCORE": f"{accuracy(public):.1f}",
388
+ }.items():
389
+ card = card.replace("{{" + key + "}}", value)
390
+ assert "{{" not in card
391
+ (OUT / "README.md").write_text(card)
392
+ reproduce = OUT / "reproduce"
393
+ reproduce.mkdir(exist_ok=True)
394
+ for name in ("build_model_card.py", "model_card.template.md"):
395
+ shutil.copyfile(ROOT / "scripts/docs" / name, reproduce / name)
396
+ print(f"Built card, 5 figures (PNG + SVG), CSV and JSON; {len(SOURCES)} hashed sources; all compared question IDs and targets checked.")
397
+
398
+
399
+ if __name__ == "__main__":
400
+ main()
reproduce/model_card.template.md ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen3.5-4B
3
+ base_model_relation: adapter
4
+ library_name: peft
5
+ pipeline_tag: text-classification
6
+ tags:
7
+ - decision-model
8
+ - self-hosted
9
+ - lora
10
+ - selfjev
11
+ ---
12
+
13
+ ![SelfJev-4B: read the document once, branch across questions, and score their candidate answers.](assets/hero.png)
14
+
15
+ # SelfJev-4B
16
+
17
+ **Structured decisions from text. A 4B backbone. Your own GPU.**
18
+
19
+ Route a customer message. Check a claim. Review an AI response. SelfJev answers questions over the options you supply and returns probabilities through a Python SDK or HTTP API. Its default engine shares the document computation across questions and scores candidates directly, without generating an answer token by token.
20
+
21
+ [Quickstart](#quickstart) · [Results](#results) · [Public datasets](#public-datasets) · [Model size](#accuracy-and-model-size) · [Architecture](#architecture) · [Research](#the-research-path) · [Source code](https://github.com/Jwuthri/SelfJev)
22
+
23
+ | Ask for | Get back | Use it for |
24
+ |---|---|---|
25
+ | Yes / no | Probability of yes | Verification, guardrails, detection |
26
+ | One choice | Selected option and probabilities | Routing, intent, categorization |
27
+ | An ordered score | Score and probabilities over your levels | Review and grading |
28
+ | Every matching option | Selected set and per-option probabilities | Tags, checklists, multiple issues |
29
+
30
+ This repository contains the **230 MB LoRA adapter**, not the entire model. The Qwen3.5-4B base weights download separately. The 4B model size refers to the backbone; the adapter stores the learned update.
31
+
32
+ ## Results
33
+
34
+ ![SelfJev and Jev accuracy on two authored test suites and the public-source development tasks; exact values below.](assets/overview.png)
35
+
36
+ | Evaluation | Questions | SelfJev-4B | Jev API | SelfJev evidence |
37
+ |---|---:|---:|---:|---|
38
+ {{OVERVIEW}}
39
+
40
+ **What these measure.** Text decisions cover authored routing, policy, evidence and difficult language cases. AI response review covers verification, judging, scoring, guardrails and jailbreak detection. Public-source tasks cover 11 adapted datasets. Each score counts a question as correct only when the expected answer matches; for multiple selections, the entire set must match.
41
+
42
+ These are recorded results from the current **TreeServer** engine and matched Jev predictions, not scores from a newly merged vLLM release. The authored sets use AI-checked labels, not human ground truth. Both have informed research direction. The public-source set is a repeatedly reused development benchmark. A fresh independent evaluation remains necessary.
43
+
44
+ ### How does it compare with another open model?
45
+
46
+ On the same 1,991 text-decision questions, the recorded **Eikos-4B** run scored **{{EIKOS}}%** using our task adapter and its letter-based readout. This is a comparison under this project's protocol, not a general ranking of open models. [Eikos report](https://github.com/Jwuthri/SelfJev/blob/master/reports/eikos_4b/eval2/report.json)
47
+
48
+ There is **no SelfJev S1Bench result yet**. Lev's published S1Bench scores cannot be compared with our authored-test scores. Comparing SelfJev, Lev, Reflex and other decision models requires the same dataset revision, item IDs, candidate sets, scoring rules and coverage.
49
+
50
+ ## Public datasets
51
+
52
+ ![Accuracy for all 11 public-source datasets. Orange circles are SelfJev; green squares are Jev. Values are also available in the table below.](assets/public-datasets.png)
53
+
54
+ **{{PUBLIC_SCORE}}% across 3,300 questions.** There are 300 questions per source, so the macro average over sources and the question-weighted average are equal. The 171 authored development questions are excluded here; the full 3,471-question development benchmark remains available in the reports.
55
+
56
+ | Source dataset | Task in our protocol | Training exposure | Questions | SelfJev | Jev |
57
+ |---|---|---|---:|---:|---:|
58
+ {{PUBLIC}}
59
+
60
+ “Held-out source” means that dataset was excluded from SelfJev's task-specific training. “Seen source” means other rows from that source were used in training. Neither establishes absence from Qwen's pretraining.
61
+
62
+ **These are adapted tasks, not official dataset leaderboard scores.** For example, Banking77 uses eight candidate options per question, CLINC uses seven or eight, and DBpedia uses six. MNLI is recast as binary entailment. GoEmotions scores exact matching over six candidate tags. Our preprocessing, sampling and answer sets are part of the evaluation and must accompany the numbers.
63
+
64
+ Known development-data issues include shared MNLI premises across splits and near-duplicate authored policy texts. See [data methodology](https://github.com/Jwuthri/SelfJev/blob/master/docs/data.md). All 11 slices are shown, including weaker emotion and sentiment results.
65
+
66
+ [Download chart data](assets/public-datasets.csv) · [SelfJev predictions](https://github.com/Jwuthri/SelfJev/blob/master/reports/selfjev_4b_treeserver/test/report.json) · [Matched Jev predictions](https://github.com/Jwuthri/SelfJev/blob/master/reports/external/full/typesafe_jev-latest/report.json)
67
+
68
+ ## Accuracy and model size
69
+
70
+ ![Accuracy against nominal backbone parameters for seven measured systems on identical public-source questions. Full results below.](assets/accuracy-size.png)
71
+
72
+ | Model / recipe | Backbone size | Training | Accuracy | Evidence |
73
+ |---|---:|---|---:|---|
74
+ {{SIZE}}
75
+
76
+ All points use the same 3,300 question IDs, labels and candidate sets. The stock models are rerankers mapped to our decision tasks. The earlier LoRA runs use older training recipes; SelfJev uses a different backbone generation and more training data. This shows the measured systems' trade-off between size and accuracy. It does **not** isolate the effect of parameter count or establish that a 4B model outperforms larger models generally.
77
+
78
+ Sizes are nominal backbone parameter counts, not checkpoint megabytes or runtime memory. Jev appears as a horizontal reference because its parameter count is undisclosed. We do not assign a guessed size to proprietary models.
79
+
80
+ ## AI response review
81
+
82
+ Breakdown of the 946-question authored suite, using the same current-engine predictions as the overview:
83
+
84
+ | Task | Questions | SelfJev | Jev |
85
+ |---|---:|---:|---:|
86
+ {{LLM}}
87
+
88
+ Labels were authored and checked with AI judges. Questions about one document are correlated; small differences should not be read as proof of superiority. This suite measures our defined answer choices and criteria, not unrestricted judgment quality. [Dataset design](https://github.com/Jwuthri/SelfJev/blob/master/docs/llm_eval_data.md) · [Predictions](https://github.com/Jwuthri/SelfJev/blob/master/reports/selfjev_4b_treeserver/eval_llm/report.json)
89
+
90
+ ## Quickstart
91
+
92
+ On Linux with an NVIDIA GPU, Git and uv installed:
93
+
94
+ ```bash
95
+ GIT_LFS_SKIP_SMUDGE=1 git clone https://github.com/Jwuthri/SelfJev.git
96
+ cd SelfJev
97
+ uv sync --frozen --no-dev --extra serve --extra gpu
98
+ uv run --no-sync python - <<'PYTHON'
99
+ from huggingface_hub import snapshot_download
100
+ snapshot_download(
101
+ "Jwuthrich/selfjev-4b",
102
+ local_dir="weights/selfjev_4b_hf",
103
+ allow_patterns=["adapter_model.safetensors", "adapter_config.json", "model.json"],
104
+ )
105
+ PYTHON
106
+
107
+ # Choose a secret for your own server.
108
+ export SELFJEV_API_KEYS="replace-with-your-long-random-secret"
109
+ uv run --no-sync selfjev serve \
110
+ --adapter weights/selfjev_4b_hf --host 127.0.0.1 --port 8000
111
+ ```
112
+
113
+ In another terminal, use the same secret:
114
+
115
+ ```python
116
+ from selfjev import SelfJev, Noul, Choice
117
+
118
+ client = SelfJev(
119
+ base_url="http://127.0.0.1:8000",
120
+ api_key="replace-with-your-long-random-secret",
121
+ )
122
+ result = client.system_one(
123
+ state="I was charged twice. Please refund the duplicate payment.",
124
+ questions={
125
+ "refund": Noul("Does the customer want a refund?"),
126
+ "team": Choice("Which team should handle this?", {
127
+ "billing": "payments and refunds",
128
+ "support": "technical issues",
129
+ }),
130
+ },
131
+ )
132
+ print(result.nouls["refund"].noul)
133
+ print(result.choices["team"].choice)
134
+ ```
135
+
136
+ The example shows the interface; it does not present fabricated model output. A generic Transformers text-generation or classification pipeline does not reproduce SelfJev's prompts, scoring rules or API. The server key is a secret you choose for your deployment, unrelated to Hugging Face credentials.
137
+
138
+ [HTTP API](https://github.com/Jwuthri/SelfJev/blob/master/docs/api.md) · [Self-hosting and AWS](https://github.com/Jwuthri/SelfJev/blob/master/docs/deploy.md) · [Fine-tuning](https://github.com/Jwuthri/SelfJev/blob/master/docs/finetune.md)
139
+
140
+ ## Architecture
141
+
142
+ The default engine builds a **shared-prefix tree**: compute the document once, branch for each question, then branch for candidate answers. It reads yes/no evidence from the logits and converts those scores into the requested answer type. The server includes every candidate in the question, matching training.
143
+
144
+ | Component | Current release |
145
+ |---|---|
146
+ | Backbone | Qwen3.5-4B |
147
+ | Base revision | `851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a` |
148
+ | Fine-tuning | Rank-64 LoRA on attention and DeltaNet projections |
149
+ | Default serving | TreeServer, shared document and question computation |
150
+ | Alternative serving | vLLM with a merged checkpoint and prefix caching |
151
+ | Training examples | 79,943 non-test questions; texts up to 16K tokens |
152
+ | Training target | 50% checked labels + 50% stored Jev probabilities |
153
+ | Training schedule | One epoch, learning rate 2e-4 |
154
+
155
+ Jev probabilities served as a teacher signal; they did not decide the authored training labels. Authored labels were checked by an AI judge. Full lineage is recorded in [model.json](model.json), with architecture detail in the [research documentation](https://github.com/Jwuthri/SelfJev/blob/master/docs/tree_model.md).
156
+
157
+ ## The research path
158
+
159
+ ![Recorded accuracy for selected research checkpoints, from the first shared-prefix tree to the current serving engine.](assets/research-path.png)
160
+
161
+ The improvements came from several changes: verified difficult examples, the instruct backbone, explicit option lists, broader training coverage, tree-aware training and soft teacher targets. The chart is a history of complete systems, not an ablation assigning each gain to one change.
162
+
163
+ The research also includes smaller stock rerankers, 8B models, Jina, T5Gemma, custom architectures, distillation and RLCD. The [full experiment ledger](https://github.com/Jwuthri/SelfJev/blob/master/docs/experiments.md) records results and dead ends; earlier implementations remain at the archive tag documented there. The checkpoint's original engine recorded a slightly different text-decision score; this card consistently uses the current engine for SelfJev's headline results.
164
+
165
+ ## Hardware and speed
166
+
167
+ A **24 GB NVIDIA GPU** is a practical starting recommendation, not a measured minimum. Plan for 16–32 GB host RAM and at least 50 GB free disk. The adapter download size does not describe inference memory: the full backbone and runtime state must fit too.
168
+
169
+ The default engine avoids token-by-token answer generation and shares work across questions. Latency still depends on input length, question count, candidate count, GPU and concurrency. The current release does not yet have a controlled GPU latency sweep or an established CPU minimum. Earlier A10G/L40S/H100 results used archived models and engines and are labeled accordingly in the [speed research](https://github.com/Jwuthri/SelfJev/blob/master/docs/speed.md).
170
+
171
+ ## Limits and reproducibility
172
+
173
+ - **Probability is not a guarantee.** The reported current-engine runs have no fitted calibration attached. Validate thresholds on application data before acting on confidence.
174
+ - **Some tasks remain weak.** Emotion labeling, fine-grained sentiment and selecting an exact set of labels are visibly harder than topic and intent classification.
175
+ - **Benchmarks have a scope.** AI-authored tests, reused development sets, sampled options and known overlap issues limit the conclusions. We make no S1Bench or general state-of-the-art claim.
176
+ - **Engine versions matter.** These accuracy results refer to the recorded current TreeServer runs. A merged checkpoint, quantization or another serving backend needs its own verification.
177
+
178
+ Every plotted value is regenerated from saved predictions. The generator checks matched IDs, targets, question types and candidate sets for report-to-report comparisons. [Chart data and source SHA-256 hashes](assets/chart-data.json) · [Generator](reproduce/build_model_card.py) · [Card template](reproduce/model_card.template.md)
179
+
180
+ Place the downloadable generator and template in `scripts/docs/` of a SelfJev source checkout, then run:
181
+
182
+ ```bash
183
+ uv run --no-project --with matplotlib==3.11.1 python scripts/docs/build_model_card.py
184
+ ```
185
+
186
+ This builds figures from reports and the canonical `data/all.jsonl.gz`; it performs no model inference. Rebuild the canonical file using the [data instructions](https://github.com/Jwuthri/SelfJev/blob/master/data/README.md) if absent.
187
+
188
+ | File | Purpose |
189
+ |---|---|
190
+ | `adapter_model.safetensors` | Trained LoRA weights |
191
+ | `adapter_config.json` | PEFT configuration |
192
+ | `model.json` | Base revision, training provenance and original recorded scores |
193
+ | `assets/*.png`, `assets/*.svg` | Model-card figures, raster and vector |
194
+ | `assets/chart-data.json`, `assets/public-datasets.csv` | Underlying results and source provenance |
195
+
196
+ Adapter SHA-256: `dfbf2834d883987893ec305a6093a345fd79c77f903f60f2f914cbe3b6058d1b`.
197
+
198
+ The adapter uses the Qwen base model linked above. No separate adapter license is declared in this repository. Independent project; not affiliated with TypeSafe or Qwen.