这是 Sequential Hidden Decoding 的 n=2 变体,这是一种通过仅增加 Embedding 参数就能将序列长度扩展 n 倍的方法——使用相同的 Transformer,每个 token 只需更多计算量。
注意:这是一个基础模型(未经过指令微调)。它适用于基准测试、文本补全,以及作为下游微调(SFT / RLHF)的基础。如需用于对话或指令遵循场景,请使用您自己的数据进行微调。
准备 n 个独立的 Embedding 矩阵,将相同的 token 序列编码 n 次,将结果交错排列,然后将 n 倍长度的序列输入到同一个 Transformer 中。每个 token 只有最后一个 embedding 用于计算下一个 token 的损失,而前面的 embedding 则作为连续 latent 空间中的隐式推理步骤。
| 基准测试 | 提示次数 | 8B 基准模型 | 8B 扩展 n=2 | 8B 扩展 n=4 | 8B 扩展 n=8 |
|---|---|---|---|---|---|
| BBH(EM) | 3-shot | 78.8 | 81.3 | 83.0 | 83.9 |
| MMLU(EM) | 5-shot | 79.8 | 80.9 | 81.9 | 82.2 |
| MBPP+(Pass@1) | 1-shot | 66.7 | 69.4 | 68.7 | 69.4 |
| MATH(LLM-judge) | 4-shot | 56.0 | 58.2 | 60.0 | 61.1 |
| ARC-C | 25-shot | 93.9 | 94.3 | 94.4 | 94.7 |
| Hellaswag | 10-shot | 79.7 | 83.1 | 85.0 | 85.3 |
| GSM8K | 4-shot | 92.5 | 93.3 | 93.9 | 94.6 |
该模型需要使用经过补丁的 SGLang 版本进行推理。有关安装选项(Docker 镜像、分支仓库或手动补丁),请参见 项目页面。
python -m sglang.launch_server \
--model-path tencent/Sequential-Hidden-Decoding-8B-n2 \
--trust-remote-code \
--tp-size 1 \
--port 30000 --host 0.0.0.0 \
--chunked-prefill-size -1 \
--attention-backend fa3 \
--mem-fraction-static 0.82 \
--max-running-requests 32 \
--context-length 131072 \
--cuda-graph-max-bs 128 \
--cuda-graph-bs 1 2 4 8 16 32 64 128from openai import OpenAI
client = OpenAI(base_url="http://localhost:30000/v1", api_key="EMPTY")
response = client.completions.create(
model="tencent/Sequential-Hidden-Decoding-8B-n2",
prompt="The meaning of life is",
max_tokens=128,
temperature=0,
)
print(response.choices[0].text)| 模型 | 规模 | 嵌入参数 | 训练 tokens |
|---|---|---|---|
| Sequential-Hidden-Decoding-8B-n2 | 2× | 1.9B | 75B |
| Sequential-Hidden-Decoding-8B-n4 | 4× | 3.1B | 150B |
| Sequential-Hidden-Decoding-8B-n8 | 8× | 5.6B | 187B |
@article{hidden_decoding_2026,
title = {Hidden Decoding: Scaling Sequence Length in Pretraining},
year = {2026},
url = {https://welm.weixin.qq.com/posts/hidden_decoding/}
}本模型依据 Sequential-Hidden-Decoding 许可条款 发布。