dots.llm1 是 rednote-hilab 团队开发的大规模混合专家(MoE)模型项目,模型总参数规模达 1420 亿,推理时激活 140 亿参数,性能与同类先进模型不相上下,相关资源可通过 Hugging Face 平台获取。

模型架构和训练细节

类型:MoE 模型,总参数 1420 亿,激活参数 140 亿,基于 11.2 万亿高质量真实文本训练。

训练阶段:包含预训练与监督微调(SFT)两个阶段。

网络结构

• 注意力层采用 QK-Norm 归一化技术。

• 细粒度 MoE 机制,从 128 个专家中动态路由 top-6 专家,搭配 2 个共享专家。

基础配置

• 62 层网络结构,32 个注意力头。

• 支持中、英双语,上下文长度达 32,768 tokens。

• 采用 MIT 开源协议。

1、数据处理框架:dots.llm1了提出三级数据处理框架,生成大规模高质量多样化训练数据,预训练阶段不使用合成数据。

2、性能与效率:dots.llm1推理时仅激活 140 亿参数。

3、基础设施优化:dots.llm1引入基于交错 1F1B 流水线调度的 MoE 全连接通信与计算重叠方案,结合高效分组 GEMM 实现,提升计算效率。

4、研究开放性:dots.llm1开源每万亿 tokens 训练的中间检查点,为大模型学习动态研究提供数据支撑。

模型下载

模型类型 总参数 激活参数 上下文长度 下载链接
dots.llm1.base 1420 亿 140 亿 32K 🤗 Hugging Face
dots.llm1.inst 1420 亿 140 亿 32K 🤗 Hugging Face

Docker 部署(推荐方式)

基于 Docker Hub 官方镜像,通过以下命令启动服务:

docker run --gpus all \
    -v ~/.cache/huggingface:/root/.cache/huggingface \
    -p 8000:8000 \
    --ipc=host \
    rednotehilab/dots1:vllm-openai-v0.9.0.1 \
    --model rednote-hilab/dots.llm1.inst \
    --tensor-parallel-size 8 \
    --trust-remote-code \
    --served-model-name dots1

验证服务运行状态:

curl http://localhost:8000/v1/chat/completions \
    -H "Content-Type: application/json" \
    -d '{
        "model": "dots1",
        "messages": [
            {"role": "system", "content": "You are a helpful assistant."},
            {"role": "user", "content": "Who won the world series in 2020?"}
        ],
        "max_tokens": 32,
        "temperature": 0
    }'

Hugging Face 推理示例

文本生成

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig

model_name = "rednote-hilab/dots.llm1.base"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", torch_dtype=torch.bfloat16)

text = "An attention function can be described as mapping a query and a set of key-value pairs to an output, where the query, keys, values, and output are all vectors、The output is"
inputs = tokenizer(text, return_tensors="pt")
outputs = model.generate(**inputs.to(model.device), max_new_tokens=100)
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(result)

对话生成

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig

model_name = "rednote-hilab/dots.llm1.inst"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", torch_dtype=torch.bfloat16)

messages = [{"role": "user", "content": "Write a piece of quicksort code in C++"}]
input_tensor = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
outputs = model.generate(input_tensor.to(model.device), max_new_tokens=200)
result = tokenizer.decode(outputs[0][input_tensor.shape[1]:], skip_special_tokens=True)
print(result)

其他推理工具

vLLM:通过命令启动服务,提供兼容 OpenAI 的 API:

vllm serve dots.llm1.inst --port 8000 --tensor-parallel-size 8

SGLang:轻量级服务框架,支持一键启动:

python -m sglang.launch_server --model-path dots.llm1.inst --tp 8 --host 0.0.0.0 --port 8000

dots.llm1 在 11.2 万亿真实文本训练后,性能可媲美 Qwen2.5-72B 模型,模型性价比(性能/计算成本)在同类开源模型中表现中名列前茅。