gliclass
2 TagsUpdated Apache-2.0by Knowledgator
Instruction-following zero-shot classifier by Knowledgator: all options of a question are scored in one pass, so cost barely grows with the number of options.
zero-shot439m
ollaya run gliclass --preset triage "I was charged twice for my subscription this month and want a refund."curl http://localhost:11435/api/decide \
-H "Content-Type: application/json" \
-d '{
"model": "gliclass",
"state": "I was charged twice for my subscription this month and want a refund.",
"questions": {
"department": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "Payments, invoices and refunds",
"technical": "Bugs, errors and outages",
"account": "Login, profile and settings"
}
},
"refund": {
"type": "noul",
"instructions": "Is the customer asking for a refund?"
}
}
}'# Already using a TypeSafe SDK? Set TYPESAFE_BASE_URL=http://localhost:11435 instead.
import requests
response = requests.post(
"http://localhost:11435/api/decide",
json={
"model": "gliclass",
"state": "I was charged twice for my subscription this month and want a refund.",
"questions": {
"department": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "Payments, invoices and refunds",
"technical": "Bugs, errors and outages",
"account": "Login, profile and settings"
}
},
"refund": {
"type": "noul",
"instructions": "Is the customer asking for a refund?"
}
}
},
)
answers = response.json()["answers"]
print(answers["department"]["choice"], answers["refund"]["noul"])const response = await fetch("http://localhost:11435/api/decide", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
model: "gliclass",
state: "I was charged twice for my subscription this month and want a refund.",
questions: {
department: {
type: "choice",
instructions: "Which team should handle this?",
criteria: {
billing: "Payments, invoices and refunds",
technical: "Bugs, errors and outages",
account: "Login, profile and settings"
}
},
refund: {
type: "noul",
instructions: "Is the customer asking for a refund?"
}
}
}),
});
const { answers } = await response.json();
console.log(answers.department.choice, answers.refund.noul);Models
View all| Name |
|---|
| gliclasslatest1.8 GB · 1024 ctx · English |
| gliclass:large1.8 GB · 1024 ctx · English |
Each model carries fp16 and fp32 graphs over one weights file, and loads fp16 on a CUDA GPU and fp32 on CPU.
Readme
GLiClass is an instruction-following zero-shot classifier by Knowledgator. Ollaya writes a question's options as labels and its instructions as the task prompt, and the model scores all the labels in a single pass. The cost therefore barely grows with the number of options.
Models
| Tag | Backbone | Params | License | Typed-decisions accuracy |
|---|---|---|---|---|
gliclass:latest, gliclass:large | DeBERTa-v3-large | 439M | Apache-2.0 | 0.477 |
Accuracy is the argmax against the majority label on all 400 typed-decisions states. For comparison, nli scores 0.548 and laya:en 0.361.
Usage
ollaya run gliclass --preset triage "I was charged twice for my subscription this month and want a refund."How it works
- One sequence per question. Label markers go first, then the task prompt, then the state, up to 1,024 tokens.
- Scoring. The graph pools every label's span and scores it against the text.
- Mapping to question types. The mapping of
choice,scoreandnoulonto labels is Ollaya's, chosen by testing on typed-decisions. - Weights. They are Knowledgator's own
model.safetensors, downloaded from Hugging Face, pinned to a commit and verified by sha256. - Parity. Ollaya's Rust runtime matches the Python reference exactly on CPU and CUDA.
Limits
- Yes/no questions without criteria are its weakest point. Such a question is scored as one label with a sigmoid, and it can be confidently wrong. Give
noulquestionscriteriawith bothtrueandfalsedescriptions, or usenlifor them. - Option count. A question with more options than fit in 1,024 tokens is rejected with
TOO_MANY_OPTIONS. - Uncalibrated. The model is not calibrated. Fit a
CALIBRATIONlayer before you rely on thresholds.