Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,199 +1,120 @@
|
|
| 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 |
-
[More Information Needed]
|
| 51 |
-
|
| 52 |
-
### Out-of-Scope Use
|
| 53 |
-
|
| 54 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 55 |
-
|
| 56 |
-
[More Information Needed]
|
| 57 |
-
|
| 58 |
-
## Bias, Risks, and Limitations
|
| 59 |
-
|
| 60 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 61 |
-
|
| 62 |
-
[More Information Needed]
|
| 63 |
-
|
| 64 |
-
### Recommendations
|
| 65 |
-
|
| 66 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 67 |
-
|
| 68 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 69 |
-
|
| 70 |
-
## How to Get Started with the Model
|
| 71 |
-
|
| 72 |
-
Use the code below to get started with the model.
|
| 73 |
-
|
| 74 |
-
[More Information Needed]
|
| 75 |
-
|
| 76 |
-
## Training Details
|
| 77 |
-
|
| 78 |
-
### Training Data
|
| 79 |
-
|
| 80 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
| 81 |
-
|
| 82 |
-
[More Information Needed]
|
| 83 |
-
|
| 84 |
-
### Training Procedure
|
| 85 |
-
|
| 86 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 87 |
-
|
| 88 |
-
#### Preprocessing [optional]
|
| 89 |
-
|
| 90 |
-
[More Information Needed]
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
#### Training Hyperparameters
|
| 94 |
-
|
| 95 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 96 |
-
|
| 97 |
-
#### Speeds, Sizes, Times [optional]
|
| 98 |
-
|
| 99 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 100 |
-
|
| 101 |
-
[More Information Needed]
|
| 102 |
-
|
| 103 |
-
## Evaluation
|
| 104 |
-
|
| 105 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 106 |
-
|
| 107 |
-
### Testing Data, Factors & Metrics
|
| 108 |
-
|
| 109 |
-
#### Testing Data
|
| 110 |
-
|
| 111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
| 112 |
-
|
| 113 |
-
[More Information Needed]
|
| 114 |
-
|
| 115 |
-
#### Factors
|
| 116 |
-
|
| 117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 118 |
-
|
| 119 |
-
[More Information Needed]
|
| 120 |
-
|
| 121 |
-
#### Metrics
|
| 122 |
-
|
| 123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 124 |
-
|
| 125 |
-
[More Information Needed]
|
| 126 |
-
|
| 127 |
-
### Results
|
| 128 |
-
|
| 129 |
-
[More Information Needed]
|
| 130 |
-
|
| 131 |
-
#### Summary
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
## Model Examination [optional]
|
| 136 |
-
|
| 137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 138 |
-
|
| 139 |
-
[More Information Needed]
|
| 140 |
-
|
| 141 |
-
## Environmental Impact
|
| 142 |
-
|
| 143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 144 |
-
|
| 145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 146 |
-
|
| 147 |
-
- **Hardware Type:** [More Information Needed]
|
| 148 |
-
- **Hours used:** [More Information Needed]
|
| 149 |
-
- **Cloud Provider:** [More Information Needed]
|
| 150 |
-
- **Compute Region:** [More Information Needed]
|
| 151 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
-
|
| 153 |
-
## Technical Specifications [optional]
|
| 154 |
-
|
| 155 |
-
### Model Architecture and Objective
|
| 156 |
-
|
| 157 |
-
[More Information Needed]
|
| 158 |
-
|
| 159 |
-
### Compute Infrastructure
|
| 160 |
-
|
| 161 |
-
[More Information Needed]
|
| 162 |
-
|
| 163 |
-
#### Hardware
|
| 164 |
-
|
| 165 |
-
[More Information Needed]
|
| 166 |
-
|
| 167 |
-
#### Software
|
| 168 |
-
|
| 169 |
-
[More Information Needed]
|
| 170 |
-
|
| 171 |
-
## Citation [optional]
|
| 172 |
-
|
| 173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
|
| 175 |
-
|
| 176 |
|
| 177 |
-
|
| 178 |
|
| 179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
|
| 181 |
-
|
| 182 |
|
| 183 |
-
##
|
| 184 |
|
| 185 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
|
| 187 |
-
|
| 188 |
|
| 189 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
|
| 191 |
-
|
| 192 |
|
| 193 |
-
##
|
| 194 |
|
| 195 |
-
|
|
|
|
|
|
|
|
|
|
| 196 |
|
| 197 |
-
##
|
| 198 |
|
| 199 |
-
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
language: en
|
| 3 |
+
license: mit
|
| 4 |
+
base_model: microsoft/codebert-base
|
| 5 |
+
tags:
|
| 6 |
+
- log-translation
|
| 7 |
+
- security-logs
|
| 8 |
+
- cloud-logs
|
| 9 |
+
- siem
|
| 10 |
+
- qlora
|
| 11 |
+
- peft
|
| 12 |
+
- codebert
|
| 13 |
+
datasets:
|
| 14 |
+
- custom
|
| 15 |
+
pipeline_tag: text-generation
|
| 16 |
---
|
| 17 |
|
| 18 |
+
# 🔐 Native Log Translator
|
| 19 |
|
| 20 |
+
> Maps heterogeneous cloud and OS logs to a unified normalized schema.
|
| 21 |
|
| 22 |
+
Fine-tuned from `microsoft/codebert-base` using **LoRA (PEFT)** on a curated dataset
|
| 23 |
+
of multi-provider security logs. Trained on Kaggle T4 x2 in FP16.
|
| 24 |
|
| 25 |
+
---
|
| 26 |
|
| 27 |
+
## 🚀 Quick Start
|
| 28 |
+
```python
|
| 29 |
+
import torch
|
| 30 |
+
from transformers import RobertaTokenizer, RobertaForCausalLM, RobertaConfig
|
| 31 |
+
from peft import PeftModel
|
| 32 |
+
|
| 33 |
+
MODEL_REPO = "Swapnanil09/native-log-translator-qlora"
|
| 34 |
+
BASE_MODEL = "microsoft/codebert-base"
|
| 35 |
+
|
| 36 |
+
tokenizer = RobertaTokenizer.from_pretrained(MODEL_REPO)
|
| 37 |
+
|
| 38 |
+
config = RobertaConfig.from_pretrained(BASE_MODEL)
|
| 39 |
+
config.is_decoder = True
|
| 40 |
+
|
| 41 |
+
base = RobertaForCausalLM.from_pretrained(
|
| 42 |
+
BASE_MODEL,
|
| 43 |
+
config=config,
|
| 44 |
+
ignore_mismatched_sizes=True,
|
| 45 |
+
torch_dtype=torch.float16,
|
| 46 |
+
device_map="auto",
|
| 47 |
+
)
|
| 48 |
+
model = PeftModel.from_pretrained(base, MODEL_REPO)
|
| 49 |
+
model.eval()
|
| 50 |
+
|
| 51 |
+
def translate_log(log_input):
|
| 52 |
+
prompt = f"<log>{log_input}</log>\n<schema>"
|
| 53 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 54 |
+
with torch.no_grad():
|
| 55 |
+
out = model.generate(**inputs, max_new_tokens=60, temperature=0.1,
|
| 56 |
+
do_sample=True, pad_token_id=tokenizer.eos_token_id)
|
| 57 |
+
decoded = tokenizer.decode(out[0], skip_special_tokens=True)
|
| 58 |
+
return decoded.split("<schema>")[-1].strip()
|
| 59 |
+
|
| 60 |
+
print(translate_log("AzureSignInLogs | ResultType=0"))
|
| 61 |
+
# event_type: authentication_success
|
| 62 |
+
# provider: azure
|
| 63 |
+
# risk_level: low
|
| 64 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
+
---
|
| 67 |
|
| 68 |
+
## 📋 Output Schema
|
| 69 |
|
| 70 |
+
| Field | Description | Values |
|
| 71 |
+
|---|---|---|
|
| 72 |
+
| `event_type` | Normalized event category | e.g. `authentication_success`, `privilege_escalation` |
|
| 73 |
+
| `provider` | Source cloud / OS | `azure`, `aws`, `gcp`, `windows`, `linux`, `paloalto`, `cisco`, `fortinet` |
|
| 74 |
+
| `risk_level` | Severity classification | `low`, `medium`, `high`, `critical` |
|
| 75 |
|
| 76 |
+
---
|
| 77 |
|
| 78 |
+
## 📦 Supported Log Sources
|
| 79 |
|
| 80 |
+
| Provider | Log Type |
|
| 81 |
+
|---|---|
|
| 82 |
+
| **Azure** | SignInLogs, Activity, NSGFlowLogs |
|
| 83 |
+
| **AWS** | CloudTrail |
|
| 84 |
+
| **GCP** | Audit Logs |
|
| 85 |
+
| **Windows** | Security Events (4624, 4625, 4688, 4698, 4720, 4732, 1102 ...) |
|
| 86 |
+
| **Linux** | Syslog (auth, kern) |
|
| 87 |
+
| **Network** | Palo Alto, Cisco, Fortinet (CommonSecurityLog) |
|
| 88 |
|
| 89 |
+
---
|
| 90 |
|
| 91 |
+
## ⚙️ Training Details
|
| 92 |
+
|
| 93 |
+
| Setting | Value |
|
| 94 |
+
|---|---|
|
| 95 |
+
| Base model | `microsoft/codebert-base` |
|
| 96 |
+
| Method | LoRA (PEFT) |
|
| 97 |
+
| LoRA rank | 16 |
|
| 98 |
+
| LoRA alpha | 32 |
|
| 99 |
+
| Target modules | query, key, value |
|
| 100 |
+
| Epochs | 15 |
|
| 101 |
+
| Batch size | 8 per device |
|
| 102 |
+
| Gradient accumulation | 4 steps |
|
| 103 |
+
| Learning rate | 2e-4 |
|
| 104 |
+
| Precision | FP16 |
|
| 105 |
+
| Hardware | Kaggle T4 x2 |
|
| 106 |
|
| 107 |
+
---
|
| 108 |
|
| 109 |
+
## 📌 Intended Use
|
| 110 |
|
| 111 |
+
- SIEM normalization pipelines
|
| 112 |
+
- Multi-cloud SOC log ingestion
|
| 113 |
+
- Security event correlation
|
| 114 |
+
- Threat detection preprocessing
|
| 115 |
|
| 116 |
+
## ⚠️ Limitations
|
| 117 |
|
| 118 |
+
- Trained on a small curated dataset — production use should involve fine-tuning on your own log corpus
|
| 119 |
+
- May not generalize to vendor-specific log formats not seen during training
|
| 120 |
+
- Not a replacement for rule-based parsers in high-stakes pipelines without validation
|