Instructions to use lalalamdbf/AgentSafeEvo-Defender-Qwen3-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lalalamdbf/AgentSafeEvo-Defender-Qwen3-8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="lalalamdbf/AgentSafeEvo-Defender-Qwen3-8B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("lalalamdbf/AgentSafeEvo-Defender-Qwen3-8B") model = AutoModelForCausalLM.from_pretrained("lalalamdbf/AgentSafeEvo-Defender-Qwen3-8B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use lalalamdbf/AgentSafeEvo-Defender-Qwen3-8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lalalamdbf/AgentSafeEvo-Defender-Qwen3-8B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lalalamdbf/AgentSafeEvo-Defender-Qwen3-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/lalalamdbf/AgentSafeEvo-Defender-Qwen3-8B
- SGLang
How to use lalalamdbf/AgentSafeEvo-Defender-Qwen3-8B 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 "lalalamdbf/AgentSafeEvo-Defender-Qwen3-8B" \ --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": "lalalamdbf/AgentSafeEvo-Defender-Qwen3-8B", "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 "lalalamdbf/AgentSafeEvo-Defender-Qwen3-8B" \ --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": "lalalamdbf/AgentSafeEvo-Defender-Qwen3-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use lalalamdbf/AgentSafeEvo-Defender-Qwen3-8B with Docker Model Runner:
docker model run hf.co/lalalamdbf/AgentSafeEvo-Defender-Qwen3-8B
AgentSafeEvo-Qwen3-8B-Defender
This is the defender in AgentSafeEvo: Adversarial Co-Evolution for LLM Agent Safety. It is based on Qwen3-8B and trained to complete legitimate tool-use tasks while resisting harmful instructions from users and tools.
Training
The defender starts from the original Qwen3-8B model and is jointly trained with an evolving attacker using Group Relative Policy Optimization (GRPO). Its reward combines safety and legitimate task completion. Learnability-guided task weighting scales both policies' normalized advantages using within-task defender-reward variability.
Input and output
Input: system instructions, a user query, available tool definitions, and interaction history. Output: native tool calls and assistant responses across a multi-turn interaction.
Evaluation
Reported mean ± standard deviation over three runs. Lower ASR and harm score are better; higher UA, NRP, and accuracy are better.
| Benchmark | Metric | Original Qwen3-8B | AgentSafeEvo defender |
|---|---|---|---|
| Agent-SafetyBench | ASR (%) | 49.11 ± 0.51 | 17.84 ± 0.24 |
| AgentHarm | Harm score | 50.37 ± 3.63 | 6.53 ± 0.38 |
| AgentDojo | ASR (%) | 22.20 ± 0.57 | 6.18 ± 0.18 |
| AgentDojo | UA (%) | 53.64 ± 0.90 | 66.52 ± 1.43 |
| MSB | ASR (%) | 60.43 ± 0.97 | 31.25 ± 1.24 |
| MSB | NRP | 28.12 ± 1.30 | 46.00 ± 0.54 |
| BFCL-V3 | Accuracy (%) | 66.13 ± 0.22 | 65.98 ± 0.14 |
| ALFWorld | Accuracy (%) | 30.28 ± 4.59 | 43.72 ± 3.03 |
| ToolHop | Accuracy (%) | 21.84 ± 1.23 | 48.04 ± 1.40 |
UA denotes Utility under Attack; NRP denotes Net Resilient Performance.
Intended use and limitations
Intended for agent safety research and tool-use evaluation. The model can still follow harmful instructions or fail legitimate tasks. Results depend on the prompts, tools, and evaluation setup; application runtimes remain responsible for tool permissions and execution.
License
The Qwen3-8B base model is released under Apache-2.0. Refer to the checkpoint repository for the fine-tuned weights' license.
- Downloads last month
- 215