Text Classification
sentence-transformers
Safetensors
English
bert
ren
secnd
selective-classification
calibration
human-in-the-loop
text-embeddings-inference
Instructions to use Secnd-AI/ren with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Secnd-AI/ren with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Secnd-AI/ren") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
Model card for the reader release
Browse files
README.md
CHANGED
|
@@ -1,95 +1,108 @@
|
|
| 1 |
---
|
| 2 |
-
license: cc-by-sa-4.0
|
| 3 |
language:
|
| 4 |
-
- en
|
|
|
|
| 5 |
library_name: sentence-transformers
|
| 6 |
-
pipeline_tag:
|
| 7 |
-
base_model:
|
| 8 |
-
datasets:
|
| 9 |
-
- WillHeld/top_v2
|
| 10 |
tags:
|
| 11 |
-
- ren
|
| 12 |
-
- secnd
|
| 13 |
-
-
|
| 14 |
-
-
|
| 15 |
-
-
|
| 16 |
-
- intent-classification
|
| 17 |
-
- human-in-the-loop
|
| 18 |
---
|
| 19 |
|
| 20 |
# Ren
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
This repository holds Ren's encoder, release **`ren-1.0.0`**. The per-organisation decision head, calibration and gate are fitted on each organisation's own labels by the [Secnd](https://github.com/Rish-it/secnd) runtime.
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
```
|
| 31 |
|
| 32 |
-
##
|
| 33 |
|
| 34 |
-
``
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
["set an alarm for 7am", "what's the weather tomorrow"], normalize_embeddings=True
|
| 40 |
-
) # (2, 384)
|
| 41 |
```
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
## Checkpoints
|
| 46 |
-
|
| 47 |
-
| Release | Repo | Encoder | Params | Dims | Best at |
|
| 48 |
-
|---|---|---|---|---|---|
|
| 49 |
-
| **`ren-1.0.0`** | **`secnd-ai/ren`** (this repo, tag `v1.0.0`) | MiniLM-L6, tuned on TOPv2 | 22.7M | 384 | English requests and intents; runs on CPU |
|
| 50 |
-
|
| 51 |
-
## How Ren decides
|
| 52 |
-
|
| 53 |
-
1. **Encode** each item with this encoder (plus a small numeric block and a memory of past answers for the same payee or sender).
|
| 54 |
-
2. **Score** it with a logistic-regression head trained only on the organisation's own labels.
|
| 55 |
-
3. **Calibrate** probabilities with one temperature fitted on a fixed calibration split.
|
| 56 |
-
4. **Gate:** pick the lowest confidence threshold whose one-sided 95% Clopper-Pearson lower bound on precision clears 99%, walking down from the most confident answers and stopping at the first failure. Above it Ren answers automatically; below it a person decides. With too little evidence it answers nothing.
|
| 57 |
-
5. **Learn** from every answer: the head refits in 0.27 s (0.01 s warm-started) at 10,000 labels, and a new version goes live only if it passes the gate, does not lose more than one point of accuracy, and certifies at least as much as the live one. 5% of automatic answers go to a person as spot-checks, and if those show precision below 99% Ren stops answering on its own until a new version passes.
|
| 58 |
-
|
| 59 |
-
## Training
|
| 60 |
-
|
| 61 |
-
All-MiniLM-L6-v2 tuned once on TOPv2 (Chen et al., 2020): English assistant requests in 8 domains, labelled by the top-level intent of each parse (69 intents). Every TOPv2 request whose normalised text appears anywhere in MTOP was removed first (23,137 rows, leaving 157,405), so MTOP results use only the labels inside each budget. Supervised contrastive loss over class-balanced batches (16 intents x 4 rows), temperature 0.05, AdamW lr 2e-5, 3,000 steps, seed 0, one NVIDIA A10G.
|
| 62 |
|
| 63 |
## Results
|
| 64 |
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
|
| 68 |
-
|---|---|---|---|
|
| 69 |
-
| MTOP
|
| 70 |
-
|
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
|
|
|
| 2 |
language:
|
| 3 |
+
- en
|
| 4 |
+
license: cc-by-sa-4.0
|
| 5 |
library_name: sentence-transformers
|
| 6 |
+
pipeline_tag: text-classification
|
| 7 |
+
base_model: jhu-clsp/ettin-encoder-400m
|
|
|
|
|
|
|
| 8 |
tags:
|
| 9 |
+
- ren
|
| 10 |
+
- secnd
|
| 11 |
+
- selective-classification
|
| 12 |
+
- calibration
|
| 13 |
+
- human-in-the-loop
|
|
|
|
|
|
|
| 14 |
---
|
| 15 |
|
| 16 |
# Ren
|
| 17 |
|
| 18 |
+
Built with Muse Spark Open. Ren is independently developed for Meta's platform and is not an official
|
| 19 |
+
Meta product.
|
|
|
|
| 20 |
|
| 21 |
+
Ren reads a question, its options, a message and a person's nearest past decisions, then scores each
|
| 22 |
+
option. It is trained once; a new business supplies history, not a new training run. A temperature, a
|
| 23 |
+
confidence threshold and a support floor come from held-out calibration rows, and a Clopper–Pearson lower
|
| 24 |
+
bound decides whether any answer may be automatic. Anything below it goes to a person. English only.
|
|
|
|
| 25 |
|
| 26 |
+
## What is in this repository
|
| 27 |
|
| 28 |
+
| Path, tag `v1.1.0` | What it is | Use it for |
|
| 29 |
+
| --- | --- | --- |
|
| 30 |
+
| `reader/` | 400M reader, `ic-ettin-400m-s6000-near-wide-fine-seed1` | Choosing among up to 128 options from a person's history |
|
| 31 |
+
| `meta/` | The reader above, fine-tuned on typed decisions and written Meta-app tasks | Ad, inbox and account decisions |
|
| 32 |
+
| root files | MiniLM encoder from [`v1.0.0`](https://huggingface.co/Secnd-AI/ren/blob/v1.0.0/README.md) | Retrieval vectors and the per-business classifier head |
|
| 33 |
|
| 34 |
+
```sh
|
| 35 |
+
hf download Secnd-AI/ren --revision v1.1.0 --include "reader/*" --local-dir ren
|
|
|
|
|
|
|
| 36 |
```
|
| 37 |
|
| 38 |
+
Serving code and setup: [github.com/Rish-it/secnd](https://github.com/Rish-it/secnd).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
## Results
|
| 41 |
|
| 42 |
+
Fixed official test sets, measured on these exact weights. Calibration chose this seed; test sets chose nothing.
|
| 43 |
+
|
| 44 |
+
| Set | No examples | 8 nearest | 32 nearest |
|
| 45 |
+
| --- | ---: | ---: | ---: |
|
| 46 |
+
| MTOP | 75.99% | 92.38% | 93.59% |
|
| 47 |
+
| BANKING77 | 68.99% | 89.90% | 86.23% |
|
| 48 |
+
|
| 49 |
+
With a person's history, the reader against a logistic head on the same retrieval vectors:
|
| 50 |
+
|
| 51 |
+
| History | MTOP reader | MTOP head | BANKING77 reader | BANKING77 head |
|
| 52 |
+
| --- | ---: | ---: | ---: | ---: |
|
| 53 |
+
| 200 labels | 82.51% | 69.54% | 75.39% | 54.16% |
|
| 54 |
+
| 1,000 labels | 88.12% | 80.46% | 82.60% | 85.32% |
|
| 55 |
+
| All labels | 92.45% | 93.00% | 89.87% | 92.50% |
|
| 56 |
+
|
| 57 |
+
Answering alone, on all 4,386 MTOP test rows, with the gate and support floor fixed on calibration. Twelve
|
| 58 |
+
calibration labels were changed by a model audit, not a human one. Test labels were never changed, so
|
| 59 |
+
precision is measured against labels that keep their errors.
|
| 60 |
+
|
| 61 |
+
| Examples | Answered alone | Accepted | Errors | Precision | 95% low | Wrong accepts with the right option removed, of 500 |
|
| 62 |
+
| ---: | ---: | ---: | ---: | ---: | ---: | ---: |
|
| 63 |
+
| 0 | 0% | 0 | 0 | n/a | n/a | 0 |
|
| 64 |
+
| 8 | 21.04% | 923 | 1 | 99.89% | 99.40% | 2 |
|
| 65 |
+
| 32 | 14.46% | 634 | 1 | 99.84% | 99.12% | 2 |
|
| 66 |
+
|
| 67 |
+
`meta/` on 342 and 338 fresh written tasks: 84.8% agreement with a three-model panel and 76.0% with Muse Spark
|
| 68 |
+
1.3, against 44.4% and 49.7% for always picking the most common answer. Ad decisions are the weakest, at 70.3%
|
| 69 |
+
and 54.3%. This is agreement with models on written tasks, not accuracy on real data. On the fixed typed
|
| 70 |
+
benchmark of 2,000 decisions, before the Meta tuning, the same reader scores 79.70%.
|
| 71 |
+
|
| 72 |
+
One A10G over HTTP: 17.5 s cold start, then 3.68 requests a second with four clients, about $0.08 of GPU per
|
| 73 |
+
1,000 decisions when saturated. Four CPUs: 2.2 s p95 per request at 8 nearest, measured on the same architecture.
|
| 74 |
+
|
| 75 |
+
## Limits
|
| 76 |
+
|
| 77 |
+
- One seed. Certified coverage moved 19 points between two seeds of one earlier pool, and on this pool a second
|
| 78 |
+
seed scores 0.55 points higher on MTOP and 0.72 on BANKING77 at 8 nearest. Report a range, never a single best run.
|
| 79 |
+
- The gate certifies full MTOP history only. Another business gets no inherited permission to answer alone; it
|
| 80 |
+
earns it from its own reviewed decisions.
|
| 81 |
+
- With the right option missing, the support floor missed its target of at most 1 wrong accept per 500, with 2.
|
| 82 |
+
- BANKING77 certifies zero at the 99% bar, including after a model audit of its calibration labels.
|
| 83 |
+
- With no examples on BANKING77 this model does not lead: a published typed decision model scores higher.
|
| 84 |
+
- With thousands of labels, a logistic head on retrieval vectors beats the reader.
|
| 85 |
+
- Written training rows come from one model and carry its style.
|
| 86 |
+
- Benchmark numbers are not a promise about a new business or future traffic.
|
| 87 |
+
|
| 88 |
+
## Training data
|
| 89 |
+
|
| 90 |
+
Excluded: all MTOP and BANKING77 texts, calibration rows, test rows, real customer text, rows traced to
|
| 91 |
+
real posts, ATIS and a FEVER mirror (no licence found). No output of a hosted Meta Model API trained this model.
|
| 92 |
+
|
| 93 |
+
| Source | Licence |
|
| 94 |
+
| --- | --- |
|
| 95 |
+
| Ettin encoder 400M (base weights) | MIT |
|
| 96 |
+
| TOPv2 | CC BY-SA 4.0 |
|
| 97 |
+
| CLINC150 | CC BY 3.0 |
|
| 98 |
+
| MASSIVE (English) | CC BY 4.0 |
|
| 99 |
+
| Snips | Apache 2.0 |
|
| 100 |
+
| GoEmotions | Apache 2.0 |
|
| 101 |
+
| Bitext customer support | CDLA-Sharing 1.0 |
|
| 102 |
+
| DBpedia-14 | CC BY-SA 3.0 |
|
| 103 |
+
| Civil Comments | CC0 |
|
| 104 |
+
| PAWS, Google LLC | Free use, with attribution |
|
| 105 |
+
| SMS Spam (UCI) | CC BY 4.0 |
|
| 106 |
+
| SQuAD | CC BY-SA 4.0 |
|
| 107 |
+
| WANLI | CC BY 4.0 |
|
| 108 |
+
| Written Meta-app tasks and 23 taxonomies | Written and labelled with Muse Spark Open |
|