初始化项目,由ModelHub XC社区提供模型
Model: EverywhereSafety/SEAD-SAGE-4B Source: Original Platform
This commit is contained in:
commit
cff32ad9fc
8 files changed
+283
No files matched your search
@@ -0,0 +1,2 @@
|
||||
model.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||
@@ -0,0 +1,100 @@
|
||||
---
|
||||
license: apache-2.0
|
||||
language:
|
||||
- en
|
||||
library_name: transformers
|
||||
pipeline_tag: text-generation
|
||||
base_model: Qwen/Qwen3-4B-Instruct-2507
|
||||
datasets:
|
||||
- EverywhereSafety/SEAD-SFT-v1
|
||||
tags:
|
||||
- agentic-defense
|
||||
- tool-using-agents
|
||||
- state-aware-safety
|
||||
- qwen3
|
||||
- sead
|
||||
---
|
||||
|
||||
# SEAD-SAGE-4B
|
||||
|
||||
Agentic defense model for deciding whether a pending tool action should pass or be blocked. SAGE can use bounded, read-only state queries before submitting its decision.
|
||||
|
||||
Paper: [SEAD](https://arxiv.org/abs/2609.34518) · Code: [EverywhereSafety/SEAD](https://github.com/EverywhereSafety/SEAD) · Project: [everywheresafety.github.io/sead](https://everywheresafety.github.io/sead/) · [Everywhere Safety](https://everywheresafety.github.io/)
|
||||
|
||||
## Checkpoint
|
||||
|
||||
| Property | Value |
|
||||
|---|---|
|
||||
| Base model | [Qwen3-4B-Instruct-2507](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507) |
|
||||
| Fine-tuning | Full SFT, cumulative epoch 2 |
|
||||
| Precision | BF16 |
|
||||
| Context budget | 65,536 tokens |
|
||||
| Defender steps | 6 maximum |
|
||||
| Generation budget | 1,024 tokens per step |
|
||||
| Temperature | 0.0 |
|
||||
| Thinking | Disabled |
|
||||
|
||||
## Paper-format offline metrics
|
||||
|
||||
The full comparison below reproduces the paper's frozen cohort (55 harmful and 95 benign trajectories) and adds the two released epoch-2 checkpoints. `B` is benign all-pass; `H1` is exact closure interception; `H2` is timing-aware interception; `F1/F2` are the paper's harmonic safety–utility summaries. All values are percentages. Technical/unresolved harmful cases count as Miss for the released checkpoints.
|
||||
|
||||
| Defender | B↑ | H1↑ | F1↑ | H2↑ | F2↑ |
|
||||
|---|---:|---:|---:|---:|---:|
|
||||
| No defense (paper) | 100.00 | 0.00 | 0.00 | 0.00 | 0.00 |
|
||||
| Base Binary (paper) | 51.58 | 0.00 | 0.00 | 17.03 | 25.61 |
|
||||
| Fine-tuned Binary (paper) | 100.00 | 18.18 | 30.77 | 22.05 | 36.13 |
|
||||
| StepGuard (paper) | 51.58 | 12.73 | 20.42 | 27.77 | 36.11 |
|
||||
| TS-Guard (paper) | 71.58 | 7.27 | 13.20 | 38.14 | 49.76 |
|
||||
| Safiron (paper) | 0.00 | 3.64 | 0.00 | 33.65 | 0.00 |
|
||||
| SEAD-SAGE (Base, paper) | 62.11 | 10.91 | 18.56 | 39.20 | 48.06 |
|
||||
| SEAD-SAGE (paper) | 95.79 | 34.55 | 50.78 | 58.79 | 72.86 |
|
||||
| SEAD-SAGE-4B (released) | 100.00 | 47.27 | 64.20 | 66.43 | 79.83 |
|
||||
| SEAD-SAGE-4B-FP8 (released) | 100.00 | 45.45 | 62.50 | 65.84 | 79.40 |
|
||||
|
||||
| First-block timing | Early | Exact↑ | Late | Miss↓ |
|
||||
|---|---:|---:|---:|---:|
|
||||
| No defense (paper) | 0.00 | 0.00 | 0.00 | 100.00 |
|
||||
| Base Binary (paper) | 63.64 | 0.00 | 1.82 | 34.55 |
|
||||
| Fine-tuned Binary (paper) | 5.45 | 18.18 | 3.64 | 72.73 |
|
||||
| StepGuard (paper) | 41.82 | 12.73 | 1.82 | 43.64 |
|
||||
| TS-Guard (paper) | 78.18 | 7.27 | 0.00 | 14.55 |
|
||||
| Safiron (paper) | 85.45 | 3.64 | 0.00 | 10.91 |
|
||||
| SEAD-SAGE (Base, paper) | 80.00 | 10.91 | 0.00 | 9.09 |
|
||||
| SEAD-SAGE (paper) | 58.18 | 34.55 | 0.00 | 7.27 |
|
||||
| SEAD-SAGE-4B (released) | 29.09 | 47.27 | 3.64 | 20.00 |
|
||||
| SEAD-SAGE-4B-FP8 (released) | 30.91 | 45.45 | 1.82 | 21.82 |
|
||||
|
||||
## Serving benchmark
|
||||
|
||||
OpenAI-compatible vLLM endpoint, 16 prompts, request counts 64/64/128/256 for concurrency 1/8/64/128, zero request errors.
|
||||
|
||||
| Concurrency | Requests | P50 | P95 | Throughput |
|
||||
|---:|---:|---:|---:|---:|
|
||||
| 1 | 64 | 376 ms | 511 ms | 2.53 req/s |
|
||||
| 8 | 64 | 491 ms | 654 ms | 14.80 req/s |
|
||||
| 64 | 128 | 1.322 s | 1.871 s | 40.03 req/s |
|
||||
| 128 | 256 | 2.160 s | 3.296 s | 49.00 req/s |
|
||||
|
||||
## Usage
|
||||
|
||||
Use the prompt construction, investigation loop, JSON extraction, and validation in the SEAD repository. The model emits one structured action per step, ending with `{"action":"submit","decision":"pass|block",...}`. Ordinary text generation is used; provider JSON mode is not required.
|
||||
|
||||
```bash
|
||||
vllm serve EverywhereSafety/SEAD-SAGE-4B \
|
||||
--served-model-name SEAD-SAGE-4B \
|
||||
--dtype bfloat16
|
||||
```
|
||||
|
||||
## Citation
|
||||
|
||||
```bibtex
|
||||
@misc{shen2026sead,
|
||||
title={SEAD: A State-Based Perspective on Attack and Defense in Tool-Using Agents},
|
||||
author={Xinjie Shen and Junran Wang and Rongzhe Wei and Pan Li},
|
||||
year={2026},
|
||||
eprint={2609.34518},
|
||||
archivePrefix={arXiv},
|
||||
primaryClass={cs.CR},
|
||||
url={https://arxiv.org/abs/2609.34518}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,61 @@
|
||||
{%- if tools %}
|
||||
{{- '<|im_start|>system\n' }}
|
||||
{%- if messages[0].role == 'system' %}
|
||||
{{- messages[0].content + '\n\n' }}
|
||||
{%- endif %}
|
||||
{{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
||||
{%- for tool in tools %}
|
||||
{{- "\n" }}
|
||||
{{- tool | tojson }}
|
||||
{%- endfor %}
|
||||
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
||||
{%- else %}
|
||||
{%- if messages[0].role == 'system' %}
|
||||
{{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- for message in messages %}
|
||||
{%- if message.content is string %}
|
||||
{%- set content = message.content %}
|
||||
{%- else %}
|
||||
{%- set content = '' %}
|
||||
{%- endif %}
|
||||
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
||||
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
||||
{%- elif message.role == "assistant" %}
|
||||
{{- '<|im_start|>' + message.role + '\n' + content }}
|
||||
{%- if message.tool_calls %}
|
||||
{%- for tool_call in message.tool_calls %}
|
||||
{%- if (loop.first and content) or (not loop.first) %}
|
||||
{{- '\n' }}
|
||||
{%- endif %}
|
||||
{%- if tool_call.function %}
|
||||
{%- set tool_call = tool_call.function %}
|
||||
{%- endif %}
|
||||
{{- '<tool_call>\n{"name": "' }}
|
||||
{{- tool_call.name }}
|
||||
{{- '", "arguments": ' }}
|
||||
{%- if tool_call.arguments is string %}
|
||||
{{- tool_call.arguments }}
|
||||
{%- else %}
|
||||
{{- tool_call.arguments | tojson }}
|
||||
{%- endif %}
|
||||
{{- '}\n</tool_call>' }}
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{{- '<|im_end|>\n' }}
|
||||
{%- elif message.role == "tool" %}
|
||||
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
||||
{{- '<|im_start|>user' }}
|
||||
{%- endif %}
|
||||
{{- '\n<tool_response>\n' }}
|
||||
{{- content }}
|
||||
{{- '\n</tool_response>' }}
|
||||
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
||||
{{- '<|im_end|>\n' }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- if add_generation_prompt %}
|
||||
{{- '<|im_start|>assistant\n' }}
|
||||
{%- endif %}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"architectures": [
|
||||
"Qwen3ForCausalLM"
|
||||
],
|
||||
"attention_bias": false,
|
||||
"attention_dropout": 0.0,
|
||||
"bos_token_id": 151643,
|
||||
"dtype": "float32",
|
||||
"eos_token_id": 151645,
|
||||
"head_dim": 128,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 2560,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 9728,
|
||||
"layer_types": [
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention",
|
||||
"full_attention"
|
||||
],
|
||||
"max_position_embeddings": 262144,
|
||||
"max_window_layers": 36,
|
||||
"model_type": "qwen3",
|
||||
"num_attention_heads": 32,
|
||||
"num_hidden_layers": 36,
|
||||
"num_key_value_heads": 8,
|
||||
"pad_token_id": null,
|
||||
"rms_norm_eps": 1e-06,
|
||||
"rope_parameters": {
|
||||
"rope_theta": 5000000,
|
||||
"rope_type": "default"
|
||||
},
|
||||
"sliding_window": null,
|
||||
"tie_word_embeddings": true,
|
||||
"transformers_version": "5.17.0",
|
||||
"use_cache": false,
|
||||
"use_sliding_window": false,
|
||||
"vocab_size": 151936
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"bos_token_id": 151643,
|
||||
"do_sample": true,
|
||||
"eos_token_id": [
|
||||
151645,
|
||||
151643
|
||||
],
|
||||
"pad_token_id": 151643,
|
||||
"temperature": 0.7,
|
||||
"top_k": 20,
|
||||
"top_p": 0.8,
|
||||
"transformers_version": "5.17.0"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:fbbacc2895a7e5fe621259596697d9a12d11551ef317ab61492a3b4485e62e4a
|
||||
size 17645743048
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:be75606093db2094d7cd20f3c2f385c212750648bd6ea4fb2bf507a6a4c55506
|
||||
size 11422650
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"add_prefix_space": false,
|
||||
"backend": "tokenizers",
|
||||
"bos_token": null,
|
||||
"clean_up_tokenization_spaces": false,
|
||||
"eos_token": "<|im_end|>",
|
||||
"errors": "replace",
|
||||
"extra_special_tokens": [
|
||||
"<|im_start|>",
|
||||
"<|im_end|>",
|
||||
"<|object_ref_start|>",
|
||||
"<|object_ref_end|>",
|
||||
"<|box_start|>",
|
||||
"<|box_end|>",
|
||||
"<|quad_start|>",
|
||||
"<|quad_end|>",
|
||||
"<|vision_start|>",
|
||||
"<|vision_end|>",
|
||||
"<|vision_pad|>",
|
||||
"<|image_pad|>",
|
||||
"<|video_pad|>"
|
||||
],
|
||||
"is_local": true,
|
||||
"local_files_only": false,
|
||||
"model_max_length": 1010000,
|
||||
"pad_token": "<|endoftext|>",
|
||||
"split_special_tokens": false,
|
||||
"tokenizer_class": "Qwen2Tokenizer",
|
||||
"unk_token": null
|
||||
}
|
||||
Reference in new issue
Block a user