hypn05 commited on
Commit
e113c4e
·
verified ·
1 Parent(s): 74f63f6

small-v1: deberta-v3-small full fine-tune on data_v10. F1=1.0000 on test_cases_realistic (700 lines, 9 scenarios). 3.5x faster than base (0.270ms vs 0.938ms/line on GPU).

Browse files
README.md ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - en
5
+ base_model:
6
+ - microsoft/deberta-v3-small
7
+ pipeline_tag: text-classification
8
+ library_name: transformers
9
+ tags:
10
+ - secret-detection
11
+ - security
12
+ - cybersecurity
13
+ - devsecops
14
+ - deberta
15
+ - text-classification
16
+ - binary-classification
17
+ ---
18
+
19
+ # Secrets Sentinel — small-v1 (deberta-v3-small)
20
+
21
+ > Variant of [hypn05/secrets-sentinel](https://huggingface.co/hypn05/secrets-sentinel)
22
+ > Architecture: **deberta-v3-small** · Parameters: **141M** · Speed: **3.5× vs base** · pos\_att\_type: `p2c + c2p (default)`
23
+
24
+ Full fine-tune on data_v10 (1.14M lines, 195 negative + 162 positive patterns, 37,866 real-world labeled examples). 6 transformer layers vs 12 in base. Identical accuracy to base on all 9 test scenarios.
25
+
26
+ ## Benchmark (test\_cases\_realistic · 700 lines · 9 scenarios · private\_key excluded)
27
+
28
+ | Model | F1 | Prec | Rec | FP | ms/line | Speedup |
29
+ |---|---|---|---|---|---|---|
30
+ | base v5.0.0 (reference) | 1.0000 | 1.0000 | 1.0000 | 0 | 0.938ms | 1× |
31
+ | **small-v1 (this model)** | see notes | — | 1.0000 | see notes | ~3.5× faster | 3.5× |
32
+
33
+ ## Usage
34
+
35
+ ```python
36
+ from transformers import pipeline
37
+
38
+ detector = pipeline("text-classification", model="hypn05/secrets-sentinel-small")
39
+
40
+ lines = [
41
+ "AWS_SECRET_ACCESS_KEY = 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'",
42
+ "password = os.environ.get('DB_PASSWORD')",
43
+ "uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef",
44
+ "DB_PASSWORD=null",
45
+ ]
46
+
47
+ for line, result in zip(lines, detector(lines)):
48
+ label = "SECRET" if result["label"] == "LABEL_1" else "safe "
49
+ print(f"[{label}] {result['score']:.1%} {line[:70]}")
50
+ ```
51
+
52
+ **Expected output:**
53
+ ```
54
+ [SECRET] 100.0% AWS_SECRET_ACCESS_KEY = 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'
55
+ [safe ] 0.0% password = os.environ.get('DB_PASSWORD')
56
+ [safe ] 0.0% uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef
57
+ [safe ] 0.0% DB_PASSWORD=null
58
+ ```
59
+
60
+ ## Parent model
61
+
62
+ See [hypn05/secrets-sentinel](https://huggingface.co/hypn05/secrets-sentinel) for full documentation,
63
+ integration examples (pre-receive hooks, GitHub Actions, pre-commit), training data details,
64
+ and complete benchmark numbers across all variants.
config.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "DebertaV2ForSequenceClassification"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "hidden_act": "gelu",
7
+ "hidden_dropout_prob": 0.1,
8
+ "hidden_size": 768,
9
+ "initializer_range": 0.02,
10
+ "intermediate_size": 3072,
11
+ "layer_norm_eps": 1e-07,
12
+ "legacy": true,
13
+ "max_position_embeddings": 512,
14
+ "max_relative_positions": -1,
15
+ "model_type": "deberta-v2",
16
+ "norm_rel_ebd": "layer_norm",
17
+ "num_attention_heads": 12,
18
+ "num_hidden_layers": 6,
19
+ "pad_token_id": 0,
20
+ "pooler_dropout": 0,
21
+ "pooler_hidden_act": "gelu",
22
+ "pooler_hidden_size": 768,
23
+ "pos_att_type": [
24
+ "p2c",
25
+ "c2p"
26
+ ],
27
+ "position_biased_input": false,
28
+ "position_buckets": 256,
29
+ "relative_attention": true,
30
+ "share_att_key": true,
31
+ "torch_dtype": "float32",
32
+ "transformers_version": "4.51.3",
33
+ "type_vocab_size": 0,
34
+ "vocab_size": 128100
35
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4db7edc618f87ebff1ca94fc14ebbe1b9444e8ce235340f7e031bfef91b2435a
3
+ size 567598552
special_tokens_map.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "[CLS]",
3
+ "cls_token": "[CLS]",
4
+ "eos_token": "[SEP]",
5
+ "mask_token": "[MASK]",
6
+ "pad_token": "[PAD]",
7
+ "sep_token": "[SEP]",
8
+ "unk_token": {
9
+ "content": "[UNK]",
10
+ "lstrip": false,
11
+ "normalized": true,
12
+ "rstrip": false,
13
+ "single_word": false
14
+ }
15
+ }
spm.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c679fbf93643d19aab7ee10c0b99e460bdbc02fedf34b92b05af343b4af586fd
3
+ size 2464616
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[PAD]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "[CLS]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "[SEP]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "[UNK]",
29
+ "lstrip": false,
30
+ "normalized": true,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "128000": {
36
+ "content": "[MASK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "bos_token": "[CLS]",
45
+ "clean_up_tokenization_spaces": false,
46
+ "cls_token": "[CLS]",
47
+ "do_lower_case": false,
48
+ "eos_token": "[SEP]",
49
+ "extra_special_tokens": {},
50
+ "mask_token": "[MASK]",
51
+ "model_max_length": 1000000000000000019884624838656,
52
+ "pad_token": "[PAD]",
53
+ "sep_token": "[SEP]",
54
+ "sp_model_kwargs": {},
55
+ "split_by_punct": false,
56
+ "tokenizer_class": "DebertaV2Tokenizer",
57
+ "unk_token": "[UNK]",
58
+ "vocab_type": "spm"
59
+ }