Abstract
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 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 ~150M to ~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.
Introduction
The "Transformer revolution" initially featured two primary architectural paradigms: encoder-decoder models (e.g., T5, BART) and decoder-only models (e.g., GPT). In recent years, the decoder-only architecture has become the industry standard. However, this shift often lacked a rigorous "apples-to-apples" scaling analysis, potentially overlooking the benefits of encoder-decoder structures. This research introduces RedLLM (Revisited Encoder-Decoder) to evaluate whether the industry's pivot was premature by comparing it against modern decoder-only models (DecLLM) across scales from 150M to 8B parameters.
Methodology
To ensure a fair comparison, RedLLM was updated with modern architectural components typically found in state-of-the-art decoder-only models.
Architectural Enhancements
Both RedLLM and DecLLM utilize:
- Rotary Positional Embeddings (RoPE) for better position modeling.
- SwiGLU Activation Functions and RMSNorm (Pre-Normalization) for improved stability and performance.
- Continuous Position Modeling: A critical design choice for RedLLM where the encoder and decoder are treated as a single continuous sequence for positional embeddings, facilitating natural information flow.
Training Objectives
RedLLM was pretrained using a Prefix Language Modeling objective, allowing bidirectional attention on the input prefix. In contrast, DecLLM employed the standard Causal Language Modeling objective, predicting tokens sequentially.
Experimental Setup
- Pretraining Data: Models were trained on the RedPajama V1 corpus (1.6 trillion tokens).
- Instruction Tuning: The FLAN collection, comprising over 1,800 tasks, was used to evaluate post-training adaptation.
- Evaluation Metrics: Performance was assessed using Paloma for perplexity and 13 downstream benchmarks, including MMLU, GSM8K, and HellaSwag.
Key Results and Scaling Analysis
Scaling Laws
Empirical results demonstrate that both architectures follow similar power-law scaling exponents. While DecLLM appears more "compute-optimal" during the pretraining phase—achieving lower perplexity for equivalent training FLOPs—this gap narrows significantly after instruction tuning.
Performance and Efficiency
- Finetuning Parity: Post-instruction tuning, RedLLM 8B matches or exceeds DecLLM 8B performance on various tasks, notably outperforming it on the ANLI benchmark.
- Inference Throughput: RedLLM offers superior inference efficiency. Because the bidirectional encoder processes the entire input prompt in a single pass, it achieves higher throughput on hardware like TPU v5p compared to the sequential processing of DecLLM.
- Context Extrapolation: RedLLM exhibits smoother performance when handling sequences longer than its training window, whereas DecLLM often suffers from divergent perplexity.
Conclusion
The findings suggest that the encoder-decoder architecture remains a highly competitive and efficient alternative to the dominant decoder-only paradigm. While this study focused on scales up to 8B parameters with balanced encoder-decoder layers, future work could explore larger scales and asymmetric architectures to further optimize performance and efficiency.
Summary updated