Upload folder using huggingface_hub
Browse files- README.md +59 -0
- config.json +30 -0
- head.pt +3 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +24 -0
README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: sentence-transformers/all-MiniLM-L6-v2
|
| 4 |
+
tags:
|
| 5 |
+
- typed-decisions
|
| 6 |
+
- calibration
|
| 7 |
+
- text-classification
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# sys1-fast-encoder-v2
|
| 11 |
+
|
| 12 |
+
Part of [sys1](https://github.com/ashutosh-rath02/sys1) — a small, open "System
|
| 13 |
+
One" model: typed judgments (`Choice`/`Score`/`Noul`) with real calibrated
|
| 14 |
+
probabilities, not generated text.
|
| 15 |
+
|
| 16 |
+
A `sentence-transformers/all-MiniLM-L6-v2` encoder (22M params) with a
|
| 17 |
+
one-neuron decision head, scored per candidate option in one batched forward
|
| 18 |
+
pass. No chat template, no generation — this is what gets to millisecond-level
|
| 19 |
+
decisions on CPU, unlike a causal chat model read via logits.
|
| 20 |
+
|
| 21 |
+
## Usage
|
| 22 |
+
|
| 23 |
+
```python
|
| 24 |
+
import sys
|
| 25 |
+
sys.path.insert(0, "src") # or `pip install sys1`
|
| 26 |
+
from sys1 import Choice, FastEngine
|
| 27 |
+
|
| 28 |
+
engine = FastEngine("ashurath/sys1-fast-encoder-v2") # or a local checkpoint dir
|
| 29 |
+
result = Choice(["billing", "technical support", "sales", "spam"]).ask(
|
| 30 |
+
"Classify what this support ticket is about.",
|
| 31 |
+
{"ticket": "My card was charged twice for the same order, please refund me."},
|
| 32 |
+
engine,
|
| 33 |
+
)
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
## Training
|
| 37 |
+
|
| 38 |
+
Trained on real labeled data pulled from public Hugging Face datasets (ticket
|
| 39 |
+
routing/urgency, sentiment) plus the train-only splits of the same public
|
| 40 |
+
benchmark used to compare TypeSafe's Jev and Convai's Laya
|
| 41 |
+
([`Luni/laya-jev-benchmark`](https://huggingface.co/datasets/Luni/laya-jev-benchmark)) —
|
| 42 |
+
never touching that benchmark's held-out test data. See
|
| 43 |
+
[`training/train_fast_encoder.py`](https://github.com/ashutosh-rath02/sys1/blob/master/training/train_fast_encoder.py).
|
| 44 |
+
|
| 45 |
+
## Measured results
|
| 46 |
+
|
| 47 |
+
| | Own held-out eval | Public agent-trace benchmark | Public phishing benchmark |
|
| 48 |
+
|---|---|---|---|
|
| 49 |
+
| Accuracy | 91.3% | 64.4% (from 37.4% pre-domain-training) | 56.5% (from 49.0%) |
|
| 50 |
+
| Brier score | 0.119 | 0.263 (worse — see below) | 0.370 (worse — see below) |
|
| 51 |
+
|
| 52 |
+
Accuracy improved substantially on both public benchmarks after training on
|
| 53 |
+
their train splits. Calibration (Brier score) got *worse* on both despite
|
| 54 |
+
that — the model became more confident faster than it became more correct.
|
| 55 |
+
This is an open issue, documented rather than hidden: see the
|
| 56 |
+
[project README](https://github.com/ashutosh-rath02/sys1#progress-the-honest-version)
|
| 57 |
+
for the full story.
|
| 58 |
+
|
| 59 |
+
Latency: ~35ms per decision end-to-end on a CPU laptop, no GPU.
|
config.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_cross_attention": false,
|
| 3 |
+
"architectures": [
|
| 4 |
+
"BertModel"
|
| 5 |
+
],
|
| 6 |
+
"attention_probs_dropout_prob": 0.1,
|
| 7 |
+
"bos_token_id": null,
|
| 8 |
+
"classifier_dropout": null,
|
| 9 |
+
"dtype": "float32",
|
| 10 |
+
"eos_token_id": null,
|
| 11 |
+
"gradient_checkpointing": false,
|
| 12 |
+
"hidden_act": "gelu",
|
| 13 |
+
"hidden_dropout_prob": 0.1,
|
| 14 |
+
"hidden_size": 384,
|
| 15 |
+
"initializer_range": 0.02,
|
| 16 |
+
"intermediate_size": 1536,
|
| 17 |
+
"is_decoder": false,
|
| 18 |
+
"layer_norm_eps": 1e-12,
|
| 19 |
+
"max_position_embeddings": 512,
|
| 20 |
+
"model_type": "bert",
|
| 21 |
+
"num_attention_heads": 12,
|
| 22 |
+
"num_hidden_layers": 6,
|
| 23 |
+
"pad_token_id": 0,
|
| 24 |
+
"position_embedding_type": "absolute",
|
| 25 |
+
"tie_word_embeddings": true,
|
| 26 |
+
"transformers_version": "5.17.0",
|
| 27 |
+
"type_vocab_size": 2,
|
| 28 |
+
"use_cache": true,
|
| 29 |
+
"vocab_size": 30522
|
| 30 |
+
}
|
head.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:60d23a27a923236dec0d48e5716cf16eab23fa52d90863a6e0e44ae523f41efd
|
| 3 |
+
size 3341
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f455d431f4db702872009e8b6e9d53702992dbee961dc1da24f0dc8a8694080c
|
| 3 |
+
size 90864192
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"cls_token": "[CLS]",
|
| 4 |
+
"do_basic_tokenize": true,
|
| 5 |
+
"do_lower_case": true,
|
| 6 |
+
"is_local": false,
|
| 7 |
+
"local_files_only": false,
|
| 8 |
+
"mask_token": "[MASK]",
|
| 9 |
+
"max_length": 128,
|
| 10 |
+
"model_max_length": 512,
|
| 11 |
+
"never_split": null,
|
| 12 |
+
"pad_to_multiple_of": null,
|
| 13 |
+
"pad_token": "[PAD]",
|
| 14 |
+
"pad_token_type_id": 0,
|
| 15 |
+
"padding_side": "right",
|
| 16 |
+
"sep_token": "[SEP]",
|
| 17 |
+
"stride": 0,
|
| 18 |
+
"strip_accents": null,
|
| 19 |
+
"tokenize_chinese_chars": true,
|
| 20 |
+
"tokenizer_class": "BertTokenizer",
|
| 21 |
+
"truncation_side": "right",
|
| 22 |
+
"truncation_strategy": "longest_first",
|
| 23 |
+
"unk_token": "[UNK]"
|
| 24 |
+
}
|