SkillPoison 研究经过验证的成功经验如何毒害自我改进的 LLM 智能体所习得的持久技能。 它结合了分层任务选择(Hierarchical Task Selection)、局部证据归因(Local Evidence-Grounded Attribution)和跨经验归纳强化(Cross-Experience Inductive Reinforcement),将局部有效的行为强化到超出其原始适用条件的范围。 原始任务执行和验证结果保持不变;归因证据作为元数据附加,用于原生技能形成。 在三个基准测试中,本文报告的攻击成功率最高可达 95.71%。
skillpoison/
├── assets/
│ └── framework.png
├── configs/
│ └── main.yaml
├── core/
│ ├── ceir/
│ ├── evaluation/
│ ├── hts/
│ ├── lega/
│ ├── utils/
│ ├── config.py
│ └── pipeline.py
├── prompts/
│ ├── lega/
│ ├── counterfactual_audit.txt
│ ├── counterfactual_generation.txt
│ └── target_audit.txt
├── scripts/
│ ├── run_attack_audit.py
│ ├── run_evaluation.py
│ └── run_skillpoison.py
├── .env.example
├── .gitignore
├── LICENSE
├── README.md
└── requirements.txt
| 数据集 | 形成任务 | 评估任务 |
|---|---|---|
| HANS | 15 | 100 |
| PAWS | 15 | 210 |
| DS1000 | 15 | 100 |
HANS 使用子序列启发式评估子集;PAWS 使用固定的主评估池。DS1000 评估在排除形成任务 ID 后,从 191 个符合条件的任务中选取 100 个返回 DataFrame 的 Pandas 任务。采样按扰动类型分层,随机种子为 42:Origin 32、Semantic 32、Difficult-Rewrite 27 和 Surface 9。在每个数据集内,形成任务和评估任务的 ID 不重叠。在比较的各条件下保持评估实例固定不变。
默认配置使用 deepseek-v4-flash、温度 0.3,以及每个条件 15 条记录的形成预算。
cd skillpoison
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
export MODEL_API_KEY="..."
export MODEL_BASE_URL="..."
export MODEL_NAME="..."
python scripts/run_skillpoison.py \
--config configs/main.yaml \
--input candidate_experiences.jsonl \
--out outputs/run
python scripts/run_skillpoison.py \
--config configs/main.yaml \
--input recorded_experiences.json \
--out outputs/replay \
--replay
python scripts/run_evaluation.py \
--attack attack_records.jsonl \
--out outputs/run/metrics.json
python scripts/run_attack_audit.py \
--input attack_records.jsonl \
--out outputs/run/attack_audit.jsonl