Encoder-Decoder or Decoder-Only? Revisiting Encoder-Decoder Large Language Model

LLM PTSAD MQIA
2025年10月30日
近年来,大语言模型(LLM)的研究在架构上已从编码器-解码器模式迅速转向如今占主导地位的纯解码器模式。然而,这一快速转变缺乏严谨的对比分析,尤其是从模型扩展(scaling)角度的系统性研究,这引发了一种担忧:编码器-解码器模型的潜力可能被低估了。为填补这一空白,我们重新审视了编码器-解码器大语言模型(RedLLM),并引入了来自纯解码器大语言模型(DecLLM)的最新训练方法。我们在不同模型规模(从约1.5亿到约80亿参数)下,对采用前缀语言建模(prefix LM)预训练的RedLLM与采用因果语言建模(causal LM)预训练的DecLLM进行了全面比较。实验使用RedPajama V1数据集(共1.6万亿个token)进行预训练,并采用FLAN数据集进行指令微调。结果表明,RedLLM展现出优异的扩展特性以及出人意料的强大性能。尽管DecLLM在预训练阶段整体上计算效率更高,但RedLLM在扩展性和上下文长度外推能力方面表现相当甚至更优。经过指令微调后,RedLLM在多种下游任务上的表现与DecLLM相当甚至更佳,同时具备显著更高的推理效率。我们希望本研究能激发更多对编码器-解码器大语言模型的重新审视,充分释放其在构建强大且高效的大语言模型方面的潜力。
Recent large language model (LLM) research has undergone an architectural shift from encoder-decoder modeling to nowadays the dominant decoder-only modeling. This rapid transition, however, comes without a rigorous comparative analysis especially \textit{from the scaling perspective}, raising concerns that the potential of encoder-decoder models may have been overlooked. To fill this gap, we revisit encoder-decoder LLM (RedLLM), enhancing it with recent recipes from decoder-only LLM (DecLLM). We conduct a comprehensive comparison between RedLLM, pretrained with prefix language modeling (LM), and DecLLM, pretrained with causal LM, at different model scales, ranging from $\sim$150M to $\sim$8B. Using RedPajama V1 (1.6T tokens) for pretraining and FLAN for instruction tuning, our experiments show that RedLLM produces compelling scaling properties and surprisingly strong performance. While DecLLM is overall more compute-optimal during pretraining, RedLLM demonstrates comparable scaling and context length extrapolation capabilities. After instruction tuning, RedLLM achieves comparable and even better results on various downstream tasks while enjoying substantially better inference efficiency. We hope our findings could inspire more efforts on re-examining RedLLM, unlocking its potential for developing powerful and efficient LLMs.
许愿