Abhinav-jigsawstack commited on
Commit
8721908
·
verified ·
1 Parent(s): 7bdc748

lev: step 18750 of preset 4b-instruct

Browse files
README.md CHANGED
@@ -26,13 +26,9 @@ lev answers typed questions about a piece of context in a single forward pass. Y
26
 
27
  <div align="center" style="line-height: 1;"><img src="https://img.shields.io/badge/license-Apache--2.0-2a78d6?style=flat-square" alt="Apache-2.0" style="display: inline-block; vertical-align: middle; margin: 2px;"> <img src="https://img.shields.io/badge/base-Qwen3.5--4B-2a78d6?style=flat-square" alt="Qwen3.5-4B" style="display: inline-block; vertical-align: middle; margin: 2px;"> <img src="https://img.shields.io/badge/output%20tokens-0-2a78d6?style=flat-square" alt="Zero output tokens" style="display: inline-block; vertical-align: middle; margin: 2px;"> <img src="https://img.shields.io/badge/API-%2Fv1%2Fsystemone-2a78d6?style=flat-square" alt="/v1/systemone compatible" style="display: inline-block; vertical-align: middle; margin: 2px;"> <a href="https://github.com/Abhinavexists/lev"><img src="https://img.shields.io/badge/code-GitHub-14181f?style=flat-square&logo=github" alt="GitHub" style="display: inline-block; vertical-align: middle; margin: 2px;"></a> <a href="https://interfaze.ai/blog/jev-now-open-source-lev"><img src="https://img.shields.io/badge/Blog-lev-yellow" alt="Blog" style="display: inline-block; vertical-align: middle; margin: 2px;"></a> <a href="https://interfaze.ai"><img src="https://img.shields.io/badge/Built_by-Interfaze--ai-4C1" alt="interfaze" style="display: inline-block; vertical-align: middle; margin: 2px;"></a></div>
28
 
29
- <p align="center">
30
- Read full blog here: <a href="https://interfaze.ai/blog/jev-now-open-source-lev">https://interfaze.ai/blog/jev-now-open-source-lev</a>
31
- </p>
32
-
33
- <h2 align="center">68.9% on all 13 S1Bench subsets. 4B parameters. Zero output tokens.</h2>
34
 
35
- <p align="center"><strong>Qwen3.5-4B + LoRA on one H100.</strong> On the six subsets the public S1Bench board completed, level with reflex-4b and behind only Jev and three open models of 26B–35B.</p>
36
 
37
  <p align="center"><a href="#quickstart"><strong>Quickstart</strong></a> · <a href="#self-hosting-a-jev-compatible-http-server">Self-hosting</a> · <a href="#benchmarks">Benchmarks</a> · <a href="#speed">Speed</a> · <a href="#why-it-works">Why it works</a> · <a href="#training">Training</a> · <a href="#boundaries-worth-understanding">Boundaries</a> · <a href="https://github.com/Abhinavexists/lev">GitHub</a></p>
38
 
@@ -52,7 +48,7 @@ It is built for the high-volume judgement calls inside a product: routing, moder
52
  pip install "lev[serve] @ git+https://github.com/Abhinavexists/lev#subdirectory=packages/lev"
53
  ```
54
 
55
- This needs Python 3.12 or newer and, for real-time use, a CUDA GPU. The `serve` extra installs torch, transformers, peft, and the HTTP server. The first load downloads the base model (Qwen/Qwen3.5-4B, about 8 GB) and this adapter (about 200 MB).
56
 
57
  ## Quickstart
58
 
@@ -92,7 +88,7 @@ print(result.usage.output_tokens) # 0
92
 
93
  These are real outputs from this checkpoint. The answers are objects, and `result.model_dump()` gives the same JSON the HTTP server returns.
94
 
95
- All the questions share one forward pass, so asking three questions costs about the same as asking one. `lev.load` reads `lev_release.json` from this repository to find the base model and the prompt format the adapter was trained with. It also applies the shipped calibration and loads the matching head, so there is nothing to configure.
96
 
97
  Because the probabilities are calibrated, you can gate on them. For example, act automatically above 0.9 and send anything lower to a person.
98
 
@@ -129,46 +125,7 @@ response = client.system_one(
129
  print(response.answers["team"].choice, response.answers["bug"].noul) # technical 0.92
130
  ```
