Text Classification
PEFT
Safetensors
Transformers
English
lora
security
xss
vulnerability-detection
cybersecurity
web-security
Instructions to use PentesterFlow/xss-decision with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use PentesterFlow/xss-decision with PEFT:
from peft import PeftModel from transformers import AutoModel base_model = AutoModel.from_pretrained("Qwen/Qwen3.5-0.8B-Base") model = PeftModel.from_pretrained(base_model, "PentesterFlow/xss-decision") - Transformers
How to use PentesterFlow/xss-decision with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="PentesterFlow/xss-decision")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("PentesterFlow/xss-decision", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Release: Kev XSS Decision 0.8B Live v2 — trained on 528 execution-verified records
Browse files- .gitattributes +1 -0
- README.md +162 -0
- adapter_config.json +57 -0
- adapter_model.safetensors +3 -0
- chat_template.jinja +154 -0
- head.pt +3 -0
- tokenizer.json +3 -0
- tokenizer_config.json +48 -0
- training_config.json +58 -0
- training_metrics.json +14 -0
- xss_live_provenance.json +69 -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,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: Qwen/Qwen3.5-0.8B-Base
|
| 3 |
+
library_name: peft
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
tags:
|
| 6 |
+
- base_model:adapter:Qwen/Qwen3.5-0.8B-Base
|
| 7 |
+
- lora
|
| 8 |
+
- transformers
|
| 9 |
+
- security
|
| 10 |
+
- xss
|
| 11 |
+
- vulnerability-detection
|
| 12 |
+
- cybersecurity
|
| 13 |
+
- web-security
|
| 14 |
+
language:
|
| 15 |
+
- en
|
| 16 |
+
pipeline_tag: text-classification
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# XSS Decision Model — Kev 0.8B Live v2
|
| 20 |
+
|
| 21 |
+
A **0.8B parameter Small Language Model (SLM)** fine-tuned for real-time XSS (Cross-Site Scripting) vulnerability decision-making. This is a LoRA adapter on top of `Qwen/Qwen3.5-0.8B-Base`, trained using the [Kev](https://github.com/jaredpalmer/kev) typed-decision framework.
|
| 22 |
+
|
| 23 |
+
## What It Does
|
| 24 |
+
|
| 25 |
+
The model makes 5 types of XSS assessment decisions in real-time:
|
| 26 |
+
|
| 27 |
+
| Task | Question | Description |
|
| 28 |
+
|------|----------|-------------|
|
| 29 |
+
| **triage** | exploitable? | Should this URL/parameter combination be probed for XSS? |
|
| 30 |
+
| **analyze** | true_context | What is the actual injection context? (html_text, html_attr, js_string, dom_html, etc.) |
|
| 31 |
+
| **interpret** | exploitable? | Given reflection evidence, is this actually exploitable? |
|
| 32 |
+
| **strategy** | best_probe | Which XSS probe technique should be tried? |
|
| 33 |
+
| **escalate** | escalation | What escalation technique to try next? (evasion, mXSS, CSP bypass) |
|
| 34 |
+
|
| 35 |
+
## Held-out Test Accuracy
|
| 36 |
+
|
| 37 |
+
Evaluated on 57 held-out records (never seen during training):
|
| 38 |
+
|
| 39 |
+
| Task | Question | Accuracy |
|
| 40 |
+
|------|----------|----------|
|
| 41 |
+
| analyze | has_sanitizer | **100%** (21/21) |
|
| 42 |
+
| analyze | true_context | **95.2%** (20/21) |
|
| 43 |
+
| interpret | exploitable | **100%** (7/7) |
|
| 44 |
+
| escalate | escalation | **100%** (2/2) |
|
| 45 |
+
| strategy | best_probe | **75%** (3/4) |
|
| 46 |
+
| triage | exploitable | **78.3%** (18/23) |
|
| 47 |
+
|
| 48 |
+
## Pipeline Integration Results
|
| 49 |
+
|
| 50 |
+
When integrated into the xss-specialist live assessment pipeline:
|
| 51 |
+
|
| 52 |
+
| Benchmark | Cases | Precision | Recall | FPR | FNR |
|
| 53 |
+
|-----------|-------|-----------|--------|-----|-----|
|
| 54 |
+
| XSS-LiveBench-v2 | 225 | **1.000** | **1.000** | **0.000** | **0.000** |
|
| 55 |
+
| Live XSS Lab | 10 scenarios | **10/10 CONFIRMED** | - | - | - |
|
| 56 |
+
|
| 57 |
+
All 157 vulnerable cases detected, all 68 safe cases correctly dismissed, zero false positives.
|
| 58 |
+
|
| 59 |
+
## How to Use
|
| 60 |
+
|
| 61 |
+
```python
|
| 62 |
+
# Requires the kev package (Python 3.12/3.13)
|
| 63 |
+
# pip install "kev @ git+https://github.com/jaredpalmer/kev.git"
|
| 64 |
+
|
| 65 |
+
from xss_decision.learned import LearnedBackend
|
| 66 |
+
|
| 67 |
+
backend = LearnedBackend("path/to/checkpoint", device="mps") # or "cuda", "cpu"
|
| 68 |
+
|
| 69 |
+
# Triage decision
|
| 70 |
+
result = backend.predict({
|
| 71 |
+
"state": {
|
| 72 |
+
"task": "triage",
|
| 73 |
+
"url": "/search",
|
| 74 |
+
"parameter": "q",
|
| 75 |
+
"delivery": "query",
|
| 76 |
+
"context": "html_text",
|
| 77 |
+
"method": "GET"
|
| 78 |
+
},
|
| 79 |
+
"questions": {
|
| 80 |
+
"exploitable": {
|
| 81 |
+
"type": "noul",
|
| 82 |
+
"criteria": {
|
| 83 |
+
"true": "High likelihood of reflection into a dangerous context",
|
| 84 |
+
"false": "Low likelihood — encoded, filtered, or structural param"
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
})
|
| 89 |
+
print(result["probabilities"])
|
| 90 |
+
# {"exploitable": {"true": 0.854, "false": 0.146}}
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
### Use with the Live Scanner
|
| 94 |
+
|
| 95 |
+
```bash
|
| 96 |
+
# Install
|
| 97 |
+
uv sync
|
| 98 |
+
uv run python -m playwright install chromium
|
| 99 |
+
|
| 100 |
+
# Run with the trained model
|
| 101 |
+
uv run python -m live.assess --target http://authorized-target.com --kev runs/kev-xss-v2/checkpoint
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
## Training Details
|
| 105 |
+
|
| 106 |
+
| Parameter | Value |
|
| 107 |
+
|-----------|-------|
|
| 108 |
+
| Base model | Qwen/Qwen3.5-0.8B-Base |
|
| 109 |
+
| Parent checkpoint | jaredpalmer/kev-0.8b |
|
| 110 |
+
| Adapter | LoRA (rank 16, full placement) |
|
| 111 |
+
| Trainable parameters | 11.3M |
|
| 112 |
+
| Training records | 528 (from XSS-LiveBench-v2 execution-verified run) |
|
| 113 |
+
| Typed decisions | 582 |
|
| 114 |
+
| Epochs | 3 |
|
| 115 |
+
| Learning rate | 1e-5 |
|
| 116 |
+
| Batch size | 4 (accumulation 2) |
|
| 117 |
+
| Optimizer steps | 159 |
|
| 118 |
+
| Precision | fp32 |
|
| 119 |
+
| Device | Apple MPS |
|
| 120 |
+
| Training time | 1213s (~20 min) |
|
| 121 |
+
| Permutation KL | 0.1 (option-order stability regularization) |
|
| 122 |
+
|
| 123 |
+
### Training Data
|
| 124 |
+
|
| 125 |
+
528 records exported from a perfect-score XSS-LiveBench-v2 run (225 cases, P=1.0, R=1.0, FPR=0.0). Each record represents a real decision the pipeline made during live XSS assessment, with execution-verified ground truth from the headless Chromium browser oracle.
|
| 126 |
+
|
| 127 |
+
Task distribution: triage (221), analyze (203), interpret (63), strategy (29), escalate (12).
|
| 128 |
+
|
| 129 |
+
## Architecture
|
| 130 |
+
|
| 131 |
+
This is a **Kev typed-decision model** — a pointer-network head on a Mamba2/transformer hybrid backbone. Unlike autoregressive text generation, it produces calibrated probability distributions over structured decision options in a single forward pass (~242ms on Apple MPS).
|
| 132 |
+
|
| 133 |
+
```
|
| 134 |
+
Qwen3.5-0.8B-Base (frozen)
|
| 135 |
+
└── LoRA adapters (rank 16, all projections)
|
| 136 |
+
└── Kev pointer head (dim 256)
|
| 137 |
+
└── Per-question probability distributions
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
## Limitations
|
| 141 |
+
|
| 142 |
+
- **Research preview** — not independently validated for production use
|
| 143 |
+
- **Training data is synthetic benchmark-derived** — may not generalize to all real-world XSS patterns
|
| 144 |
+
- **A "safe" prediction is not proof of safety** — always verify with browser execution
|
| 145 |
+
- **Near-miss sanitizer leakage** — the model alone cannot reliably distinguish DOMPurify from DOMPvrify; the full pipeline handles this via execution verification
|
| 146 |
+
- **No blind/out-of-band XSS** — training data covers reflected, DOM, and stored XSS only
|
| 147 |
+
- **Chromium-specific** — browser oracle ground truth is Chromium-based
|
| 148 |
+
|
| 149 |
+
## Ethical Use
|
| 150 |
+
|
| 151 |
+
This model is intended for **authorized security testing only**. All assessment paths require explicit scope and authorization. The model should be used as part of a defensive security workflow, not for unauthorized testing.
|
| 152 |
+
|
| 153 |
+
## License
|
| 154 |
+
|
| 155 |
+
Apache-2.0 (adapter and pointer head). The base model (Qwen3.5-0.8B-Base) is also Apache-2.0.
|
| 156 |
+
|
| 157 |
+
### Framework versions
|
| 158 |
+
|
| 159 |
+
- PEFT 0.22.0
|
| 160 |
+
- Kev 0.1.0
|
| 161 |
+
- PyTorch 2.x
|
| 162 |
+
- Transformers 4.x
|
adapter_config.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alora_invocation_tokens": null,
|
| 3 |
+
"alpha_pattern": {},
|
| 4 |
+
"arrow_config": null,
|
| 5 |
+
"astra_config": null,
|
| 6 |
+
"auto_mapping": null,
|
| 7 |
+
"base_model_name_or_path": "Qwen/Qwen3.5-0.8B-Base",
|
| 8 |
+
"bias": "none",
|
| 9 |
+
"corda_config": null,
|
| 10 |
+
"ensure_weight_tying": false,
|
| 11 |
+
"eva_config": null,
|
| 12 |
+
"exclude_modules": null,
|
| 13 |
+
"fan_in_fan_out": false,
|
| 14 |
+
"inference_mode": true,
|
| 15 |
+
"init_lora_weights": true,
|
| 16 |
+
"kasa_config": null,
|
| 17 |
+
"layer_replication": null,
|
| 18 |
+
"layers_pattern": null,
|
| 19 |
+
"layers_to_transform": null,
|
| 20 |
+
"loftq_config": {},
|
| 21 |
+
"lora_alpha": 32,
|
| 22 |
+
"lora_bias": false,
|
| 23 |
+
"lora_dropout": 0.05,
|
| 24 |
+
"lora_ga_config": null,
|
| 25 |
+
"megatron_config": null,
|
| 26 |
+
"megatron_core": "megatron.core",
|
| 27 |
+
"modules_to_save": null,
|
| 28 |
+
"monteclora_config": null,
|
| 29 |
+
"peft_type": "LORA",
|
| 30 |
+
"peft_version": "0.22.0",
|
| 31 |
+
"qalora_group_size": 16,
|
| 32 |
+
"r": 16,
|
| 33 |
+
"rank_pattern": {},
|
| 34 |
+
"revision": null,
|
| 35 |
+
"target_modules": [
|
| 36 |
+
"q_proj",
|
| 37 |
+
"o_proj",
|
| 38 |
+
"k_proj",
|
| 39 |
+
"v_proj",
|
| 40 |
+
"gate_proj",
|
| 41 |
+
"in_proj_qkv",
|
| 42 |
+
"down_proj",
|
| 43 |
+
"in_proj_b",
|
| 44 |
+
"out_proj",
|
| 45 |
+
"up_proj",
|
| 46 |
+
"in_proj_z",
|
| 47 |
+
"in_proj_a"
|
| 48 |
+
],
|
| 49 |
+
"target_parameters": null,
|
| 50 |
+
"task_type": "FEATURE_EXTRACTION",
|
| 51 |
+
"trainable_token_indices": null,
|
| 52 |
+
"use_bdlora": null,
|
| 53 |
+
"use_dora": false,
|
| 54 |
+
"use_qalora": false,
|
| 55 |
+
"use_rslora": false,
|
| 56 |
+
"velora_config": null
|
| 57 |
+
}
|
adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1f0ffe967a72c1544360661cbbd83782aa26d940997ac63d8b4160c8cde9eb64
|
| 3 |
+
size 43338624
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- set image_count = namespace(value=0) %}
|
| 2 |
+
{%- set video_count = namespace(value=0) %}
|
| 3 |
+
{%- macro render_content(content, do_vision_count, is_system_content=false) %}
|
| 4 |
+
{%- if content is string %}
|
| 5 |
+
{{- content }}
|
| 6 |
+
{%- elif content is iterable and content is not mapping %}
|
| 7 |
+
{%- for item in content %}
|
| 8 |
+
{%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
|
| 9 |
+
{%- if is_system_content %}
|
| 10 |
+
{{- raise_exception('System message cannot contain images.') }}
|
| 11 |
+
{%- endif %}
|
| 12 |
+
{%- if do_vision_count %}
|
| 13 |
+
{%- set image_count.value = image_count.value + 1 %}
|
| 14 |
+
{%- endif %}
|
| 15 |
+
{%- if add_vision_id %}
|
| 16 |
+
{{- 'Picture ' ~ image_count.value ~ ': ' }}
|
| 17 |
+
{%- endif %}
|
| 18 |
+
{{- '<|vision_start|><|image_pad|><|vision_end|>' }}
|
| 19 |
+
{%- elif 'video' in item or item.type == 'video' %}
|
| 20 |
+
{%- if is_system_content %}
|
| 21 |
+
{{- raise_exception('System message cannot contain videos.') }}
|
| 22 |
+
{%- endif %}
|
| 23 |
+
{%- if do_vision_count %}
|
| 24 |
+
{%- set video_count.value = video_count.value + 1 %}
|
| 25 |
+
{%- endif %}
|
| 26 |
+
{%- if add_vision_id %}
|
| 27 |
+
{{- 'Video ' ~ video_count.value ~ ': ' }}
|
| 28 |
+
{%- endif %}
|
| 29 |
+
{{- '<|vision_start|><|video_pad|><|vision_end|>' }}
|
| 30 |
+
{%- elif 'text' in item %}
|
| 31 |
+
{{- item.text }}
|
| 32 |
+
{%- else %}
|
| 33 |
+
{{- raise_exception('Unexpected item type in content.') }}
|
| 34 |
+
{%- endif %}
|
| 35 |
+
{%- endfor %}
|
| 36 |
+
{%- elif content is none or content is undefined %}
|
| 37 |
+
{{- '' }}
|
| 38 |
+
{%- else %}
|
| 39 |
+
{{- raise_exception('Unexpected content type.') }}
|
| 40 |
+
{%- endif %}
|
| 41 |
+
{%- endmacro %}
|
| 42 |
+
{%- if not messages %}
|
| 43 |
+
{{- raise_exception('No messages provided.') }}
|
| 44 |
+
{%- endif %}
|
| 45 |
+
{%- if tools and tools is iterable and tools is not mapping %}
|
| 46 |
+
{{- '<|im_start|>system\n' }}
|
| 47 |
+
{{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
|
| 48 |
+
{%- for tool in tools %}
|
| 49 |
+
{{- "\n" }}
|
| 50 |
+
{{- tool | tojson }}
|
| 51 |
+
{%- endfor %}
|
| 52 |
+
{{- "\n</tools>" }}
|
| 53 |
+
{{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
|
| 54 |
+
{%- if messages[0].role == 'system' %}
|
| 55 |
+
{%- set content = render_content(messages[0].content, false, true)|trim %}
|
| 56 |
+
{%- if content %}
|
| 57 |
+
{{- '\n\n' + content }}
|
| 58 |
+
{%- endif %}
|
| 59 |
+
{%- endif %}
|
| 60 |
+
{{- '<|im_end|>\n' }}
|
| 61 |
+
{%- else %}
|
| 62 |
+
{%- if messages[0].role == 'system' %}
|
| 63 |
+
{%- set content = render_content(messages[0].content, false, true)|trim %}
|
| 64 |
+
{{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
|
| 65 |
+
{%- endif %}
|
| 66 |
+
{%- endif %}
|
| 67 |
+
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
| 68 |
+
{%- for message in messages[::-1] %}
|
| 69 |
+
{%- set index = (messages|length - 1) - loop.index0 %}
|
| 70 |
+
{%- if ns.multi_step_tool and message.role == "user" %}
|
| 71 |
+
{%- set content = render_content(message.content, false)|trim %}
|
| 72 |
+
{%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
|
| 73 |
+
{%- set ns.multi_step_tool = false %}
|
| 74 |
+
{%- set ns.last_query_index = index %}
|
| 75 |
+
{%- endif %}
|
| 76 |
+
{%- endif %}
|
| 77 |
+
{%- endfor %}
|
| 78 |
+
{%- if ns.multi_step_tool %}
|
| 79 |
+
{{- raise_exception('No user query found in messages.') }}
|
| 80 |
+
{%- endif %}
|
| 81 |
+
{%- for message in messages %}
|
| 82 |
+
{%- set content = render_content(message.content, true)|trim %}
|
| 83 |
+
{%- if message.role == "system" %}
|
| 84 |
+
{%- if not loop.first %}
|
| 85 |
+
{{- raise_exception('System message must be at the beginning.') }}
|
| 86 |
+
{%- endif %}
|
| 87 |
+
{%- elif message.role == "user" %}
|
| 88 |
+
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
| 89 |
+
{%- elif message.role == "assistant" %}
|
| 90 |
+
{%- set reasoning_content = '' %}
|
| 91 |
+
{%- if message.reasoning_content is string %}
|
| 92 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 93 |
+
{%- else %}
|
| 94 |
+
{%- if '</think>' in content %}
|
| 95 |
+
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
| 96 |
+
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
| 97 |
+
{%- endif %}
|
| 98 |
+
{%- endif %}
|
| 99 |
+
{%- set reasoning_content = reasoning_content|trim %}
|
| 100 |
+
{%- if loop.index0 > ns.last_query_index %}
|
| 101 |
+
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
|
| 102 |
+
{%- else %}
|
| 103 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 104 |
+
{%- endif %}
|
| 105 |
+
{%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
|
| 106 |
+
{%- for tool_call in message.tool_calls %}
|
| 107 |
+
{%- if tool_call.function is defined %}
|
| 108 |
+
{%- set tool_call = tool_call.function %}
|
| 109 |
+
{%- endif %}
|
| 110 |
+
{%- if loop.first %}
|
| 111 |
+
{%- if content|trim %}
|
| 112 |
+
{{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 113 |
+
{%- else %}
|
| 114 |
+
{{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 115 |
+
{%- endif %}
|
| 116 |
+
{%- else %}
|
| 117 |
+
{{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 118 |
+
{%- endif %}
|
| 119 |
+
{%- if tool_call.arguments is defined %}
|
| 120 |
+
{%- for args_name, args_value in tool_call.arguments|items %}
|
| 121 |
+
{{- '<parameter=' + args_name + '>\n' }}
|
| 122 |
+
{%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
|
| 123 |
+
{{- args_value }}
|
| 124 |
+
{{- '\n</parameter>\n' }}
|
| 125 |
+
{%- endfor %}
|
| 126 |
+
{%- endif %}
|
| 127 |
+
{{- '</function>\n</tool_call>' }}
|
| 128 |
+
{%- endfor %}
|
| 129 |
+
{%- endif %}
|
| 130 |
+
{{- '<|im_end|>\n' }}
|
| 131 |
+
{%- elif message.role == "tool" %}
|
| 132 |
+
{%- if loop.previtem and loop.previtem.role != "tool" %}
|
| 133 |
+
{{- '<|im_start|>user' }}
|
| 134 |
+
{%- endif %}
|
| 135 |
+
{{- '\n<tool_response>\n' }}
|
| 136 |
+
{{- content }}
|
| 137 |
+
{{- '\n</tool_response>' }}
|
| 138 |
+
{%- if not loop.last and loop.nextitem.role != "tool" %}
|
| 139 |
+
{{- '<|im_end|>\n' }}
|
| 140 |
+
{%- elif loop.last %}
|
| 141 |
+
{{- '<|im_end|>\n' }}
|
| 142 |
+
{%- endif %}
|
| 143 |
+
{%- else %}
|
| 144 |
+
{{- raise_exception('Unexpected message role.') }}
|
| 145 |
+
{%- endif %}
|
| 146 |
+
{%- endfor %}
|
| 147 |
+
{%- if add_generation_prompt %}
|
| 148 |
+
{{- '<|im_start|>assistant\n' }}
|
| 149 |
+
{%- if enable_thinking is defined and enable_thinking is true %}
|
| 150 |
+
{{- '<think>\n' }}
|
| 151 |
+
{%- else %}
|
| 152 |
+
{{- '<think>\n\n</think>\n\n' }}
|
| 153 |
+
{%- endif %}
|
| 154 |
+
{%- endif %}
|
head.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:22785c470e0c1f45f11328858357477d507e8ff2cc6edc9f1c1c19afc0b13602
|
| 3 |
+
size 2102911
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a5cd9732badce41de57e6efce8302930ded1c1188c5f81feb2bd6c24c4a1941f
|
| 3 |
+
size 19989339
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"audio_bos_token": "<|audio_start|>",
|
| 4 |
+
"audio_eos_token": "<|audio_end|>",
|
| 5 |
+
"audio_token": "<|audio_pad|>",
|
| 6 |
+
"backend": "tokenizers",
|
| 7 |
+
"bos_token": null,
|
| 8 |
+
"clean_up_tokenization_spaces": false,
|
| 9 |
+
"eos_token": "<|endoftext|>",
|
| 10 |
+
"errors": "replace",
|
| 11 |
+
"extra_special_tokens": [
|
| 12 |
+
"<|im_start|>",
|
| 13 |
+
"<|im_end|>",
|
| 14 |
+
"<|object_ref_start|>",
|
| 15 |
+
"<|object_ref_end|>",
|
| 16 |
+
"<|box_start|>",
|
| 17 |
+
"<|box_end|>",
|
| 18 |
+
"<|quad_start|>",
|
| 19 |
+
"<|quad_end|>",
|
| 20 |
+
"<|vision_start|>",
|
| 21 |
+
"<|vision_end|>",
|
| 22 |
+
"<|vision_pad|>",
|
| 23 |
+
"<|image_pad|>",
|
| 24 |
+
"<|video_pad|>"
|
| 25 |
+
],
|
| 26 |
+
"image_token": "<|image_pad|>",
|
| 27 |
+
"is_local": false,
|
| 28 |
+
"local_files_only": false,
|
| 29 |
+
"merges_file": null,
|
| 30 |
+
"model_max_length": 262144,
|
| 31 |
+
"model_specific_special_tokens": {
|
| 32 |
+
"audio_bos_token": "<|audio_start|>",
|
| 33 |
+
"audio_eos_token": "<|audio_end|>",
|
| 34 |
+
"audio_token": "<|audio_pad|>",
|
| 35 |
+
"image_token": "<|image_pad|>",
|
| 36 |
+
"video_token": "<|video_pad|>",
|
| 37 |
+
"vision_bos_token": "<|vision_start|>",
|
| 38 |
+
"vision_eos_token": "<|vision_end|>"
|
| 39 |
+
},
|
| 40 |
+
"pad_token": "<|endoftext|>",
|
| 41 |
+
"pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
|
| 42 |
+
"split_special_tokens": false,
|
| 43 |
+
"tokenizer_class": "Qwen3_5Tokenizer",
|
| 44 |
+
"unk_token": null,
|
| 45 |
+
"video_token": "<|video_pad|>",
|
| 46 |
+
"vision_bos_token": "<|vision_start|>",
|
| 47 |
+
"vision_eos_token": "<|vision_end|>"
|
| 48 |
+
}
|
training_config.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"args": {
|
| 3 |
+
"base": "Qwen/Qwen3.5-0.8B-Base",
|
| 4 |
+
"n_per_source": 1000,
|
| 5 |
+
"epochs": 3,
|
| 6 |
+
"lr": 1e-05,
|
| 7 |
+
"head_lr": 0.0,
|
| 8 |
+
"weight_decay": 0.01,
|
| 9 |
+
"lora": 16,
|
| 10 |
+
"accum": 2,
|
| 11 |
+
"holdout": "",
|
| 12 |
+
"perm_kl": 0.1,
|
| 13 |
+
"perm_frac": 0.3,
|
| 14 |
+
"ord_w": 0.0,
|
| 15 |
+
"label_smoothing": 0.0,
|
| 16 |
+
"brier_w": 0.0,
|
| 17 |
+
"focal_gamma": 0.0,
|
| 18 |
+
"suite": null,
|
| 19 |
+
"train_sources": "",
|
| 20 |
+
"device": "mps",
|
| 21 |
+
"batch": 4,
|
| 22 |
+
"dtype": "fp32",
|
| 23 |
+
"weights_dtype": "fp32",
|
| 24 |
+
"checkpointing": 1,
|
| 25 |
+
"option_isolation": 0,
|
| 26 |
+
"special_embeddings": 0,
|
| 27 |
+
"head_dim": 256,
|
| 28 |
+
"lora_targets": "all",
|
| 29 |
+
"lora_placement": "full",
|
| 30 |
+
"base_revision": "dc7cdfe2ee4154fa7e30f5b51ca41bfa40174e68",
|
| 31 |
+
"p_none": 0.0,
|
| 32 |
+
"p_none_distract": 0.0,
|
| 33 |
+
"p_distract": 0.0,
|
| 34 |
+
"p_none_pair": 0.0,
|
| 35 |
+
"synthetic_repeat": 1,
|
| 36 |
+
"public_frac": 1.0,
|
| 37 |
+
"anchor": "",
|
| 38 |
+
"anchor_w": 0.0,
|
| 39 |
+
"anchor_sources": "",
|
| 40 |
+
"out": "runs/kev-xss-v2/checkpoint",
|
| 41 |
+
"data": "runs/kev-xss-v2/suite/train.jsonl",
|
| 42 |
+
"max_state": 2048,
|
| 43 |
+
"replay": 0,
|
| 44 |
+
"init_from": "/Users/secfathy/.cache/huggingface/hub/models--jaredpalmer--kev-0.8b/snapshots/9a45d25eb2ab761841196625383fa1dff0e56c1e",
|
| 45 |
+
"seed": 42
|
| 46 |
+
},
|
| 47 |
+
"suite_sha256": null,
|
| 48 |
+
"base_revision": "dc7cdfe2ee4154fa7e30f5b51ca41bfa40174e68",
|
| 49 |
+
"init_source": {
|
| 50 |
+
"init_from": "/Users/secfathy/.cache/huggingface/hub/models--jaredpalmer--kev-0.8b/snapshots/9a45d25eb2ab761841196625383fa1dff0e56c1e",
|
| 51 |
+
"resolved": "/Users/secfathy/.cache/huggingface/hub/models--jaredpalmer--kev-0.8b/snapshots/9a45d25eb2ab761841196625383fa1dff0e56c1e",
|
| 52 |
+
"adapter_sha256": "9b908623acb162118575f4e7a94524f9c139c335be4bfb74d6cfceca01e1885a",
|
| 53 |
+
"head_sha256": "f400bd12802b2b105ae45d6b03774a158a3db4fccff42413734ddca2e5c920b6",
|
| 54 |
+
"adapter_tensors": 372
|
| 55 |
+
},
|
| 56 |
+
"ordinal_objective": "ranked_probability_score",
|
| 57 |
+
"holdout": []
|
| 58 |
+
}
|
training_metrics.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"wall_seconds": 1213.304759979248,
|
| 3 |
+
"records_seen": 1260,
|
| 4 |
+
"requested_records": 1260,
|
| 5 |
+
"truncated_records": 0,
|
| 6 |
+
"rejected_records": 0,
|
| 7 |
+
"optimizer_steps": 159,
|
| 8 |
+
"forward_tokens": 203525,
|
| 9 |
+
"peak_device_bytes": 3441421568,
|
| 10 |
+
"device": "mps",
|
| 11 |
+
"dtype": "fp32",
|
| 12 |
+
"batch": 4,
|
| 13 |
+
"peak_rss_bytes": 3817619456
|
| 14 |
+
}
|
xss_live_provenance.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"source_data": "reports/live_assessments/livebench_v2/kev_training_preprocessed.jsonl",
|
| 3 |
+
"suite_manifest": {
|
| 4 |
+
"schema_version": "xss-kev-live-v1",
|
| 5 |
+
"source": "livebench-scanner-export",
|
| 6 |
+
"tasks": [
|
| 7 |
+
"triage",
|
| 8 |
+
"analyze",
|
| 9 |
+
"strategy",
|
| 10 |
+
"escalate",
|
| 11 |
+
"interpret"
|
| 12 |
+
],
|
| 13 |
+
"stats": {
|
| 14 |
+
"total_records": 528,
|
| 15 |
+
"by_task": {
|
| 16 |
+
"triage": 221,
|
| 17 |
+
"analyze": 203,
|
| 18 |
+
"interpret": 63,
|
| 19 |
+
"strategy": 29,
|
| 20 |
+
"escalate": 12
|
| 21 |
+
}
|
| 22 |
+
},
|
| 23 |
+
"splits": {
|
| 24 |
+
"train": {
|
| 25 |
+
"file": "train.jsonl",
|
| 26 |
+
"n": 420,
|
| 27 |
+
"sha256": "c2eb7d4108812292214b453f6dad5e933ff743ef1a57286b24d5682a98a13336",
|
| 28 |
+
"by_task": {
|
| 29 |
+
"triage": 176,
|
| 30 |
+
"analyze": 162,
|
| 31 |
+
"interpret": 50,
|
| 32 |
+
"strategy": 23,
|
| 33 |
+
"escalate": 9
|
| 34 |
+
}
|
| 35 |
+
},
|
| 36 |
+
"calibration": {
|
| 37 |
+
"file": "calibration.jsonl",
|
| 38 |
+
"n": 51,
|
| 39 |
+
"sha256": "075e6134f44f8496c93f73bb9430f38c70709afdcf37613d13e4bf3e8278fee5",
|
| 40 |
+
"by_task": {
|
| 41 |
+
"triage": 22,
|
| 42 |
+
"analyze": 20,
|
| 43 |
+
"interpret": 6,
|
| 44 |
+
"strategy": 2,
|
| 45 |
+
"escalate": 1
|
| 46 |
+
}
|
| 47 |
+
},
|
| 48 |
+
"test": {
|
| 49 |
+
"file": "test.jsonl",
|
| 50 |
+
"n": 57,
|
| 51 |
+
"sha256": "5b0ee731379285091ed8fc3caf1b16692134d465819e6ee97be00237565c67e6",
|
| 52 |
+
"by_task": {
|
| 53 |
+
"triage": 23,
|
| 54 |
+
"analyze": 21,
|
| 55 |
+
"interpret": 7,
|
| 56 |
+
"strategy": 4,
|
| 57 |
+
"escalate": 2
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
},
|
| 62 |
+
"init_from": "jaredpalmer/kev-0.8b@9a45d25eb2ab761841196625383fa1dff0e56c1e",
|
| 63 |
+
"epochs": 3,
|
| 64 |
+
"lr": 1e-05,
|
| 65 |
+
"batch": 4,
|
| 66 |
+
"device": "mps",
|
| 67 |
+
"seed": 42,
|
| 68 |
+
"checkpoint": "runs/kev-xss-v2/checkpoint"
|
| 69 |
+
}
|