File size: 2,520 Bytes
188d690
 
 
 
 
d65ebf9
 
188d690
 
 
 
d65ebf9
 
188d690
d65ebf9
 
188d690
 
d65ebf9
 
188d690
 
d65ebf9
 
 
 
 
 
 
 
 
188d690
 
 
 
d65ebf9
 
188d690
 
d65ebf9
 
 
 
 
 
e6fc9ea
 
 
d65ebf9
 
 
e6fc9ea
d65ebf9
 
 
 
 
 
188d690
d65ebf9
188d690
d65ebf9
188d690
d65ebf9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
license: mit
library_name: transformers.js
pipeline_tag: feature-extraction
base_model: BAAI/bge-small-en-v1.5
language:
- en
tags:
- decidekit
- system-one
- text-classification
- zero-shot-classification
- calibration
- onnx
- on-device
thumbnail: https://huggingface.co/debuffjp/decide-small/resolve/main/assets/banner.png
---

![Decide Small](https://huggingface.co/debuffjp/decide-small/resolve/main/assets/banner.png)

# Decide Small

Decide reads a short piece of text and picks one of your labels, on the user's device, with a confidence you can act on: answers at 0.9 are right about 90% of the time. It's the default model in [decidekit](https://debuff.jp/decide/).

[Docs](https://debuff.jp/decide/docs/) 路 [Try it in your browser](https://debuff.jp/decide/playground/) 路 [GitHub](https://github.com/debuffjp/decidekit) 路 [npm](https://www.npmjs.com/package/decidekit)

## Use it

```bash
npm install decidekit
```

```ts
import { createDecider } from "decidekit";

const d = await createDecider(); // loads this model
const { choice, confidence } = await d.decide("my card still hasn't arrived", ["card_arrival", "lost_card", "refund"]);
```

The files download from this repo on first use, then stay in the browser's cache. To serve them yourself, copy this repo's files to your own host and pass `modelHost` to `createDecider()`.

## Numbers

| | |
|---|---|
| BANKING77, 77 labels, all training data | 93.1% |
| CLINC150, 150 labels, all training data | 96.3% |
| BANKING77 with 5 examples per label | 83.7% |
| A decision in Chrome (worker, median) | 7.7 ms |
| Download at 8-bit | 34 MB |

Ryzen 7 260 laptop, Chrome 156. Results and scripts: [eval/results-h14.json](https://github.com/debuffjp/decidekit/blob/main/eval/results-h14.json).

## Limits

- English. Use [Decide Multilingual](https://huggingface.co/debuffjp/decide-multilingual) for other languages.
- It reads what a text is about better than how it feels: 61% on tweet sentiment.
- About a paragraph at a time. Split longer text.

## What's in this repo

This repo holds the encoder, the part that turns text into vectors. decidekit adds the trained head and the calibrated confidence.

The weights are an unmodified copy of [Xenova/bge-small-en-v1.5](https://huggingface.co/Xenova/bge-small-en-v1.5) at revision `ea104da`, the ONNX conversion of [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5). We did not train them. They are here so decidekit has a stable, pinned source. MIT licensed, like the original.