Skip to content

Zero-shot classification on a CPU

For classification on a CPU, use an encoder decision model: laya:multilingual answers five questions in 516 ms and decima:small in 591 ms, with labels you write in each request and no training. The LLM-based decision models are more accurate, but take seconds on a CPU.

Which model

ModelTyped decisionsPublic benchmarkFive questions, CPUMemory
laya:multilingual0.3490.579516 ms1941 MB
decima:small0.4140.462591 ms586 MB
laya:en0.3570.532945 ms3207 MB
decima:base0.4830.5501213 ms1128 MB
nli:deberta-v3-large0.5360.4582318 ms3848 MB
gliclass:large0.4770.4342133 ms2415 MB
snap:2b-q4_k_m, an LLM0.6550.6911735 ms2802 MB

Medians through the HTTP API, five triage questions per request, on Ollaya Bench's CPU, a 24-core Threadripper 3960X; memory is the peak. Typed decisions is 2,000 typed questions; the public benchmark is Bespoke Labs', scored as macro accuracy.

  • Speed: laya:multilingual and decima:small, both multilingual.
  • English: laya:en is trained for guardrails and email triage.
  • Accuracy among encoders: nli:deberta-v3-large scores highest on typed decisions, and takes 2318 ms.
  • Many labels: the time of nli and gliclass grows with the number of labels (gliclass has the measurements).
  • Hard questions: the encoders fall well below the LLM-based models. If a second or two per request is fine, snap:2b-q4_k_m is far more accurate; see Jev alternative for the GPU models.

Times depend on your CPU. /api/decide reports eval_duration with every answer, so you can measure on yours.

Classify

Labels go in the request, as the criteria of a choice question:

ollaya pull laya:multilingual
ollaya run laya:multilingual \
  --questions '{"topic":{"type":"choice","instructions":"What is the message about?","criteria":["billing","login","shipping","other"]}}' \
  "Mi pedido lleva dos semanas sin llegar."

The same through the API:

curl http://localhost:11435/v1/systemone -H "Authorization: Bearer local" -d '{
  "model": "laya:multilingual",
  "state": "Mi pedido lleva dos semanas sin llegar.",
  "questions": {"topic": {"type": "choice", "instructions": "What is the message about?", "criteria": ["billing", "login", "shipping", "other"]}}
}'

Each label gets a probability, so you can send the uncertain answers to a person or a larger model. Labels can carry a description too: "criteria": {"shipping": "Late, lost or damaged deliveries", ...}.

To replace an LLM prompt that classifies today, see Replace LLM classifiers, which has a script to measure agreement with your own labels.