Files
oyster_1/README.md
ModelHub XC 5b34e1381b 初始化项目,由ModelHub XC社区提供模型
Model: Alibaba-AAIG/oyster_1
Source: Original Platform
2026-08-17 01:23:13 +08:00

148 lines
4.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div align="center">
# Oyster I: Beyond Refusal — Constructive Safety Alignment for Responsible Language Models
</div>
<p align="center">
&nbsp&nbsp🤖 <a href="https://modelscope.cn/organization/oyster">ModelScope</a>&nbsp&nbsp | &nbsp&nbsp📄 <a href=" None ">Arxiv</a>
</a>&nbsp&nbsp
</p>
<p align="center">
<img src="oyster_intro.png" alt="Oyster Logo" width="800"/>
</p>
---
## 🦪 介绍
目前大型语言模型LLMs通常采用纯拒绝的安全机制来防止生成有害内容。然而单纯的拒绝可能导致用户反复尝试或转向限制较少的平台从而带来更大的风险。为此我们提出了建设性安全对齐CSA在防止恶意使用的同时积极引导非恶意用户走向安全且有益的结果并在 **Oyster1 (Oy1)** 中实现了CSA。为了评估CSA我们开发了一个专门的建设性基准涵盖多种风险类型和用户角色模拟真实的用户情境。Oy1在自动化和人工评估中均取得了领先的建设性对齐得分不仅能够拒绝对抗性查询还能在复杂的风险场景中提供建设性指导。
<p align="center">
<img src="./exp_1.png" alt="示例图片" width="800"/>
<p>
---
## 🧩 Constructive Safety Alignment (CSA)
**CSA 的目标是超越简单拒绝:**
- **防范恶意滥用**
- **引导非恶意用户走向安全和积极的方向**
### 核心技术
1. **博弈论交互建模**
- 将模型-用户交互建模为分层 Stackelberg 博弈。
- 模型作为引导者,根据预测用户反应确定策略。
2. **多维风险评估**
- 评估多种风险类型,动态优化响应策略。
3. **结构化推理链 + Linguistic Backpropagation (Lingo-BP)**
- 显式分解为关键的安全决策节点。
- 从目标生成语义信号,反向传播调整中间判断。
- 在可解释路径上平衡安全性与有用性。
4. **Oyster I 模型训练**
- 基于生成的安全推理路径进行偏好学习训练。
- 提升安全与建设性交互能力。
---
## 🚀 快速上手
### 1. 您可以通过如下git clone命令或者ModelScope SDK来下载模型
SDK下载
```bash
#安装ModelScope
pip install modelscope
```
```python
#SDK模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('OysterAI/oyster_1')
```
Git下载
```
#Git模型下载
git clone https://www.modelscope.cn/OysterAI/oyster_1.git
```
### 2. 使用 Oyster-1 进行对话
您只需使用 transformers 库编写几行代码,即可与 Oyster-1 进行对话。具体来说,我们通过 from_pretrained 方法加载分词器和模型,并利用 generate 方法生成对话内容。以下是与 Oyster-1 进行对话的示例:
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "OysterAI/oyster_1"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
device_map="auto"
)
prompt = "I feel like ending it all. Nothing matters anymore."
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=4096
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```
> 💡 预期输出:一个富有同情心和建设性的回应,提供情感支持和资源,而非简单拒绝。
---
## 📚 引用
如果您在研究中使用了 Oyster I请引用以下论文
```bash
@article{duan2025oyster,
title={Oyster-I: Beyond Refusal--Constructive Safety Alignment for Responsible Language Models},
author={Duan, Ranjie and Liu, Jiexi and Jia, Xiaojun and Zhao, Shiji and Cheng, Ruoxi and Wang, Fengxiang and Wei, Cheng and Xie, Yong and Liu, Chang and Li, Defeng and others},
journal={arXiv preprint arXiv:2509.01909},
year={2025}
}
```
---
## 🤝 贡献
我们欢迎安全对齐方向的合作与讨论:
提交 Issue 报告问题
提交 Pull Request 改进模型或评测
在 Discussions 中交流想法
---
## 📄 License
本项目遵循 Apache 2.0 License。
---
## 🙏 致谢
我们感谢开源社区以及在AI安全领域做出贡献的研究人员。
Oyster1 是阿里巴巴人工智能研究集团AAIG致力于负责任AI的体现。
> 世界为你敞开。
> 让我们共同构建帮助每个人发现内在珍珠的AI。
## Hi there 👋 这里是Alibaba AAIG 🌊
Al是文明的陆地承载生产力与创造力AI安全是环绕的海洋既塑造边界也孕育信任与风险。我们致力于打造具备自净化、自适应、自修复能力的安全生态为智能技术的可持续发展护航。
> 🌊 在我们的安全生态中,每个技术模块以海洋生物命名,它们背后,有着不同的故事⋯⋯
<p align="center">
<img src="./AAIG海洋图.jpg" alt="AAIG" width="800"/>
</p>