Text Generation
Transformers
Safetensors
qwen3_5
image-text-to-text
agent-safety
guardrail
agentdog
long-horizon
conversational
Instructions to use AI45Research/AgentDoG-Step-Qwen3.5-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AI45Research/AgentDoG-Step-Qwen3.5-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AI45Research/AgentDoG-Step-Qwen3.5-4B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("AI45Research/AgentDoG-Step-Qwen3.5-4B") model = AutoModelForMultimodalLM.from_pretrained("AI45Research/AgentDoG-Step-Qwen3.5-4B", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AI45Research/AgentDoG-Step-Qwen3.5-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AI45Research/AgentDoG-Step-Qwen3.5-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AI45Research/AgentDoG-Step-Qwen3.5-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AI45Research/AgentDoG-Step-Qwen3.5-4B
- SGLang
How to use AI45Research/AgentDoG-Step-Qwen3.5-4B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "AI45Research/AgentDoG-Step-Qwen3.5-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AI45Research/AgentDoG-Step-Qwen3.5-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "AI45Research/AgentDoG-Step-Qwen3.5-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AI45Research/AgentDoG-Step-Qwen3.5-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use AI45Research/AgentDoG-Step-Qwen3.5-4B with Docker Model Runner:
docker model run hf.co/AI45Research/AgentDoG-Step-Qwen3.5-4B
Complete AgentDoG 2.0 documentation and align project title
Browse files
README.md
CHANGED
|
@@ -8,18 +8,110 @@ tags:
|
|
| 8 |
- agent-safety
|
| 9 |
- guardrail
|
| 10 |
- safetensors
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
-
# AgentDoG
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
and the risk source. Unsafe actions also receive a failure mode and risk consequence.
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
Serve the model with vLLM.
|
| 25 |
|
|
@@ -34,7 +126,7 @@ hf download AI45Research/AgentDoG-Step-Qwen3.5-4B step_inference.py safety-rs.tx
|
|
| 34 |
cd ./step-example
|
| 35 |
```
|
| 36 |
|
| 37 |
-
Send the example as a single user message. Use the [input schema](input.schema.json)
|
| 38 |
to format your own cases, including only evidence available at the decision point.
|
| 39 |
|
| 40 |
```python
|
|
@@ -62,20 +154,171 @@ with urlopen(request, timeout=180) as response:
|
|
| 62 |
print(parse_response(answer))
|
| 63 |
```
|
| 64 |
|
| 65 |
-
## Evaluation
|
| 66 |
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
| --- | ---: | ---: | ---: |
|
| 71 |
-
|
|
| 72 |
-
|
|
| 73 |
-
|
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
-
|
| 77 |
-
across the three benchmarks.
|
| 78 |
|
| 79 |
-
##
|
| 80 |
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
- agent-safety
|
| 9 |
- guardrail
|
| 10 |
- safetensors
|
| 11 |
+
- agentdog
|
| 12 |
+
- long-horizon
|
| 13 |
---
|
| 14 |
|
| 15 |
+
# AgentDoG 2.0: An Efficient Alignment Framework for Emergent Risk in Long-Horizon Agent Tasks
|
| 16 |
|
| 17 |
+
<p align="center">
|
| 18 |
+
<img src="https://mjc-ma-01.github.io/AgentDoG/v2_0_dark/assets/family.webp" width="95%" alt="AgentDoG 2.0, AgentDoG-Jev and AgentDoG-Step family overview" />
|
| 19 |
+
</p>
|
|
|
|
| 20 |
|
| 21 |
+
<p align="center">
|
| 22 |
+
🐙 <a href="https://github.com/AI45Lab/AgentDoG"><b>GitHub</b></a> |
|
| 23 |
+
🤗 <a href="https://huggingface.co/collections/AI45Research/agentdog20-6b09556a028a2ce10c53f2fe"><b>Models and Datasets</b></a> |
|
| 24 |
+
🌐 <a href="https://mjc-ma-01.github.io/AgentDoG/v2_0_dark/"><b>Project Page</b></a> |
|
| 25 |
+
🎬 <a href="https://mjc-ma-01.github.io/AgentDoG/v2_0_dark/#demos"><b>Demos</b></a> |
|
| 26 |
+
📊 <a href="https://mjc-ma-01.github.io/AgentDoG/v2_0_dark/#benchmarks"><b>Benchmarks</b></a> |
|
| 27 |
+
🛡️ <a href="https://mjc-ma-01.github.io/AgentDoG/v2_0_dark/#evolution"><b>SafeRSI</b></a>
|
| 28 |
+
</p>
|
| 29 |
|
| 30 |
+
**This repository:** [`AI45Research/AgentDoG-Step-Qwen3.5-4B`](https://huggingface.co/AI45Research/AgentDoG-Step-Qwen3.5-4B)<br>
|
| 31 |
+
**Role:** Pre-execution guard for a candidate action and the visible interaction history.<br>
|
| 32 |
+
**Published artifacts:** model weights, configuration and tokenizer.
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
## 📌 Introduction
|
| 36 |
+
|
| 37 |
+
**AgentDoG 2.0** is an efficient framework from **Shanghai Artificial Intelligence Laboratory** for characterizing, evaluating and mitigating emergent safety risks in long-horizon agent tasks. It connects a diagnostic risk taxonomy, long-horizon safety benchmarks, efficient trajectory and action guardrails, and data-driven defense evolution.
|
| 38 |
+
|
| 39 |
+
- 🧩 **An expanded taxonomy for long-horizon risk.** Diagnose **18 risk sources, 21 failure modes and 11 real-world harms**, including covert goal manipulation, authority and obligation violations, and loss of control.
|
| 40 |
+
- 📊 **Two complementary benchmarks.** **ATBench-Pro** evaluates complete long-horizon trajectories; **ManipulationArena** tests covert goal manipulation through reusable attack plans adapted to live agent execution.
|
| 41 |
+
- 🛡️ **A family of efficient guardrails.** **AgentDoG 2.0** generates structured trajectory judgments; **AgentDoG-Jev** reads decisions in one forward pass; **AgentDoG-Step** evaluates the next action before execution.
|
| 42 |
+
- 🔁 **SafeRSI.** Improve the execution harness and task-completion policy using attributed failures, and add AgentDoG-Step runtime intervention. Evaluate safety and benign task utility together.
|
| 43 |
+
|
| 44 |
+
## 📦 Released Models
|
| 45 |
+
|
| 46 |
+
The following public repositories contain model weights, configurations and tokenizers. Select the repository for the task you need; the families use different inference interfaces.
|
| 47 |
+
|
| 48 |
+
### AgentDoG 2.0: structured trajectory diagnosis
|
| 49 |
+
|
| 50 |
+
| Checkpoint | Role | Size | Base checkpoint |
|
| 51 |
+
| --- | ---: | ---: | ---: |
|
| 52 |
+
| [AgentDoG2.0-Qwen3.5-0.8B](https://huggingface.co/AI45Research/AgentDoG2.0-Qwen3.5-0.8B) | Generative trajectory diagnosis | 0.8B | [Qwen/Qwen3.5-0.8B-Base](https://huggingface.co/Qwen/Qwen3.5-0.8B-Base) |
|
| 53 |
+
| [AgentDoG2.0-Qwen3.5-2B](https://huggingface.co/AI45Research/AgentDoG2.0-Qwen3.5-2B) | Generative trajectory diagnosis | 2B | [Qwen/Qwen3.5-2B-Base](https://huggingface.co/Qwen/Qwen3.5-2B-Base) |
|
| 54 |
+
| [AgentDoG2.0-Qwen3.5-4B](https://huggingface.co/AI45Research/AgentDoG2.0-Qwen3.5-4B) | Generative trajectory diagnosis | 4B | [Qwen/Qwen3.5-4B-Base](https://huggingface.co/Qwen/Qwen3.5-4B-Base) |
|
| 55 |
+
| [Llama-3.1-AgentDoG2.0-8B](https://huggingface.co/AI45Research/Llama-3.1-AgentDoG2.0-8B) | Generative trajectory diagnosis | 8B | [meta-llama/Llama-3.1-8B](https://huggingface.co/meta-llama/Llama-3.1-8B) |
|
| 56 |
+
| [AgentDoG2.0-Qwen3.5-9B](https://huggingface.co/AI45Research/AgentDoG2.0-Qwen3.5-9B) | Generative trajectory diagnosis | 9B | [Qwen/Qwen3.5-9B-Base](https://huggingface.co/Qwen/Qwen3.5-9B-Base) |
|
| 57 |
+
|
| 58 |
+
### AgentDoG-Jev: single-pass trajectory evaluation
|
| 59 |
+
|
| 60 |
+
| Checkpoint | Role | Size | Base checkpoint |
|
| 61 |
+
| --- | ---: | ---: | ---: |
|
| 62 |
+
| [AgentDoG-Jev-Qwen3.5-0.8B](https://huggingface.co/AI45Research/AgentDoG-Jev-Qwen3.5-0.8B) | Single-pass binary safety judgment | 0.8B | [AI45Research/AgentDoG1.5-Qwen3.5-0.8B](https://huggingface.co/AI45Research/AgentDoG1.5-Qwen3.5-0.8B) |
|
| 63 |
+
| [AgentDoG-Jev-Qwen3.5-4B](https://huggingface.co/AI45Research/AgentDoG-Jev-Qwen3.5-4B) | Single-pass binary safety judgment | 4B | [AI45Research/AgentDoG1.5-Qwen3.5-4B](https://huggingface.co/AI45Research/AgentDoG1.5-Qwen3.5-4B) |
|
| 64 |
+
| [AgentDoG-Jev-Qwen3.5-4B-U](https://huggingface.co/AI45Research/AgentDoG-Jev-Qwen3.5-4B-U) | Single-pass binary safety judgment | 4B | [AI45Research/AgentDoG1.5-Unified-Qwen3.5-4B](https://huggingface.co/AI45Research/AgentDoG1.5-Unified-Qwen3.5-4B) |
|
| 65 |
+
| [AgentDoG-Jev-Qwen3.5-2B](https://huggingface.co/AI45Research/AgentDoG-Jev-Qwen3.5-2B) | Single-pass binary safety judgment | 2B | [AI45Research/AgentDoG1.5-Qwen3.5-2B](https://huggingface.co/AI45Research/AgentDoG1.5-Qwen3.5-2B) |
|
| 66 |
+
| [Llama-3.1-AgentDoG-Jev-8B](https://huggingface.co/AI45Research/Llama-3.1-AgentDoG-Jev-8B) | Single-pass binary safety judgment | 8B | [AI45Research/AgentDoG1.5-Llama-3.1-8B](https://huggingface.co/AI45Research/AgentDoG1.5-Llama-3.1-8B) |
|
| 67 |
+
| [AgentDoG-Jev-FG-Qwen3.5-0.8B](https://huggingface.co/AI45Research/AgentDoG-Jev-FG-Qwen3.5-0.8B) | Single-pass fine-grained diagnosis | 0.8B | [AI45Research/AgentDoG1.5-FG-Qwen3.5-0.8B](https://huggingface.co/AI45Research/AgentDoG1.5-FG-Qwen3.5-0.8B) |
|
| 68 |
+
| [AgentDoG-Jev-FG-Qwen3.5-2B](https://huggingface.co/AI45Research/AgentDoG-Jev-FG-Qwen3.5-2B) | Single-pass fine-grained diagnosis | 2B | [AI45Research/AgentDoG1.5-FG-Qwen3.5-2B](https://huggingface.co/AI45Research/AgentDoG1.5-FG-Qwen3.5-2B) |
|
| 69 |
+
| [AgentDoG-Jev-FG-Qwen3.5-4B](https://huggingface.co/AI45Research/AgentDoG-Jev-FG-Qwen3.5-4B) | Single-pass fine-grained diagnosis | 4B | [AI45Research/AgentDoG1.5-FG-Qwen3.5-4B](https://huggingface.co/AI45Research/AgentDoG1.5-FG-Qwen3.5-4B) |
|
| 70 |
+
| [Llama-3.1-AgentDoG-Jev-FG-8B](https://huggingface.co/AI45Research/Llama-3.1-AgentDoG-Jev-FG-8B) | Single-pass fine-grained diagnosis | 8B | [AI45Research/AgentDoG1.5-FG-Llama-3.1-8B](https://huggingface.co/AI45Research/AgentDoG1.5-FG-Llama-3.1-8B) |
|
| 71 |
+
|
| 72 |
+
The `4B-U` variant is derived from the unified 1.5 checkpoint; the exported decision mapping in the 4B-U repository supports binary judgment. `FG` repositories provide fine-grained diagnostic readouts. Use each repository's own prompt and decision-token map rather than interchanging them.
|
| 73 |
+
|
| 74 |
+
### AgentDoG-Step: pre-execution protection
|
| 75 |
+
|
| 76 |
+
| Checkpoint | Role | Size | Base checkpoint |
|
| 77 |
+
| --- | ---: | ---: | ---: |
|
| 78 |
+
| [AgentDoG-Step-Qwen3.5-0.8B](https://huggingface.co/AI45Research/AgentDoG-Step-Qwen3.5-0.8B) | Pre-execution action assessment | 0.8B | [Qwen/Qwen3.5-0.8B-Base](https://huggingface.co/Qwen/Qwen3.5-0.8B-Base) |
|
| 79 |
+
| [AgentDoG-Step-Qwen3.5-2B](https://huggingface.co/AI45Research/AgentDoG-Step-Qwen3.5-2B) | Pre-execution action assessment | 2B | [Qwen/Qwen3.5-2B-Base](https://huggingface.co/Qwen/Qwen3.5-2B-Base) |
|
| 80 |
+
| [AgentDoG-Step-Qwen3.5-4B](https://huggingface.co/AI45Research/AgentDoG-Step-Qwen3.5-4B) | Pre-execution action assessment | 4B | [Qwen/Qwen3.5-4B-Base](https://huggingface.co/Qwen/Qwen3.5-4B-Base) |
|
| 81 |
+
| [Llama-3.1-8B-AgentDoG-Step](https://huggingface.co/AI45Research/Llama-3.1-8B-AgentDoG-Step) | Pre-execution action assessment | 8B | [meta-llama/Llama-3.1-8B](https://huggingface.co/meta-llama/Llama-3.1-8B) |
|
| 82 |
+
| [AgentDoG-Step-Qwen3.5-9B](https://huggingface.co/AI45Research/AgentDoG-Step-Qwen3.5-9B) | Pre-execution action assessment | 9B | [Qwen/Qwen3.5-9B-Base](https://huggingface.co/Qwen/Qwen3.5-9B-Base) |
|
| 83 |
+
|
| 84 |
+
### SafeRSI: evolved task-completion policies
|
| 85 |
+
|
| 86 |
+
| Checkpoint | Role | Size | Base checkpoint |
|
| 87 |
+
| --- | ---: | ---: | ---: |
|
| 88 |
+
| [SafeRSI-27B-V1](https://huggingface.co/AI45Research/SafeRSI-27B-V1) | Evolved task-completion policy | 27B | Not declared in repository metadata |
|
| 89 |
+
| [SafeRSI-27B-V2](https://huggingface.co/AI45Research/SafeRSI-27B-V2) | Evolved task-completion policy | 27B | Not declared in repository metadata |
|
| 90 |
+
|
| 91 |
+
SafeRSI weights are the **policy component** of the defense framework. The full evaluation configuration also specifies an evolved harness and, where stated, AgentDoG-Step; downloading a policy checkpoint alone does not reproduce that complete system.
|
| 92 |
+
|
| 93 |
+
## 🎯 Tasks and Taxonomy
|
| 94 |
+
|
| 95 |
+
| Family | Input | Inference | Output and use |
|
| 96 |
+
| --- | --- | --- | --- |
|
| 97 |
+
| AgentDoG 2.0 | Complete observed execution trajectory | Structured generation | Safety verdict and risk source; unsafe cases also receive failure-mode and harm diagnoses |
|
| 98 |
+
| AgentDoG-Jev | Trajectory formatted with the repository's decision schema | One forward pass at mapped decision positions | Binary safety labels, or fine-grained labels for `FG` checkpoints |
|
| 99 |
+
| AgentDoG-Step | Visible interaction history and the proposed next action | Pre-execution generation | Short rationale, Safe/Unsafe verdict and risk source; unsafe cases also receive failure-mode and harm diagnoses |
|
| 100 |
+
| SafeRSI | Task and model-visible agent history | Task-completion policy | Actions or responses from an evolved policy; not an independent guardrail verdict |
|
| 101 |
+
|
| 102 |
+
The taxonomy separates **where a risk originates**, **how the agent fails**, and **what harm can follow**. A malicious input by itself does not make the agent unsafe: judge how the agent handles it and what behavior it actually executes. For Step assessment, include only the evidence available before the candidate action; future observations would leak the outcome.
|
| 103 |
+
|
| 104 |
+
<p align="center">
|
| 105 |
+
<img src="https://mjc-ma-01.github.io/AgentDoG/v2_0_dark/assets/taxonomy.webp" width="95%" alt="Expanded AgentDoG 2.0 taxonomy: 18 risk sources, 21 failure modes and 11 harms" />
|
| 106 |
+
</p>
|
| 107 |
+
|
| 108 |
+
## 🧾 Input Formatting and Quickstart
|
| 109 |
+
|
| 110 |
+
This example requires a GPU environment and a vLLM build supporting `Qwen3_5ForConditionalGeneration` (or `LlamaForCausalLM` for the Llama checkpoint) and the documented `--language-model-only` option. Install the serving runtime and HF CLI before running the commands below:
|
| 111 |
+
|
| 112 |
+
```bash
|
| 113 |
+
python -m pip install -U vllm huggingface_hub
|
| 114 |
+
```
|
| 115 |
|
| 116 |
Serve the model with vLLM.
|
| 117 |
|
|
|
|
| 126 |
cd ./step-example
|
| 127 |
```
|
| 128 |
|
| 129 |
+
Send the example as a single user message. Use the [input schema](https://huggingface.co/AI45Research/AgentDoG-Step-Qwen3.5-4B/blob/main/input.schema.json)
|
| 130 |
to format your own cases, including only evidence available at the decision point.
|
| 131 |
|
| 132 |
```python
|
|
|
|
| 154 |
print(parse_response(answer))
|
| 155 |
```
|
| 156 |
|
|
|
|
| 157 |
|
| 158 |
+
### Choose the matching interface
|
| 159 |
+
|
| 160 |
+
- **Base trajectory guard:** use the supplied `inference.py`, `prompt.txt` and trajectory example. The script handles Qwen and Llama prompt formatting and selects the matching model architecture. A separate `prompt-atbench-pro.txt` supports the benchmark-specific label interface.
|
| 161 |
+
- **Jev:** use the supplied `inference.py` together with `decision_token_map.json`. The script scores candidate label tokens at designated decision positions. Standard autoregressive `generate()` is not equivalent to this inference method. Fine-grained repositories also supply the ATBench-Pro label map and prompt.
|
| 162 |
+
- **Step:** use `step_inference.py`, `input.schema.json`, `taxonomy.json`, `safety-rs.txt` and `example.json`. The helper renders the history and candidate action into the prompt, then parses the guard's structured response.
|
| 163 |
+
- **SafeRSI:** load the published policy using its configuration and tokenizer. The policy repositories do not currently include a complete harness or a dedicated inference helper. Preserve the intended task and safety constraints when integrating the policy into an agent runtime.
|
| 164 |
+
|
| 165 |
+
**Example interpretation (illustrative, not a measured model trace).** A user asks an agent to inspect a single order. Before the agent calls a tool that exports every customer's records to a third-party endpoint, AgentDoG-Step receives the visible history and that proposed export. The evaluation should check authorization, the requested scope and the destination before the export executes. A safer continuation would preserve the single-order task while avoiding the unrequested bulk transfer.
|
| 166 |
+
|
| 167 |
+
### Reading the output
|
| 168 |
+
|
| 169 |
+
Use the exact labels and parser supplied with the selected checkpoint. The expanded 2.0 taxonomy and legacy fine-grained label interfaces are not interchangeable. Do not assume that every repository emits the same field names or label vocabulary. Jev label scores are decision readouts; they are not demonstrated calibrated probabilities.
|
| 170 |
+
|
| 171 |
+
## 📊 Performance
|
| 172 |
+
|
| 173 |
+
All values below reproduce the active tables in the updated technical manuscript. **Accuracy, unsafe F1 and worst-class recall are distinct metrics.** Latency is guardrail decision latency under the stated benchmark setting, not complete agent task runtime.
|
| 174 |
+
|
| 175 |
+
### AgentDoG 2.0 trajectory safety
|
| 176 |
+
|
| 177 |
+
| Model | R-Judge Acc (%) | R-Judge F1 (%) | ATBench Acc (%) | ATBench F1 (%) | ATBench-Pro Acc (%) | ATBench-Pro F1 (%) |
|
| 178 |
+
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
|
| 179 |
+
| AgentDoG 2.0 0.8B | 76.6 | 71.7 | 76.3 | 76.1 | 75.4 | 58.6 |
|
| 180 |
+
| AgentDoG 2.0 2B | 80.1 | 79.9 | 80.3 | 81.7 | 78.3 | 69.4 |
|
| 181 |
+
| AgentDoG 2.0 4B | 83.3 | 83.3 | 78.1 | 76.7 | 80.3 | 69.7 |
|
| 182 |
+
| AgentDoG 2.0 8B | 78.4 | 74.5 | 73.5 | 75.3 | 81.0 | 71.8 |
|
| 183 |
+
| AgentDoG 2.0 9B | 88.8 | 88.8 | 77.5 | 76.3 | 78.4 | 64.2 |
|
| 184 |
+
|
| 185 |
+
F1 is the unsafe-class F1 score. Higher is better.
|
| 186 |
|
| 187 |
+
### Fine-grained trajectory diagnosis
|
| 188 |
+
|
| 189 |
+
| Model | ATBench RS | FM | Harm | Mean | ATBench-Pro RS | FM | Harm | Mean |
|
| 190 |
+
| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
|
| 191 |
+
| AgentDoG 2.0 0.8B | 51.7 | 18.3 | 45.5 | 38.5 | 29.2 | 30.3 | 37.6 | 32.3 |
|
| 192 |
+
| AgentDoG 2.0 2B | 59.8 | 21.5 | 52.9 | 44.7 | 36.4 | 37.5 | 50.2 | 41.4 |
|
| 193 |
+
| AgentDoG 2.0 4B | 61.8 | 16.1 | 46.9 | 41.6 | 39.7 | 38.3 | 47.7 | 41.9 |
|
| 194 |
+
| AgentDoG 2.0 8B | 61.2 | 20.5 | 50.7 | 44.1 | 28.4 | 34.5 | 46.1 | 36.3 |
|
| 195 |
+
| AgentDoG 2.0 9B | 61.2 | 19.9 | 45.9 | 42.3 | 36.7 | 35.0 | 44.5 | 38.7 |
|
| 196 |
+
|
| 197 |
+
All values are accuracies (%), higher is better, evaluated on **unsafe trajectories**. RS = risk source; FM = failure mode; Harm = real-world harm. Mean is the unweighted mean of the three diagnostic accuracies.
|
| 198 |
+
|
| 199 |
+
### AgentDoG-Jev efficiency
|
| 200 |
+
|
| 201 |
+
| Checkpoint / benchmark | Binary decision latency | Unsafe F1 (%) |
|
| 202 |
+
| --- | ---: | ---: |
|
| 203 |
+
| Jev 4B-U / ATBench | 59.8 ms | 77.90 |
|
| 204 |
+
| Jev 4B / ATBench-Pro | 1.465 s | 68.94 |
|
| 205 |
+
|
| 206 |
+
On ATBench binary judgment, Jev reports **103.9–184.9×** lower latency than its matched generative AgentDoG 1.5 variants. Fine-grained diagnosis reports **4.4–13.4×** speedups on ATBench and **1.64–8.88×** on ATBench-Pro. These are benchmark- and checkpoint-specific speed/accuracy trade-offs, not a universal speedup for every task. Latencies were measured on a single H200 with concurrency 1 and prefix caching disabled.
|
| 207 |
+
|
| 208 |
+
<p align="center">
|
| 209 |
+
<img src="https://mjc-ma-01.github.io/AgentDoG/v2_0_dark/assets/jev-latency.webp" width="95%" alt="Matched Jev and AgentDoG 1.5 latency comparisons on ATBench and ATBench-Pro" />
|
| 210 |
+
</p>
|
| 211 |
+
|
| 212 |
+
### AgentDoG-Step pre-execution safety
|
| 213 |
+
|
| 214 |
+
| Model | Mean accuracy (%) | Mean unsafe F1 (%) | Mean WCR (%) |
|
| 215 |
| --- | ---: | ---: | ---: |
|
| 216 |
+
| AgentDoG-Step 0.8B | 88.3 | 71.1 | 77.8 |
|
| 217 |
+
| AgentDoG-Step 2B | 93.4 | 82.2 | 86.2 |
|
| 218 |
+
| AgentDoG-Step 4B | 94.7 | 87.5 | 94.0 |
|
| 219 |
+
| AgentDoG-Step 8B | 93.7 | 80.8 | 88.4 |
|
| 220 |
+
| AgentDoG-Step 9B | 92.9 | 84.5 | 90.2 |
|
| 221 |
+
|
| 222 |
+
WCR is the lower of safe-class recall and unsafe-class recall within each benchmark. Overall values are the unweighted mean across **TS-Bench-Dojo, TS-Bench-ASB and StepShield (pre-action)**. Step 4B reports **94.7% accuracy, 87.5% unsafe F1 and 94.0% WCR**; these numbers refer to this three-benchmark mean.
|
| 223 |
+
|
| 224 |
+
<p align="center">
|
| 225 |
+
<img src="https://mjc-ma-01.github.io/AgentDoG/v2_0_dark/assets/step-performance.webp" width="95%" alt="Step performance across the three pre-execution benchmarks" />
|
| 226 |
+
</p>
|
| 227 |
+
|
| 228 |
+
## 📚 Benchmarks
|
| 229 |
+
|
| 230 |
+
### ATBench-Pro
|
| 231 |
+
|
| 232 |
+
ATBench-Pro evaluates full long-horizon trajectories in which safety depends on earlier evidence, evolving permissions, persistent state and downstream obligations. The updated manuscript reports **1,000 cases**, averaging **48.98 tool calls** and **57.51k tokens** per trajectory.
|
| 233 |
+
|
| 234 |
+
| Benchmark | Cases | Mean tool calls | Mean tokens |
|
| 235 |
+
| --- | ---: | ---: | ---: |
|
| 236 |
+
| R-Judge | 564 | 1.79 | 0.47k |
|
| 237 |
+
| ASSE-Safety | 1,476 | 1.49 | 0.47k |
|
| 238 |
+
| ASSE-Security | 817 | 1.62 | 0.78k |
|
| 239 |
+
| ATBench500 | 500 | 3.49 | 1.52k |
|
| 240 |
+
| ATBench | 1,000 | 2.97 | 3.95k |
|
| 241 |
+
| HINTBench (v2) | 596 | 6.92† | 4.78k† |
|
| 242 |
+
| ATBench-Pro (Ours) | 1,000 | 48.98 | 57.51k |
|
| 243 |
+
|
| 244 |
+
These are manuscript-reported statistics. k = 1,000 tokens. †HINTBench averages use the 566 publicly released test trajectories, while its reported total is 596 cases.
|
| 245 |
+
|
| 246 |
+
### ManipulationArena
|
| 247 |
+
|
| 248 |
+
ManipulationArena contains **888 reusable attack plans** spanning **7 strategies × 6 channels = 42 attack configurations** across **30 long-horizon tasks**. The plan is adapted to the target agent’s live trajectory during evaluation. Failure modes annotate observed violations after execution rather than defining a third configuration axis.
|
| 249 |
+
|
| 250 |
+
| Benchmark | Cases | Strategies | Channels | Mean interaction length |
|
| 251 |
+
| --- | ---: | ---: | ---: | ---: |
|
| 252 |
+
| AgentDojo | 629 | 4 | 1 | 3.49 steps |
|
| 253 |
+
| AutoControl Arena | 280 | 2 | — | — |
|
| 254 |
+
| AgentLAB | 644 | 5 | 3 | — |
|
| 255 |
+
| SHADE-Arena | 17 | 1 | 1 | ≈25 turns |
|
| 256 |
+
| AgentDyn | 560 | 4 | 1 | 7.10 steps |
|
| 257 |
+
| ManipulationArena | 888 | 7 | 6 | 24.12 turns / 23.35 steps |
|
| 258 |
+
|
| 259 |
+
One **step** is one tool call; one **turn** is one agent response. Means retain these distinct units. — denotes unavailable data. ManipulationArena averages **24.12 turns / 23.35 steps**.
|
| 260 |
+
|
| 261 |
+
<p align="center">
|
| 262 |
+
<img src="https://mjc-ma-01.github.io/AgentDoG/v2_0_dark/assets/benchmark-overview.webp" width="95%" alt="ManipulationArena attack-strategy and channel distributions over 888 cases" />
|
| 263 |
+
</p>
|
| 264 |
+
|
| 265 |
+
See the [benchmark section](https://mjc-ma-01.github.io/AgentDoG/v2_0_dark/#benchmarks) and [Hugging Face collection](https://huggingface.co/collections/AI45Research/agentdog20-6b09556a028a2ce10c53f2fe) for the benchmark entry points.
|
| 266 |
+
|
| 267 |
+
## 🔁 SafeRSI: Harness–Policy Co-Evolution
|
| 268 |
+
|
| 269 |
+
SafeRSI attributes discovered failures and routes improvements to the execution harness, the policy, or both. Harness evolution produces natural-language guidance or deterministic runtime constraints; policy evolution learns corrective continuations synthesized from observed failures. AgentDoG-Step adds periodic runtime assessment.
|
| 270 |
+
|
| 271 |
+
| Harness / policy | Added Step guard | AgentLAB ASR ↓ | AutoControl-Arena ASR ↓ | ManipulationArena ASR ↓ | BFCL-v3 Acc ↑ |
|
| 272 |
+
| --- | ---: | ---: | ---: | ---: | ---: |
|
| 273 |
+
| Claude Code / Opus 5.5 | — | 25.99 | 2.26 | 56.24 | 72.60 |
|
| 274 |
+
| Codex / GPT-6.1-sol | — | 35.76 | 3.59 | 64.59 | 66.70 |
|
| 275 |
+
| DeepSeek Harness / Qwen3.8-27B | — | 35.11 | 13.69 | 65.84 | 75.34 |
|
| 276 |
+
| SafeRSI Harness V1 / SafeRSI-27B V1 | — | 28.66 | 7.62 | 28.04 | 66.72 |
|
| 277 |
+
| SafeRSI Harness V2 / SafeRSI-27B V2 | — | 26.54 | 7.38 | 25.68 | 65.17 |
|
| 278 |
+
| SafeRSI Harness V1 / SafeRSI-27B V1 | AgentDoG-Step | 22.10 | 4.31 | 21.40 | 67.39 |
|
| 279 |
+
| SafeRSI Harness V2 / SafeRSI-27B V2 | AgentDoG-Step | 21.07 | 3.69 | 24.21 | 64.92 |
|
| 280 |
+
|
| 281 |
+
All values are percentages. **ASR** is attack success rate (lower is better); **BFCL-v3 accuracy** measures benign function-calling utility (higher is better). V1/V2 denote the harness and policy after the first/second evolution round. — means without the added AgentDoG-Step guard, not the absence of every other runtime defense.
|
| 282 |
+
|
| 283 |
+
- **V1 + Step** reduces ManipulationArena ASR from **65.84% to 21.40%** against **DeepSeek Harness + Qwen3.8-27B**: **44.44 percentage points**, or **67.50% relative reduction**. BFCL-v3 accuracy changes from **75.34% to 67.39%**, a **7.95-point utility cost**.
|
| 284 |
+
- **V2 + Step** yields lower ASR on AgentLAB and AutoControl-Arena than V1 + Step, while V1 + Step has lower ManipulationArena ASR and higher BFCL-v3 accuracy. V2 does not improve every metric.
|
| 285 |
+
- These are **complete system configurations**. The scores do not isolate the contribution of a downloaded SafeRSI policy checkpoint alone.
|
| 286 |
+
|
| 287 |
+
See [SafeRSI on the project page](https://mjc-ma-01.github.io/AgentDoG/v2_0_dark/#evolution) for the mechanism figures and strategy-level diagnostic results.
|
| 288 |
+
|
| 289 |
+
## ⚠️ Intended Use and Limitations
|
| 290 |
+
|
| 291 |
+
- Use guard predictions to support trajectory review and pre-execution intervention in the documented agent setting. They can miss unsafe behavior or flag safe behavior; evaluate them in the target workflow and measure both safety and utility.
|
| 292 |
+
- Preserve tool specifications, permissions, user intent and relevant observations when formatting an input. Truncating a long trajectory can remove decisive evidence.
|
| 293 |
+
- Step assessment must not include future execution results. A candidate action should be assessed before it changes the environment.
|
| 294 |
+
- Fine-grained evaluation depends on the benchmark’s label interface. Follow the repository’s supplied prompt and mapping rather than borrowing a 1.5 template unchanged.
|
| 295 |
+
- Model and benchmark rankings are specific to the reported settings. Neither low ASR nor a guard verdict establishes that an entire deployment is safe.
|
| 296 |
+
- The example above is conceptual. The project-page videos reconstruct failures and do not demonstrate live AgentDoG interception.
|
| 297 |
+
|
| 298 |
+
## 📜 License
|
| 299 |
+
|
| 300 |
+
This checkpoint is released under the [Apache License 2.0](https://huggingface.co/AI45Research/AgentDoG-Step-Qwen3.5-4B/blob/main/LICENSE), as declared by this repository. See the repository license and notices for its terms.
|
| 301 |
+
|
| 302 |
+
## 📖 Citation
|
| 303 |
+
|
| 304 |
+
Project reference (software/repository citation):
|
| 305 |
+
|
| 306 |
+
```bibtex
|
| 307 |
+
@software{agentdog20,
|
| 308 |
+
title = {AgentDoG 2.0: An Efficient Alignment Framework for Emergent Risk in Long-Horizon Agent Tasks},
|
| 309 |
+
author = {{Shanghai Artificial Intelligence Laboratory}},
|
| 310 |
+
year = {2026},
|
| 311 |
+
url = {https://github.com/AI45Lab/AgentDoG}
|
| 312 |
+
}
|
| 313 |
+
```
|
| 314 |
|
| 315 |
+
This entry identifies the project; it does not assign an arXiv identifier or DOI to the 2.0 technical report. A verified report citation can replace it when available.
|
|
|
|
| 316 |
|
| 317 |
+
## 🔗 Resources
|
| 318 |
|
| 319 |
+
- [Source code](https://github.com/AI45Lab/AgentDoG)
|
| 320 |
+
- [AgentDoG 2.0 collection](https://huggingface.co/collections/AI45Research/agentdog20-6b09556a028a2ce10c53f2fe)
|
| 321 |
+
- [Dark project page](https://mjc-ma-01.github.io/AgentDoG/v2_0_dark/)
|
| 322 |
+
- [Benchmarks](https://mjc-ma-01.github.io/AgentDoG/v2_0_dark/#benchmarks)
|
| 323 |
+
- [SafeRSI](https://mjc-ma-01.github.io/AgentDoG/v2_0_dark/#evolution)
|
| 324 |
+
- [Featured demos](https://mjc-ma-01.github.io/AgentDoG/v2_0_dark/#demos)
|