Rishh00 commited on
Commit
3f16718
·
verified ·
1 Parent(s): 51bd9b0

Publish the TOPv2-tuned MiniLM encoder for Ren

Browse files
1_Pooling/config.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "embedding_dimension": 384,
3
+ "pooling_mode": "mean",
4
+ "include_prompt": true
5
+ }
README.md ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-sa-4.0
3
+ language:
4
+ - en
5
+ library_name: sentence-transformers
6
+ pipeline_tag: sentence-similarity
7
+ base_model: sentence-transformers/all-MiniLM-L6-v2
8
+ tags:
9
+ - sentence-transformers
10
+ - intent-classification
11
+ - calibration
12
+ - selective-prediction
13
+ ---
14
+
15
+ # Secnd Ren encoder (MiniLM tuned on TOPv2)
16
+
17
+ The sentence encoder behind **Ren** (`secnd-ren-1`), Secnd's decision model. Ren learns one organisation's own past decisions with a small logistic-regression head on top of this encoder, and answers on its own only where a calibrated gate can prove 99% precision; everything else goes to a person.
18
+
19
+ This encoder is [all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) tuned once on Meta's TOPv2 assistant requests with a supervised contrastive loss. It has the same size and CPU cost as the base model (384 dimensions, 22.7M parameters).
20
+
21
+ ## Training
22
+
23
+ - **Data:** TOPv2 (Chen et al., 2020), English task-oriented requests in 8 domains, CC BY-SA 4.0. Label = the top-level intent of each parse (69 intents).
24
+ - **No MTOP rows seen:** every TOPv2 request whose normalised text appears anywhere in MTOP was removed first (23,137 rows), leaving 157,405. MTOP results below therefore use only the labels inside each budget.
25
+ - **Objective:** 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.
26
+
27
+ ## Results (MTOP English, held-out test)
28
+
29
+ Ren with this encoder, 2,000 training labels, fixed calibration and test splits:
30
+
31
+ | Encoder | Answered automatically | Precision there | Accuracy | 99% claim holds across 2,000 re-splits |
32
+ |---|---|---|---|---|
33
+ | all-MiniLM-L6-v2 | 31.7% | 99.62% | 86.2% | 99.05% |
34
+ | **this encoder** | **42.4%** | **99.93%** | **88.1%** | **99.45%** |
35
+
36
+ In a simulated learning loop on MTOP (200 seed labels, then 20 rounds of 100 answers, 5 seeds), the share answered automatically at round 20 rose from 19.2% to 33.9%, with test precision at least 99.24% in every round that answered automatically.
37
+
38
+ Measurements and the code that produced them: [github.com/Rish-it/secnd](https://github.com/Rish-it/secnd) (`docs/results/s3/card-mtop-pt-minilm+lr-b2000.json`, `docs/results/s3/robustness-mtop-pt-minilm+lr-b2000.json`, `docs/results/s4/`).
39
+
40
+ ## Use
41
+
42
+ ```python
43
+ from sentence_transformers import SentenceTransformer
44
+
45
+ model = SentenceTransformer("Rishh00/secnd-ren-encoder")
46
+ vectors = model.encode(["set an alarm for 7am", "what's the weather tomorrow"], normalize_embeddings=True)
47
+ ```
48
+
49
+ ## Limits
50
+
51
+ - English only. Tuned on assistant-style requests; other domains may gain less (or nothing).
52
+ - The 99% figure is a property of Ren's calibrated gate on a fixed, published split, not of this encoder alone, and not a guarantee on arbitrary future traffic.
53
+
54
+ ## Licence and citation
55
+
56
+ Released under CC BY-SA 4.0 because it is trained on TOPv2 (CC BY-SA 4.0). The base model is Apache-2.0.
57
+
58
+ ```bibtex
59
+ @inproceedings{chen-etal-2020-low,
60
+ title = {Low-Resource Domain Adaptation for Compositional Task-Oriented Semantic Parsing},
61
+ author = {Chen, Xilun and Ghoshal, Asish and Mehdad, Yashar and Zettlemoyer, Luke and Gupta, Sonal},
62
+ booktitle = {Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)},
63
+ year = {2020}
64
+ }
65
+ ```
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.21.0",
27
+ "type_vocab_size": 2,
28
+ "use_cache": true,
29
+ "vocab_size": 30522
30
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "pytorch": "2.15.0+cu132",
4
+ "sentence_transformers": "5.7.0",
5
+ "transformers": "5.21.0"
6
+ },
7
+ "default_prompt_name": null,
8
+ "model_type": "SentenceTransformer",
9
+ "prompts": {
10
+ "document": "",
11
+ "query": ""
12
+ },
13
+ "similarity_fn_name": "cosine"
14
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f76f276dc59040cf7c3fe1ac74d884b70fed3c60fe2eaa3738adb1f7ae35c089
3
+ size 90864192
modules.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": "",
6
+ "type": "sentence_transformers.base.modules.transformer.Transformer"
7
+ },
8
+ {
9
+ "idx": 1,
10
+ "name": "1",
11
+ "path": "1_Pooling",
12
+ "type": "sentence_transformers.sentence_transformer.modules.pooling.Pooling"
13
+ },
14
+ {
15
+ "idx": 2,
16
+ "name": "2",
17
+ "path": "2_Normalize",
18
+ "type": "sentence_transformers.sentence_transformer.modules.normalize.Normalize"
19
+ }
20
+ ]
sentence_bert_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "transformer_task": "feature-extraction",
3
+ "modality_config": {
4
+ "text": {
5
+ "method": "forward",
6
+ "method_output_name": "last_hidden_state"
7
+ }
8
+ },
9
+ "module_output_name": "token_embeddings"
10
+ }
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": 256,
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
+ }