interfaze-ai/lev
- License
- apache-2.0
- Size
- 196 MB
- Revision
- main
Mirrored from interfaze-ai/lev
All models by interfaze-ai →Mirrored from interfaze-ai/lev
All models by interfaze-ai →[Image blocked: lev: one state, many typed decisions, one forward pass]
lev answers typed questions about a piece of context in a single forward pass. You give it a state (text, a ticket, an email, or JSON) and a set of yes/no, choice, and score questions. It reads each answer from the logits it already computed and returns calibrated probabilities over exactly the options you supplied. It is a LoRA adapter on Qwen3.5-4B, and it speaks TypeSafe's /v1/systemone protocol, so code written for the TypeSafe SDK works against it once you change the base URL.
Read full blog here: https://interfaze.ai/blog/jev-now-open-source-lev
Qwen3.5-4B + LoRA on one H100. On the six subsets the public S1Bench board completed, level with reflex-4b and behind only Jev and three open models of 26B–35B.
Quickstart · Self-hosting · Benchmarks · Speed · Why it works · Training · Boundaries · GitHub
No generated tokens, no JSON to parse, no retries. lev cannot return a label outside your options, because the answer space is the option set you send. It can still pick the wrong option: the guarantee is structural, not a guarantee of correctness.
It is built for the high-volume judgement calls inside a product: routing, moderation, intent detection, triage, grading, and checking LLM output.
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).
These are real outputs from this checkpoint. The answers are objects, and result.model_dump() gives the same JSON the HTTP server returns.
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.
Because the probabilities are calibrated, you can gate on them. For example, act automatically above 0.9 and send anything lower to a person.
Existing TypeSafe clients work once you point them at the server:
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.
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.
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.
Interfaze docs → interfaze.ai/docs
[Image blocked: lev and Jev accuracy on each S1Bench subset]
lev and TypeSafe Jev ran through the same harness on all 3,880 items S1Bench scores, pinned by 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.
[Image blocked: S1Bench leaderboard over the six subsets every listed model completed]
[Image blocked: Macro accuracy against parameter count]
A held-out split of the 29 training sources, with no row shared with training:
* 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.
[Image blocked: lev compute per call on one H100: 169 ms to 69 ms]
A call is one batched forward pass over every question, so compute stays flat from one question to eight, and a 60-option choice costs the same as a yes/no.
The 69 ms is engine compute for a short request (a three-sentence state), measured inside the container; S1Bench's longer states take more. End to end from a laptop, Jev's hosted API answered in 335–346 ms median and lev on one Modal H100 in 414–654 ms across two runs.
[Image blocked: State and questions go through one forward pass, then label-token readout or the candidate-path head, then per-bucket temperatures, then typed answers]
The adapter is released under Apache-2.0, the same license as the base model. Some of the training datasets have their own terms, including non-commercial licenses. Review them before commercial use.
Not affiliated with or endorsed by TypeSafe AI.
Apache 2.0 · Interfaze
pip install "lev[serve] @ git+https://github.com/Abhinavexists/lev#subdirectory=packages/lev"import lev
model = lev.load("interfaze-ai/lev")
state = "Hi, I was charged twice for my order #4471 and I want a refund."questions = { "intent": { "type": "choice", "instructions": "What does the customer want?", "criteria": { "refund": "wants money back", "cancel": "wants to cancel an order", "track": "wants to know where an order is", "other": "anything else", }, }, "urgent": {"type": "noul", "instructions": "Does this need a human within the hour?"}, "frustration": { "type": "score", "instructions": "How frustrated is the customer?", "criteria": ["calm", "mildly annoyed", "annoyed", "angry"], },}
result = model.system_one(state, questions)print(result.answers["intent"].choice) # refundprint(result.answers["intent"].probabilities)# {'refund': 0.84, 'cancel': 0.094, 'track': 0.012, 'other': 0.054}print(result.answers["urgent"].noul) # 0.43print(result.answers["frustration"].score) # 1.57, between "mildly annoyed" and "annoyed"print(result.usage.output_tokens) # 0lev serve --checkpoint interfaze-ai/lev --host 0.0.0.0 --port 8000curl -s localhost:8000/v1/systemone -H 'content-type: application/json' -d '{ "state": "The package arrived crushed and the screen is cracked.", "questions": {"damaged": {"type": "noul", "instructions": "Was the item damaged?"}}}'from typesafe_sdk import Choice, Noul, TypeSafeClient
# The first request after startup compiles kernels; allow more than the default 10 s.client = TypeSafeClient(base_url="http://localhost:8000", api_key="local", timeout=60)response = client.system_one( state={"ticket": "The app crashes every time I open settings."}, questions={ "team": Choice( instructions="Which team owns this?", criteria={"billing": "payments, refunds", "technical": "bugs, crashes", "other": None}, ), "bug": Noul(instructions="Is this a bug report?"), },)print(response.answers["team"].choice, response.answers["bug"].noul) # technical 0.92 pip install interfaze import os from typing import Literal from pydantic import BaseModel, Field from interfaze import Interfaze interfaze = Interfaze(api_key=os.environ["INTERFAZE_API_KEY"]) class Ticket(BaseModel): intent: Literal["refund", "cancel", "track", "other"] urgent: bool = Field(..., description="Does this need a human within the hour?") response = interfaze.chat.completions.parse( messages=[{"role": "user", "content": "Hi, I was charged twice for my order #4471 and I want a refund."}], response_format=Ticket, ) print(response.choices[0].message.parsed)