Upload 9 files
Browse files- README.md +46 -3
- checkpoints/last.pt +3 -0
- config.json +33 -0
- generation_config.json +9 -0
- model.safetensors +3 -0
- special_tokens_map.json +7 -0
- tokenizer_config.json +18 -0
- training_config.json +45 -0
- training_history.json +0 -0
README.md
CHANGED
|
@@ -1,3 +1,46 @@
|
|
| 1 |
-
-
|
| 2 |
-
|
| 3 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Quantum-Guard
|
| 2 |
+
|
| 3 |
+
Production safe/unsafe text classifier based on the original exact 1,000,000-parameter Quantum architecture.
|
| 4 |
+
|
| 5 |
+
## Architecture
|
| 6 |
+
|
| 7 |
+
- Model: Quantum-Guard
|
| 8 |
+
- Trainable parameters: 1,000,000
|
| 9 |
+
- Context length: 128
|
| 10 |
+
- Embedding table: 4096
|
| 11 |
+
- Hidden size: 112
|
| 12 |
+
- Attention heads: 7
|
| 13 |
+
- Transformer blocks: 4
|
| 14 |
+
- FFN size: 336
|
| 15 |
+
- Classifier hidden size: 170
|
| 16 |
+
|
| 17 |
+
## Tokenizer
|
| 18 |
+
|
| 19 |
+
Official pretrained tokenizer semantics: `google/byt5-small` (ByT5).
|
| 20 |
+
|
| 21 |
+
The training path uses the exact raw UTF-8 byte mapping directly for speed:
|
| 22 |
+
byte value `b` maps to token id `b + 3`. Quantum-Guard adds two model-specific markers (`<cls>` and `<sep>`) inside the original 4096-row embedding table.
|
| 23 |
+
|
| 24 |
+
## Training datasets
|
| 25 |
+
|
| 26 |
+
- `SetFit/enron_spam`
|
| 27 |
+
- `ucirvine/sms_spam`
|
| 28 |
+
- `deepset/prompt-injections`
|
| 29 |
+
- `Nebulixlabs/safety-dataset`
|
| 30 |
+
- `0x7o/spam_detector`
|
| 31 |
+
- `SetFit/toxic_conversations`
|
| 32 |
+
- `xTRam1/safe-guard-prompt-injection`
|
| 33 |
+
- `pankajbiswas6/prism-hinglish-hate-speech`
|
| 34 |
+
|
| 35 |
+
Training target: 200,000,000 non-padding tokens
|
| 36 |
+
Actual consumed tokens: 200,013,589
|
| 37 |
+
Batch size: 128
|
| 38 |
+
Context length: 128
|
| 39 |
+
|
| 40 |
+
## Validation
|
| 41 |
+
|
| 42 |
+
Official validation/test splits are used when present. A bounded fallback is used only when a dataset exposes no held-out split.
|
| 43 |
+
|
| 44 |
+
## Resume
|
| 45 |
+
|
| 46 |
+
The run writes `/content/Quantum-Guard/checkpoints/last.pt` periodically and at each epoch boundary so a Colab interruption can be resumed without restarting training from zero.
|
checkpoints/last.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7cee649b131f4833603e0ed65222814164f8b163112f020967d30073c719c9dc
|
| 3 |
+
size 12154061
|
config.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "quantum-guard",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"QuantumClasifier"
|
| 5 |
+
],
|
| 6 |
+
"model_name": "Quantum-Guard",
|
| 7 |
+
"vocab_size": 4096,
|
| 8 |
+
"base_tokenizer_vocab_size": 384,
|
| 9 |
+
"max_position_embeddings": 128,
|
| 10 |
+
"context_length": 128,
|
| 11 |
+
"hidden_size": 112,
|
| 12 |
+
"num_hidden_layers": 4,
|
| 13 |
+
"num_attention_heads": 7,
|
| 14 |
+
"intermediate_size": 336,
|
| 15 |
+
"classifier_hidden_size": 170,
|
| 16 |
+
"hidden_dropout_prob": 0.1,
|
| 17 |
+
"attention_probs_dropout_prob": 0.1,
|
| 18 |
+
"num_labels": 2,
|
| 19 |
+
"id2label": {
|
| 20 |
+
"0": "safe",
|
| 21 |
+
"1": "unsafe"
|
| 22 |
+
},
|
| 23 |
+
"label2id": {
|
| 24 |
+
"safe": 0,
|
| 25 |
+
"unsafe": 1
|
| 26 |
+
},
|
| 27 |
+
"pad_token_id": 0,
|
| 28 |
+
"bos_token_id": 384,
|
| 29 |
+
"eos_token_id": 385,
|
| 30 |
+
"unk_token_id": 2,
|
| 31 |
+
"torch_dtype": "float16",
|
| 32 |
+
"parameter_count": 1000000
|
| 33 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"task": "text-classification",
|
| 3 |
+
"return_labels": true,
|
| 4 |
+
"temperature": 1.2203789949417114,
|
| 5 |
+
"labels": [
|
| 6 |
+
"safe",
|
| 7 |
+
"unsafe"
|
| 8 |
+
]
|
| 9 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7a8906d8dc10aa00789a198d8396a3a1a3b1f98e23473b352a016b9521a2ad4e
|
| 3 |
+
size 2006504
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"pad_token": "<pad>",
|
| 3 |
+
"eos_token": "</s>",
|
| 4 |
+
"unk_token": "<unk>",
|
| 5 |
+
"cls_token": "<cls>",
|
| 6 |
+
"sep_token": "<sep>"
|
| 7 |
+
}
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"tokenizer_class": "ByT5Tokenizer",
|
| 3 |
+
"pretrained_model_name_or_path": "google/byt5-small",
|
| 4 |
+
"base_vocab_size": 384,
|
| 5 |
+
"model_embedding_vocab_size": 4096,
|
| 6 |
+
"pad_token": "<pad>",
|
| 7 |
+
"eos_token": "</s>",
|
| 8 |
+
"unk_token": "<unk>",
|
| 9 |
+
"pad_token_id": 0,
|
| 10 |
+
"eos_token_id": 1,
|
| 11 |
+
"unk_token_id": 2,
|
| 12 |
+
"cls_token": "<cls>",
|
| 13 |
+
"cls_token_id": 384,
|
| 14 |
+
"sep_token": "<sep>",
|
| 15 |
+
"sep_token_id": 385,
|
| 16 |
+
"max_length": 128,
|
| 17 |
+
"tokenizer_semantics": "raw UTF-8 byte -> byte + 3"
|
| 18 |
+
}
|
training_config.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_name": "Quantum-Guard",
|
| 3 |
+
"task": "safe_vs_unsafe",
|
| 4 |
+
"datasets": [
|
| 5 |
+
"SetFit/enron_spam",
|
| 6 |
+
"ucirvine/sms_spam",
|
| 7 |
+
"deepset/prompt-injections",
|
| 8 |
+
"Nebulixlabs/safety-dataset",
|
| 9 |
+
"0x7o/spam_detector",
|
| 10 |
+
"SetFit/toxic_conversations",
|
| 11 |
+
"xTRam1/safe-guard-prompt-injection",
|
| 12 |
+
"pankajbiswas6/prism-hinglish-hate-speech"
|
| 13 |
+
],
|
| 14 |
+
"label_semantics": {
|
| 15 |
+
"0": "safe",
|
| 16 |
+
"1": "unsafe"
|
| 17 |
+
},
|
| 18 |
+
"tokenizer": "google/byt5-small",
|
| 19 |
+
"tokenizer_semantics": "ByT5 raw UTF-8 bytes + custom CLS/SEP",
|
| 20 |
+
"architecture": {
|
| 21 |
+
"vocab_size": 4096,
|
| 22 |
+
"context_length": 128,
|
| 23 |
+
"d_model": 112,
|
| 24 |
+
"attention_heads": 7,
|
| 25 |
+
"layers": 4,
|
| 26 |
+
"ffn": 336,
|
| 27 |
+
"classifier_hidden": 170,
|
| 28 |
+
"dropout": 0.1
|
| 29 |
+
},
|
| 30 |
+
"parameters": 1000000,
|
| 31 |
+
"batch_size": 128,
|
| 32 |
+
"target_tokens": 200000000,
|
| 33 |
+
"actual_tokens": 200013589,
|
| 34 |
+
"epochs": 88,
|
| 35 |
+
"optimizer": "AdamW",
|
| 36 |
+
"learning_rate": 0.0003,
|
| 37 |
+
"minimum_learning_rate": 3e-05,
|
| 38 |
+
"weight_decay": 0.01,
|
| 39 |
+
"warmup_ratio": 0.05,
|
| 40 |
+
"gradient_clip": 1.0,
|
| 41 |
+
"mixed_precision": "fp16",
|
| 42 |
+
"torch_compile": true,
|
| 43 |
+
"confidence_temperature": 1.2203789949417114,
|
| 44 |
+
"resume_supported": true
|
| 45 |
+
}
|
training_history.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|