131
 
132
- `GET /health` reports the loaded checkpoint, whether calibration is active, and the routing settings. The server batches every question in a request into one forward pass, accepts concurrent requests, and returns 422 with the reason for a malformed question.
133
-
134
- ## Hosted classification
135
-
136
- Text classification in Interfaze runs on a similar system to lev: the model reads the answer from the set of labels you define. The difference is that Interfaze is still token based, so it's a hybrid.
137
-
138
- | Item | lev | Interfaze |
139
- | :-- | :-- | :-- |
140
- | Output | Probabilities, zero output tokens | Tokens, returned as structured output |
141
- | Questions | Typed only: yes/no, choice, score | Any JSON schema, labels included |
142
- | In the same request | Classification only | OCR, web search, transcription, extraction, and more |
143
- | Where it runs | Your GPU | Interfaze API |
144
-
145
- ```bash
146
- pip install interfaze
147
- ```
148
-
149
- ```python
150
- import os
151
- from typing import Literal
152
- from pydantic import BaseModel, Field
153
- from interfaze import Interfaze
154
-
155
- interfaze = Interfaze(api_key=os.environ["INTERFAZE_API_KEY"])
156
-
157
- class Ticket(BaseModel):
158
- intent: Literal["refund", "cancel", "track", "other"]
159
- urgent: bool = Field(..., description="Does this need a human within the hour?")
160
-
161
- response = interfaze.chat.completions.parse(
162
- messages=[{"role": "user", "content": "Hi, I was charged twice for my order #4471 and I want a refund."}],
163
- response_format=Ticket,
164
- )
165
-
166
- print(response.choices[0].message.parsed)
167
- ```
168
-
169
- Tokens cost a little speed, but they let one request classify a document while also reading, searching, and extracting from it. Define your labels as an enum in the schema, and the label comes back as a typed field.
170
-
171
- **Interfaze docs → [interfaze.ai/docs](https://interfaze.ai/docs)**
172
 
173
  ## Benchmarks
174
 
@@ -178,27 +135,27 @@ Tokens cost a little speed, but they let one request classify a document while a
178
 
179
  | subset | task | **lev** | Jev | always the most common label |
180
  | --- | --- | --: | --: | --: |
181
- | vitaminc-dev | claim verification | 0.668 | **0.801** | 0.503 |
182
- | massive-en-US | intent routing, 18 scenarios | 0.857 | **0.874** | 0.163 |
183
- | massive-de-DE | intent routing, German | 0.823 | **0.871** | 0.163 |
184
- | boolq | yes/no reading comprehension | 0.827 | **0.893** | 0.580 |
185
- | squad2 | answerability | 0.813 | **0.836** | 0.502 |
186
- | paws | adversarial paraphrase | 0.776 | **0.900** | 0.516 |
187
- | multinli | natural language inference | **0.890** | 0.836 | 0.361 |
188
- | civil_comments | toxicity | 0.760 | **0.803** | 0.893 |
189
- | aegis2 | safety moderation | 0.800 | **0.804** | 0.568 |
190
- | helpsteer2 | helpfulness, 5 levels | **0.386** | 0.341 | 0.422 |
191
- | summeval-relevance | summary relevance, 5 levels | 0.358 | 0.358 | 0.458 |
192
- | summeval-consistency | summary faithfulness, 5 levels | 0.271 | **0.812** | 0.840 |
193
- | pubmedqa | biomedical yes/no/maybe | 0.732 | **0.764** | 0.532 |
194
- | **macro** | | 0.689 | **0.761** | |
195
-
196
- lev and TypeSafe Jev ran through the same harness on all 3,880 items S1Bench scores, pinned by [Nimble](https://github.com/bespokelabsai/nimble)'s manifests. Our Jev run lands within 0.8 points of TypeSafe's published figure on every subset, so the harness is not the gap.
197
-
198
- - **Noise:** at these sizes a per-subset difference needs roughly 5–9 points to be real. lev's leads on multinli and helpsteer2 are inside that.
199
- - **Where Jev is clearly ahead:** the minimal-edit pairs (paws −12.4, vitaminc −13.3) and summeval-consistency (−54.1), where lev rates most fully faithful summaries one level low. Fine-tuning introduced that: the untuned backbone scores 0.826.
200
  - **Constant baselines:** on civil_comments (89% not toxic) and the three 5-level rating subsets, always answering the most common label beats both models.
201
- - **Calibration:** mean ECE 0.115 for lev, 0.091 for Jev; lev is better calibrated on 5 of 13.
202
 
203
  <p align="center"><img src="assets/leaderboard.png" alt="S1Bench leaderboard over the six subsets every listed model completed" width="100%"></p>
204
 
@@ -216,7 +173,7 @@ A held-out split of the 29 training sources, with no row shared with training:
216
  | clinc_oos (151 intents) | 0.968 |
217
  | FEVER claim verification | 0.872\* |
218
 
219
- \* Measured on this checkpoint before the last serving update. That update routes choice sets of more than 68 options to label-token readout and re-selects the temperatures. The banking77 and clinc_oos rows come from after the update, which raised banking77 from 0.818. Smaller option sets are routed the same way as before.
220
 
221
  ### Speed
222
 
@@ -230,7 +187,7 @@ The 69 ms is engine compute for a short request (a three-sentence state), measur
230
 
231
  <p align="center"><img src="assets/how-it-works.png" alt="State and questions go through one forward pass, then label-token readout or the candidate-path head, then per-bucket temperatures, then typed answers" width="460"></p>
232
 
233
- - **Label-token readout.** Each option gets a short code, and the answer is read from the next-token logits over those codes. Codes that would split into two tokens are skipped, so every option stays one token. This handles yes/no, scores, and choice lists up to several hundred options. Choices are read in two option orders and averaged, which cancels position bias.
234
  - **Candidate-path head.** Past that point, a small learned head matches the state against each option's text, so the number of options has no fixed ceiling.
235
  - **Calibration.** Temperatures fitted after training are applied at load time. There is one per question type, readout mode, and choice option-count band. They were selected by how well they carry over to task families left out of the fit, not only by how well they fit held-out rows.
236
 
@@ -255,6 +212,21 @@ The 69 ms is engine compute for a short request (a three-sentence state), measur
255
  - **English only.**
256
  - **Needs a GPU for real-time use.** It runs on CPU, but a 4B backbone there takes seconds per call, not milliseconds.
257
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
258
  ## Files
259
 
260
  | file | role |
 
26
 
27
  <div align="center" style="line-height: 1;"><img src="https://img.shields.io/badge/license-Apache--2.0-2a78d6?style=flat-square" alt="Apache-2.0" style="display: inline-block; vertical-align: middle; margin: 2px;"> <img src="https://img.shields.io/badge/base-Qwen3.5--4B-2a78d6?style=flat-square" alt="Qwen3.5-4B" style="display: inline-block; vertical-align: middle; margin: 2px;"> <img src="https://img.shields.io/badge/output%20tokens-0-2a78d6?style=flat-square" alt="Zero output tokens" style="display: inline-block; vertical-align: middle; margin: 2px;"> <img src="https://img.shields.io/badge/API-%2Fv1%2Fsystemone-2a78d6?style=flat-square" alt="/v1/systemone compatible" style="display: inline-block; vertical-align: middle; margin: 2px;"> <a href="https://github.com/Abhinavexists/lev"><img src="https://img.shields.io/badge/code-GitHub-14181f?style=flat-square&logo=github" alt="GitHub" style="display: inline-block; vertical-align: middle; margin: 2px;"></a> <a href="https://interfaze.ai/blog/jev-now-open-source-lev"><img src="https://img.shields.io/badge/Blog-lev-yellow" alt="Blog" style="display: inline-block; vertical-align: middle; margin: 2px;"></a> <a href="https://interfaze.ai"><img src="https://img.shields.io/badge/Built_by-Interfaze--ai-4C1" alt="interfaze" style="display: inline-block; vertical-align: middle; margin: 2px;"></a></div>
28
 
29
+ <h2 align="center">74.3% on all 13 S1Bench subsets. 4B parameters. Zero output tokens.</h2>
 
 
 
 
30
 
31
+ <p align="center"><strong>Qwen3.5-4B + LoRA on one H100.</strong> On the six subsets the public S1Bench board completed, behind only Jev and two open models of 26B and up, ahead of reflex-4b and a 35B model.</p>
32
 
33
  <p align="center"><a href="#quickstart"><strong>Quickstart</strong></a> · <a href="#self-hosting-a-jev-compatible-http-server">Self-hosting</a> · <a href="#benchmarks">Benchmarks</a> · <a href="#speed">Speed</a> · <a href="#why-it-works">Why it works</a> · <a href="#training">Training</a> · <a href="#boundaries-worth-understanding">Boundaries</a> · <a href="https://github.com/Abhinavexists/lev">GitHub</a></p>
34
 
 
48
  pip install "lev[serve] @ git+https://github.com/Abhinavexists/lev#subdirectory=packages/lev"
49
  ```
50
 
51
+ This needs Python 3.12 or newer and, for real-time use, a CUDA GPU. The `serve` extra installs torch, transformers, peft, and the HTTP server. The first load downloads the base model (Qwen/Qwen3.5-4B, 9.3 GB of weights) and this release (about 205 MB: the 170 MB adapter, the 15 MB Mode B head and the tokenizer).
52
 
53
  ## Quickstart
54
 
 
88
 
89
  These are real outputs from this checkpoint. The answers are objects, and `result.model_dump()` gives the same JSON the HTTP server returns.
90
 
91
+ All the questions share one forward pass, so asking three questions costs about the same as asking one. `lev.load` reads `lev_release.json` from this repository to find the base model, the prompt format the adapter was trained with, and the strength to apply the adapter at. It also applies the shipped calibration and loads the matching head, so there is nothing to configure.
92
 
93
  Because the probabilities are calibrated, you can gate on them. For example, act automatically above 0.9 and send anything lower to a person.
94
 
 
125
  print(response.answers["team"].choice, response.answers["bug"].noul) # technical 0.92
126
  ```
127
 
128
+ `GET /health` reports the loaded checkpoint, whether calibration is active, the routing settings, and requests in flight against `max_pending`. The server batches every question in a request into one forward pass, and concurrent requests into shared forwards, so clients need not batch for throughput. Past `--max-pending` requests in flight (default 64) it answers 503 at once rather than queueing; a request queued past 30 s gets 504, and a malformed question gets 422 with the reason.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
  ## Benchmarks
131
 
 
135
 
136
  | subset | task | **lev** | Jev | always the most common label |
137
  | --- | --- | --: | --: | --: |
138
+ | vitaminc-dev | claim verification | 0.726 | **0.801** | 0.503 |
139
+ | massive-en-US | intent routing, 18 scenarios | 0.869 | **0.874** | 0.163 |
140
+ | massive-de-DE | intent routing, German | 0.829 | **0.871** | 0.163 |
141
+ | boolq | yes/no reading comprehension | 0.853 | **0.893** | 0.580 |
142
+ | squad2 | answerability | 0.819 | **0.836** | 0.502 |
143
+ | paws | adversarial paraphrase | 0.844 | **0.900** | 0.516 |
144
+ | multinli | natural language inference | **0.849** | 0.836 | 0.361 |
145
+ | civil_comments | toxicity | 0.783 | **0.803** | 0.893 |
146
+ | aegis2 | safety moderation | **0.836** | 0.804 | 0.568 |
147
+ | helpsteer2 | helpfulness, 5 levels | **0.361** | 0.341 | 0.422 |
148
+ | summeval-relevance | summary relevance, 5 levels | **0.371** | 0.358 | 0.458 |
149
+ | summeval-consistency | summary faithfulness, 5 levels | 0.806 | **0.812** | 0.840 |
150
+ | pubmedqa | biomedical yes/no/maybe | 0.716 | **0.764** | 0.532 |
151
+ | **macro** | | 0.743 | **0.761** | |
152
+
153
+ lev and TypeSafe Jev ran through the same harness on all 3,880 items S1Bench scores, pinned by [Nimble](https://github.com/bespokelabsai/nimble)'s manifests. The Jev run lands within 0.8 points of TypeSafe's published figure on every subset, so the harness is not the gap. The adapter scale was chosen by leave-one-family-out over these subsets; scored only on families held out of that choice, it estimates 0.728 ([FINDINGS §19](https://github.com/Abhinavexists/lev/blob/main/docs/FINDINGS.md#19-the-adapter-scale-is-an-out-of-distribution-knob-and-it-is-worth-39-macro-points)).
154
+
155
+ - **Noise:** at these sizes a per-subset difference needs roughly 5–9 points to be real. lev's leads on aegis2, helpsteer2, multinli and summeval-relevance are all inside that.
156
+ - **Where Jev is clearly ahead:** the minimal-edit pairs (vitaminc −7.5, paws −5.6). The adapter runs at a quarter of its trained strength, which narrowed those gaps from −13.3 and −12.4 and closed summeval-consistency's from −54.1 to −0.6: at full strength it rated most fully faithful summaries one level low.
157
  - **Constant baselines:** on civil_comments (89% not toxic) and the three 5-level rating subsets, always answering the most common label beats both models.
158
+ - **Calibration:** mean ECE 0.097 for lev, 0.091 for Jev; lev is better calibrated on 6 of 13. summeval-consistency is the outlier, under-confident at 0.303.
159
 
160
  <p align="center"><img src="assets/leaderboard.png" alt="S1Bench leaderboard over the six subsets every listed model completed" width="100%"></p>
161
 
 
173
  | clinc_oos (151 intents) | 0.968 |
174
  | FEVER claim verification | 0.872\* |
175
 
176
+ \* Measured on this checkpoint before the serving update that skips split label codes. That update routes choice sets of more than 68 options to label-token readout and re-selects the temperatures. The banking77 and clinc_oos rows come from after the update, which raised banking77 from 0.818. Smaller option sets are routed the same way as before.
177
 
178
  ### Speed
179
 
 
187
 
188
  <p align="center"><img src="assets/how-it-works.png" alt="State and questions go through one forward pass, then label-token readout or the candidate-path head, then per-bucket temperatures, then typed answers" width="460"></p>
189
 
190
+ - **Label-token readout.** Each option gets a short code, and the answer is read from the next-token logits over those codes. Codes that would split into two tokens are skipped, so every option stays one token. This handles yes/no, scores, and choice lists up to several hundred options. Choices are read in two option orders and averaged, which cancels position bias. Score levels stay in their trained order unless `lev serve` runs with `--score-order-average`, which is off by default.
191
  - **Candidate-path head.** Past that point, a small learned head matches the state against each option's text, so the number of options has no fixed ceiling.
192
  - **Calibration.** Temperatures fitted after training are applied at load time. There is one per question type, readout mode, and choice option-count band. They were selected by how well they carry over to task families left out of the fit, not only by how well they fit held-out rows.
193
 
 
212
  - **English only.**
213
  - **Needs a GPU for real-time use.** It runs on CPU, but a 4B backbone there takes seconds per call, not milliseconds.
214
 
215
+ ## Hosted classification
216
+
217
+ Text classification in Interfaze runs on a similar system to lev: the model reads the answer from the set of labels you define. The difference is that Interfaze is still token based, so it's a hybrid.
218
+
219
+ | Item | lev | Interfaze |
220
+ | :-- | :-- | :-- |
221
+ | Output | Probabilities, zero output tokens | Tokens, returned as structured output |
222
+ | Questions | Typed only: yes/no, choice, score | Any JSON schema, labels included |
223
+ | In the same request | Classification only | OCR, web search, transcription, extraction, and more |
224
+ | Where it runs | Your GPU | Interfaze API |
225
+
226
+ Tokens cost a little speed, but they let one request classify a document while also reading, searching, and extracting from it. Define your labels as an enum in the schema, and the label comes back as a typed field.
227
+
228
+ **Interfaze docs → [interfaze.ai/docs](https://interfaze.ai/docs)**
229
+
230
  ## Files
231
 
232
  | file | role |
assets/accuracy-by-subset.png CHANGED

Git LFS Details

  • SHA256: 2d5941819910e61034af2a48ac5800db2409eaa2ef786452b577477179c3e1b3
  • Pointer size: 131 Bytes
  • Size of remote file: 176 kB

Git LFS Details

  • SHA256: 4b210c5e114da342201b48d283223a5b84303760c48a4e0802e8c769dec4b544
  • Pointer size: 131 Bytes
  • Size of remote file: 176 kB
assets/accuracy-per-parameter.png CHANGED

Git LFS Details

  • SHA256: ed5465d6df019c81594c05434b7b1e890f5f8e696562dbc97d2b91f92f504022
  • Pointer size: 131 Bytes
  • Size of remote file: 103 kB

Git LFS Details

  • SHA256: ed23c1d747a8b1a4eb54727ff7a5e95c53cae56bb379ffe52da214a45ad48127
  • Pointer size: 131 Bytes
  • Size of remote file: 103 kB
assets/latency.png ADDED
assets/leaderboard.png CHANGED

Git LFS Details

  • SHA256: 0f758b2d7cc5638cff05dd34d498dc82fa0e4f19ab6ad7ecc5d22f0188a9dc57
  • Pointer size: 131 Bytes
  • Size of remote file: 241 kB

Git LFS Details

  • SHA256: 65ceec18ae05b937ff8183d2a248de30bd5940fa765cd35ad8c1a733a6c44644
  • Pointer size: 131 Bytes
  • Size of remote file: 246 kB
assets/social-card.png ADDED
calibration.json CHANGED
@@ -1,23 +1,23 @@
1
  {
2
  "temperatures": {
3
- "choice:B:large": 0.6333014152276044,
4
- "choice:B": 0.6333014152276044,
5
- "noul:A": 2.3332930831706458,
6
- "score:A": 2.8033236630327885,
7
- "choice:A": 1.7666659539679779,
8
- "choice:A:small": 1.789783450971802,
9
- "choice:A:mid": 1.6085685001661532,
10
- "choice:A:large": 1.6641112617330986
11
  },
12
  "fitted_on": "calibration (transfer-selected)",
13
  "n_samples": {
14
- "choice:B:large": 10227,
15
- "choice:B": 10227,
16
- "noul:A": 12073,
17
  "score:A": 12258,
18
- "choice:A": 14133,
19
  "choice:A:small": 11480,
 
 
20
  "choice:A:mid": 1138,
21
- "choice:A:large": 1515
 
 
22
  }
23
  }
 
1
  {
2
  "temperatures": {
3
+ "score:A": 1.8687166685806083,
4
+ "choice:A:small": 1.466031501359245,
5
+ "choice:A": 1.4606453602789027,
6
+ "noul:A": 1.282162150839547,
7
+ "choice:A:mid": 1.3228486325144098,
8
+ "choice:A:large": 1.4983293579095338,
9
+ "choice:B:large": 0.5794711375492776,
10
+ "choice:B": 0.5794711375492776
11
  },
12
  "fitted_on": "calibration (transfer-selected)",
13
  "n_samples": {
 
 
 
14
  "score:A": 12258,
 
15
  "choice:A:small": 11480,
16
+ "choice:A": 14133,
17
+ "noul:A": 12073,
18
  "choice:A:mid": 1138,
19
+ "choice:A:large": 1515,
20
+ "choice:B:large": 10227,
21
+ "choice:B": 10227
22
  }
23
  }
lev_release.json CHANGED
@@ -18,5 +18,6 @@
18
  "calibration.json"
19
  ],
20
  "metrics": {},
21
- "created": "2026-09-24T06:29:31+00:00"
 
22
  }
 
18
  "calibration.json"
19
  ],
20
  "metrics": {},
21
+ "created": "2026-09-24T06:29:31+00:00",
22
+ "adapter_scale": 0.25
23
  }