🚀 Doge 120M MoE Instruct
Doge 120M MoE Instruct 是一个基于特定架构的模型,它使用动态掩码注意力进行序列转换,并可使用多层感知器或跨域专家混合进行状态转换。该模型由 SmallDoge 社区训练,可用于问答任务。
✨ 主要特性
Doge 使用动态掩码注意力进行序列转换,并可使用多层感知器或跨域专家混合进行状态转换。动态掩码注意力允许 Transformer 在训练期间使用自注意力,在推理期间使用状态空间,而跨域专家混合可以直接继承多层感知器的权重进行进一步训练。该模型由 SmallDoge 社区训练,详细的算法和模型架构相关论文即将发布,所有训练细节和代码可在 small-doge 仓库中找到。
💻 使用示例
基础用法
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig, TextStreamer
tokenizer = AutoTokenizer.from_pretrained("SmallDoge/Doge-120M-MoE-Instruct")
model = AutoModelForCausalLM.from_pretrained("SmallDoge/Doge-120M-MoE-Instruct", trust_remote_code=True)
generation_config = GenerationConfig(
max_new_tokens=100,
use_cache=True,
do_sample=True,
temperature=0.8,
top_p=0.9,
repetition_penalty=1.0
)
steamer = TextStreamer(
tokenizer=tokenizer,
skip_prompt=True
)
prompt = "Hi, how are you doing today?"
conversation = [
{"role": "user", "content": prompt}
]
inputs = tokenizer.apply_chat_template(
conversation=conversation,
tokenize=True,
return_tensors="pt",
)
outputs = model.generate(
inputs,
tokenizer=tokenizer,
generation_config=generation_config,
streamer=steamer
)
📚 详细文档
模型训练详情
我们通过先在 SmolTalk 上进行监督微调(SFT),然后在 UltraFeedback Binarized 上进行直接偏好优化(DPO)来构建 Doge-Instruct 模型。
SFT 训练详情
DPO 训练详情
模型评估
训练过程可视化
- SFT:

- DPO:

训练环境
- 镜像:nvcr.io/nvidia/pytorch:24.12-py3
- 硬件:1x NVIDIA RTX 4090
- 软件:Transformers, TRL
📄 许可证
本项目采用 Apache - 2.0 许可证。
📚 引用
@misc{smalldoges,
title={SmallDoges: A Family of Dynamic UltraFast Small Language Models},
author={Jingze, Shi and Yifan, Wu and Bingheng, Wu and Yuyu, Luo},
year={2025},
month={March},
url={https://github.com/SmallDoges/small-doge}
}