Praveen-Bh commited on
Commit
8b95f03
·
verified ·
1 Parent(s): 25afa16

Upload Aval (Semalith) model weights, tokenizer, and model card

Browse files
Files changed (7) hide show
  1. .gitattributes +1 -0
  2. README.md +101 -0
  3. config.json +125 -0
  4. label_map.json +158 -0
  5. model.safetensors +3 -0
  6. tokenizer.json +3 -0
  7. tokenizer_config.json +25 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ pipeline_tag: text-classification
4
+ tags:
5
+ - modernbert
6
+ - prompt-injection
7
+ - jailbreak-detection
8
+ - ai-safety
9
+ - guardrails
10
+ - bfsi
11
+ ---
12
+
13
+ # Aval (Semalith)
14
+
15
+ Aval is a dual-head text classifier for screening inputs to LLM applications. For each message it predicts:
16
+
17
+ 1. **Risk**: whether the text is benign or matches a threat category, such as prompt injection, jailbreak, data extraction, social engineering, harmful content or a BFSI-specific attack.
18
+ 2. **Intent**: what a benign user in a banking or financial services (BFSI) setting is asking for, such as checking a balance, card servicing or loans.
19
+
20
+ ## Model details
21
+
22
+ | | |
23
+ |---|---|
24
+ | Architecture | `SemalithDualHead`: a ModernBERT encoder with two classification heads |
25
+ | Encoder | 22 layers, hidden size 768, 12 attention heads |
26
+ | Attention | Alternating global and sliding-window attention (window 128), with global attention every 3rd layer |
27
+ | Max sequence length | 8,192 tokens |
28
+ | Vocabulary | 256,000 tokens |
29
+ | Pooling | Mean |
30
+ | Weights | `float32`, safetensors |
31
+ | Taxonomy version | 3.1.0 |
32
+
33
+ ## Labels
34
+
35
+ ### Risk head (20 classes)
36
+
37
+ | ID | Label | Group |
38
+ |---|---|---|
39
+ | 0 | `BENIGN` | BENIGN |
40
+ | 1 | `D1_SYSTEM_OVERRIDE` | D_ATTACK |
41
+ | 2 | `D1_JAILBREAK` | D_ATTACK |
42
+ | 3 | `D1_EXTRACTION` | D_ATTACK |
43
+ | 4 | `D1_SOCIAL_ENGINEERING` | D_ATTACK |
44
+ | 5 | `D1_AUTHORITY_CLAIM` | D_ATTACK |
45
+ | 6 | `D1_NARRATIVE_FRAME` | D_ATTACK |
46
+ | 7 | `D5_EVASION` | D_ATTACK |
47
+ | 8 | `D6_AGENTIC_INJECTION` | D_ATTACK |
48
+ | 9 | `D7_INDIRECT_INJECTION` | D_ATTACK |
49
+ | 10 | `D8_GENERAL_HARM` | D_HARM |
50
+ | 11–18 | `B-01` … `B-08` | BFSI_ATTACK |
51
+ | 19 | `D2_COPYRIGHT` | D_HARM |
52
+
53
+ Every label except `BENIGN` is treated as a threat. The four groups are `BENIGN`, `D_ATTACK`, `D_HARM` and `BFSI_ATTACK`.
54
+
55
+ When a message matches more than one threat label, the label that comes first in this order is reported:
56
+
57
+ `D7_INDIRECT_INJECTION` → `D6_AGENTIC_INJECTION` → `D5_EVASION` → `D1_SYSTEM_OVERRIDE` → `D1_JAILBREAK` → `D1_NARRATIVE_FRAME` → `D1_AUTHORITY_CLAIM` → `D1_SOCIAL_ENGINEERING` → `D1_EXTRACTION` → `B-01` … `B-08` → `D8_GENERAL_HARM` → `D2_COPYRIGHT`
58
+
59
+ ### Intent head (12 classes)
60
+
61
+ | ID | Label |
62
+ |---|---|
63
+ | 0 | `NONE` |
64
+ | 1 | `I_BALANCE_ENQUIRY` |
65
+ | 2 | `I_CARD_SERVICING` |
66
+ | 3 | `I_TRANSFERS_PAYMENTS` |
67
+ | 4 | `I_LOAN_MORTGAGE` |
68
+ | 5 | `I_INSURANCE` |
69
+ | 6 | `I_WEALTH_INVESTMENT` |
70
+ | 7 | `I_KYC_ONBOARDING` |
71
+ | 8 | `I_COMPLAINT_DISPUTE` |
72
+ | 9 | `I_GREETING_SMALLTALK` |
73
+ | 10 | `I_AGENT_HANDOFF` |
74
+ | 11 | `I_OTHER` |
75
+
76
+ The complete mappings, including the threat flags and groups, are in `label_map.json`.
77
+
78
+ ## Files
79
+
80
+ | File | Contents |
81
+ |---|---|
82
+ | `model.safetensors` | Model weights |
83
+ | `config.json` | Encoder configuration and risk-label mapping |
84
+ | `label_map.json` | Risk, intent and group label mappings, plus the precedence order |
85
+ | `tokenizer.json`, `tokenizer_config.json` | Tokenizer |
86
+
87
+ ## Usage
88
+
89
+ `SemalithDualHead` is a custom architecture, so `AutoModelForSequenceClassification` cannot load both heads directly. Load the tokenizer with `transformers`, and load the weights with the `SemalithDualHead` model class from the Semalith codebase:
90
+
91
+ ```python
92
+ from transformers import AutoTokenizer
93
+ from safetensors.torch import load_file
94
+
95
+ tokenizer = AutoTokenizer.from_pretrained("zytra/aval")
96
+ state_dict = load_file("model.safetensors") # load into SemalithDualHead
97
+ ```
98
+
99
+ ## Intended use
100
+
101
+ Aval is meant to be one layer in a guardrail or AI-governance pipeline. It flags risky inputs and routes benign BFSI requests. Don't use it as the only safety control: review its decisions for your own domain and pair it with other safeguards.
config.json ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "SemalithDualHead"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 2,
8
+ "classifier_activation": "gelu",
9
+ "classifier_bias": false,
10
+ "classifier_dropout": 0.0,
11
+ "classifier_pooling": "mean",
12
+ "cls_token_id": 1,
13
+ "decoder_bias": true,
14
+ "deterministic_flash_attn": false,
15
+ "dtype": "float32",
16
+ "embedding_dropout": 0.0,
17
+ "eos_token_id": 1,
18
+ "global_attn_every_n_layers": 3,
19
+ "gradient_checkpointing": false,
20
+ "hidden_activation": "gelu",
21
+ "hidden_size": 768,
22
+ "id2label": {
23
+ "0": "BENIGN",
24
+ "1": "D1_SYSTEM_OVERRIDE",
25
+ "2": "D1_JAILBREAK",
26
+ "3": "D1_EXTRACTION",
27
+ "4": "D1_SOCIAL_ENGINEERING",
28
+ "5": "D1_AUTHORITY_CLAIM",
29
+ "6": "D1_NARRATIVE_FRAME",
30
+ "7": "D5_EVASION",
31
+ "8": "D6_AGENTIC_INJECTION",
32
+ "9": "D7_INDIRECT_INJECTION",
33
+ "10": "D8_GENERAL_HARM",
34
+ "11": "B-01",
35
+ "12": "B-02",
36
+ "13": "B-03",
37
+ "14": "B-04",
38
+ "15": "B-05",
39
+ "16": "B-06",
40
+ "17": "B-07",
41
+ "18": "B-08",
42
+ "19": "D2_COPYRIGHT"
43
+ },
44
+ "initializer_cutoff_factor": 2.0,
45
+ "initializer_range": 0.02,
46
+ "intermediate_size": 1152,
47
+ "label2id": {
48
+ "B-01": 11,
49
+ "B-02": 12,
50
+ "B-03": 13,
51
+ "B-04": 14,
52
+ "B-05": 15,
53
+ "B-06": 16,
54
+ "B-07": 17,
55
+ "B-08": 18,
56
+ "BENIGN": 0,
57
+ "D1_AUTHORITY_CLAIM": 5,
58
+ "D1_EXTRACTION": 3,
59
+ "D1_JAILBREAK": 2,
60
+ "D1_NARRATIVE_FRAME": 6,
61
+ "D1_SOCIAL_ENGINEERING": 4,
62
+ "D1_SYSTEM_OVERRIDE": 1,
63
+ "D2_COPYRIGHT": 19,
64
+ "D5_EVASION": 7,
65
+ "D6_AGENTIC_INJECTION": 8,
66
+ "D7_INDIRECT_INJECTION": 9,
67
+ "D8_GENERAL_HARM": 10
68
+ },
69
+ "layer_norm_eps": 1e-05,
70
+ "layer_types": [
71
+ "full_attention",
72
+ "sliding_attention",
73
+ "sliding_attention",
74
+ "full_attention",
75
+ "sliding_attention",
76
+ "sliding_attention",
77
+ "full_attention",
78
+ "sliding_attention",
79
+ "sliding_attention",
80
+ "full_attention",
81
+ "sliding_attention",
82
+ "sliding_attention",
83
+ "full_attention",
84
+ "sliding_attention",
85
+ "sliding_attention",
86
+ "full_attention",
87
+ "sliding_attention",
88
+ "sliding_attention",
89
+ "full_attention",
90
+ "sliding_attention",
91
+ "sliding_attention",
92
+ "full_attention"
93
+ ],
94
+ "local_attention": 128,
95
+ "mask_token_id": 4,
96
+ "max_position_embeddings": 8192,
97
+ "mlp_bias": false,
98
+ "mlp_dropout": 0.0,
99
+ "model_type": "modernbert",
100
+ "norm_bias": false,
101
+ "norm_eps": 1e-05,
102
+ "num_attention_heads": 12,
103
+ "num_hidden_layers": 22,
104
+ "pad_token_id": 0,
105
+ "position_embedding_type": "sans_pos",
106
+ "rope_parameters": {
107
+ "full_attention": {
108
+ "rope_theta": 160000,
109
+ "rope_type": "default"
110
+ },
111
+ "sliding_attention": {
112
+ "rope_theta": 160000,
113
+ "rope_type": "default"
114
+ }
115
+ },
116
+ "semalith_num_intent": 12,
117
+ "semalith_taxonomy_version": "3.1.0",
118
+ "sep_token_id": 1,
119
+ "sparse_pred_ignore_index": -100,
120
+ "sparse_prediction": false,
121
+ "tie_word_embeddings": true,
122
+ "transformers_version": "5.14.1",
123
+ "use_cache": false,
124
+ "vocab_size": 256000
125
+ }
label_map.json ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "taxonomy_version": "3.1.0",
3
+ "risk": {
4
+ "id2label": {
5
+ "0": "BENIGN",
6
+ "1": "D1_SYSTEM_OVERRIDE",
7
+ "2": "D1_JAILBREAK",
8
+ "3": "D1_EXTRACTION",
9
+ "4": "D1_SOCIAL_ENGINEERING",
10
+ "5": "D1_AUTHORITY_CLAIM",
11
+ "6": "D1_NARRATIVE_FRAME",
12
+ "7": "D5_EVASION",
13
+ "8": "D6_AGENTIC_INJECTION",
14
+ "9": "D7_INDIRECT_INJECTION",
15
+ "10": "D8_GENERAL_HARM",
16
+ "11": "B-01",
17
+ "12": "B-02",
18
+ "13": "B-03",
19
+ "14": "B-04",
20
+ "15": "B-05",
21
+ "16": "B-06",
22
+ "17": "B-07",
23
+ "18": "B-08",
24
+ "19": "D2_COPYRIGHT"
25
+ },
26
+ "label2id": {
27
+ "BENIGN": 0,
28
+ "D1_SYSTEM_OVERRIDE": 1,
29
+ "D1_JAILBREAK": 2,
30
+ "D1_EXTRACTION": 3,
31
+ "D1_SOCIAL_ENGINEERING": 4,
32
+ "D1_AUTHORITY_CLAIM": 5,
33
+ "D1_NARRATIVE_FRAME": 6,
34
+ "D5_EVASION": 7,
35
+ "D6_AGENTIC_INJECTION": 8,
36
+ "D7_INDIRECT_INJECTION": 9,
37
+ "D8_GENERAL_HARM": 10,
38
+ "B-01": 11,
39
+ "B-02": 12,
40
+ "B-03": 13,
41
+ "B-04": 14,
42
+ "B-05": 15,
43
+ "B-06": 16,
44
+ "B-07": 17,
45
+ "B-08": 18,
46
+ "D2_COPYRIGHT": 19
47
+ },
48
+ "is_threat": {
49
+ "BENIGN": false,
50
+ "D1_SYSTEM_OVERRIDE": true,
51
+ "D1_JAILBREAK": true,
52
+ "D1_EXTRACTION": true,
53
+ "D1_SOCIAL_ENGINEERING": true,
54
+ "D1_AUTHORITY_CLAIM": true,
55
+ "D1_NARRATIVE_FRAME": true,
56
+ "D5_EVASION": true,
57
+ "D6_AGENTIC_INJECTION": true,
58
+ "D7_INDIRECT_INJECTION": true,
59
+ "D8_GENERAL_HARM": true,
60
+ "B-01": true,
61
+ "B-02": true,
62
+ "B-03": true,
63
+ "B-04": true,
64
+ "B-05": true,
65
+ "B-06": true,
66
+ "B-07": true,
67
+ "B-08": true,
68
+ "D2_COPYRIGHT": true
69
+ },
70
+ "super": {
71
+ "BENIGN": "BENIGN",
72
+ "D1_SYSTEM_OVERRIDE": "D_ATTACK",
73
+ "D1_JAILBREAK": "D_ATTACK",
74
+ "D1_EXTRACTION": "D_ATTACK",
75
+ "D1_SOCIAL_ENGINEERING": "D_ATTACK",
76
+ "D1_AUTHORITY_CLAIM": "D_ATTACK",
77
+ "D1_NARRATIVE_FRAME": "D_ATTACK",
78
+ "D5_EVASION": "D_ATTACK",
79
+ "D6_AGENTIC_INJECTION": "D_ATTACK",
80
+ "D7_INDIRECT_INJECTION": "D_ATTACK",
81
+ "D8_GENERAL_HARM": "D_HARM",
82
+ "B-01": "BFSI_ATTACK",
83
+ "B-02": "BFSI_ATTACK",
84
+ "B-03": "BFSI_ATTACK",
85
+ "B-04": "BFSI_ATTACK",
86
+ "B-05": "BFSI_ATTACK",
87
+ "B-06": "BFSI_ATTACK",
88
+ "B-07": "BFSI_ATTACK",
89
+ "B-08": "BFSI_ATTACK",
90
+ "D2_COPYRIGHT": "D_HARM"
91
+ }
92
+ },
93
+ "intent": {
94
+ "id2label": {
95
+ "0": "NONE",
96
+ "1": "I_BALANCE_ENQUIRY",
97
+ "2": "I_CARD_SERVICING",
98
+ "3": "I_TRANSFERS_PAYMENTS",
99
+ "4": "I_LOAN_MORTGAGE",
100
+ "5": "I_INSURANCE",
101
+ "6": "I_WEALTH_INVESTMENT",
102
+ "7": "I_KYC_ONBOARDING",
103
+ "8": "I_COMPLAINT_DISPUTE",
104
+ "9": "I_GREETING_SMALLTALK",
105
+ "10": "I_AGENT_HANDOFF",
106
+ "11": "I_OTHER"
107
+ },
108
+ "label2id": {
109
+ "NONE": 0,
110
+ "I_BALANCE_ENQUIRY": 1,
111
+ "I_CARD_SERVICING": 2,
112
+ "I_TRANSFERS_PAYMENTS": 3,
113
+ "I_LOAN_MORTGAGE": 4,
114
+ "I_INSURANCE": 5,
115
+ "I_WEALTH_INVESTMENT": 6,
116
+ "I_KYC_ONBOARDING": 7,
117
+ "I_COMPLAINT_DISPUTE": 8,
118
+ "I_GREETING_SMALLTALK": 9,
119
+ "I_AGENT_HANDOFF": 10,
120
+ "I_OTHER": 11
121
+ }
122
+ },
123
+ "super": {
124
+ "id2label": {
125
+ "0": "BENIGN",
126
+ "1": "D_ATTACK",
127
+ "2": "D_HARM",
128
+ "3": "BFSI_ATTACK"
129
+ }
130
+ },
131
+ "aliases": {
132
+ "B-09": "I_GREETING_SMALLTALK",
133
+ "B-10": null,
134
+ "B-11": null
135
+ },
136
+ "mask_label_id": -100,
137
+ "precedence": [
138
+ "D7_INDIRECT_INJECTION",
139
+ "D6_AGENTIC_INJECTION",
140
+ "D5_EVASION",
141
+ "D1_SYSTEM_OVERRIDE",
142
+ "D1_JAILBREAK",
143
+ "D1_NARRATIVE_FRAME",
144
+ "D1_AUTHORITY_CLAIM",
145
+ "D1_SOCIAL_ENGINEERING",
146
+ "D1_EXTRACTION",
147
+ "B-01",
148
+ "B-02",
149
+ "B-03",
150
+ "B-04",
151
+ "B-05",
152
+ "B-06",
153
+ "B-07",
154
+ "B-08",
155
+ "D8_GENERAL_HARM",
156
+ "D2_COPYRIGHT"
157
+ ]
158
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b783ec6bfc9b10650edc1a3d38773142d2d482d5a432bf4e659ee45a624564b9
3
+ size 1227871344
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f34b44a6dc8a0eef651bfa10e8325057530152606a69d9c3b6ae02efb1558f0a
3
+ size 34363286
tokenizer_config.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "bos_token": "<bos>",
4
+ "clean_up_tokenization_spaces": false,
5
+ "cls_token": "<bos>",
6
+ "eos_token": "<eos>",
7
+ "extra_special_tokens": [
8
+ "<start_of_turn>",
9
+ "<end_of_turn>"
10
+ ],
11
+ "is_local": true,
12
+ "local_files_only": false,
13
+ "mask_token": "<mask>",
14
+ "model_input_names": [
15
+ "input_ids",
16
+ "attention_mask"
17
+ ],
18
+ "model_max_length": 8192,
19
+ "pad_token": "<pad>",
20
+ "padding_side": "right",
21
+ "sep_token": "<eos>",
22
+ "spaces_between_special_tokens": false,
23
+ "tokenizer_class": "TokenizersBackend",
24
+ "unk_token": "<unk>"
25
+ }