File size: 3,663 Bytes
8b95f03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
66
67
68
69
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
96
97
98
99
100
101
102
---
library_name: transformers
pipeline_tag: text-classification
tags:
  - modernbert
  - prompt-injection
  - jailbreak-detection
  - ai-safety
  - guardrails
  - bfsi
---

# Aval (Semalith)

Aval is a dual-head text classifier for screening inputs to LLM applications. For each message it predicts:

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.
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.

## Model details

| | |
|---|---|
| Architecture | `SemalithDualHead`: a ModernBERT encoder with two classification heads |
| Encoder | 22 layers, hidden size 768, 12 attention heads |
| Attention | Alternating global and sliding-window attention (window 128), with global attention every 3rd layer |
| Max sequence length | 8,192 tokens |
| Vocabulary | 256,000 tokens |
| Pooling | Mean |
| Weights | `float32`, safetensors |
| Taxonomy version | 3.1.0 |

## Labels

### Risk head (20 classes)

| ID | Label | Group |
|---|---|---|
| 0 | `BENIGN` | BENIGN |
| 1 | `D1_SYSTEM_OVERRIDE` | D_ATTACK |
| 2 | `D1_JAILBREAK` | D_ATTACK |
| 3 | `D1_EXTRACTION` | D_ATTACK |
| 4 | `D1_SOCIAL_ENGINEERING` | D_ATTACK |
| 5 | `D1_AUTHORITY_CLAIM` | D_ATTACK |
| 6 | `D1_NARRATIVE_FRAME` | D_ATTACK |
| 7 | `D5_EVASION` | D_ATTACK |
| 8 | `D6_AGENTIC_INJECTION` | D_ATTACK |
| 9 | `D7_INDIRECT_INJECTION` | D_ATTACK |
| 10 | `D8_GENERAL_HARM` | D_HARM |
| 11–18 | `B-01` … `B-08` | BFSI_ATTACK |
| 19 | `D2_COPYRIGHT` | D_HARM |

Every label except `BENIGN` is treated as a threat. The four groups are `BENIGN`, `D_ATTACK`, `D_HARM` and `BFSI_ATTACK`.

When a message matches more than one threat label, the label that comes first in this order is reported:

`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`

### Intent head (12 classes)

| ID | Label |
|---|---|
| 0 | `NONE` |
| 1 | `I_BALANCE_ENQUIRY` |
| 2 | `I_CARD_SERVICING` |
| 3 | `I_TRANSFERS_PAYMENTS` |
| 4 | `I_LOAN_MORTGAGE` |
| 5 | `I_INSURANCE` |
| 6 | `I_WEALTH_INVESTMENT` |
| 7 | `I_KYC_ONBOARDING` |
| 8 | `I_COMPLAINT_DISPUTE` |
| 9 | `I_GREETING_SMALLTALK` |
| 10 | `I_AGENT_HANDOFF` |
| 11 | `I_OTHER` |

The complete mappings, including the threat flags and groups, are in `label_map.json`.

## Files

| File | Contents |
|---|---|
| `model.safetensors` | Model weights |
| `config.json` | Encoder configuration and risk-label mapping |
| `label_map.json` | Risk, intent and group label mappings, plus the precedence order |
| `tokenizer.json`, `tokenizer_config.json` | Tokenizer |

## Usage

`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:

```python
from transformers import AutoTokenizer
from safetensors.torch import load_file

tokenizer = AutoTokenizer.from_pretrained("zytra/aval")
state_dict = load_file("model.safetensors")  # load into SemalithDualHead
```

## Intended use

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.