[KongchangAI]
· 2 min read· 1,152 words

Is the Decoder Sentence Embedding Advantage Due to Pretraining Rather Than Architecture? New Study Offers a Counterintuitive Conclusion

Is the Decoder Sentence Embedding Advantage Due to Pretraining Rather Than Architecture? New Study Offers a Counterintuitive Conclusion

Controlled experiments show encoders outperform decoders when training from scratch; the decoder advantage mainly comes from large-scale pretraining dividends.

This article presents a controlled experiment that strictly aligns parameter scales, tokenizers, training data, and training pipelines, comparing encoder and decoder performance as sentence embedding models across Japanese and English at 0.5B and 1B parameter scales. The core conclusion: with random initialization, encoders consistently outperform decoders on average; decoders only surpass encoders after large-scale pretraining and adaptation. However, models pretrained on 100B vs. 18T tokens perform comparably after adaptation, indicating pretraining volume is not the only explanation—data quality or structure is equally key. The study also finds sentence-level language understanding correlates more closely with embedding quality than span extraction. Practical advice: choose encoders for from-scratch training; directly adapt pretrained models when available, without fixating on architecture.

Introduction: An Assumption Accepted by Default

Adapting large pretrained decoder models into sentence embedding models has become a common and highly effective practice. Whether in community practice or academic benchmarks, decoder-based embedding approaches often stand out. However, does this advantage stem from the decoder architecture itself, or from the massive pretraining data behind it? This question has long lacked rigorous controlled experiments to answer it.

A recent study conducted controlled experiments by systematically aligning encoder and decoder parameter scales, tokenizers, training data, and training pipelines, across two languages (Japanese and English) and two parameter scales (0.5B and 1B). The conclusion is quite counterintuitive: in from-scratch training scenarios, encoders consistently outperform decoders; the decoder's advantage only emerges after large-scale pretraining is introduced.

Study source illustration

Encoder vs. Decoder Architecture: Encoders (like BERT-style models) typically use bidirectional attention, where each token can simultaneously see context on both sides, and learn overall semantic representations through objectives such as masked language modeling; decoders (like GPT-style models) use causal attention, where each token can only see left-side context, with autoregressive next-word prediction as the training objective. This structural difference theoretically affects how sentence-level semantics are aggregated: encoders are naturally suited to compressing entire sentence information into a single vector, while the decoder's causal mask may make the sentence-final token the only position that can "see" the whole sentence, making it more sensitive to pooling strategies. The "decoder embeddings" discussed in this article refer precisely to adapting such autoregressive models into sentence vectors through pooling or contrastive learning.

Experimental Design: How Fair Comparison Is Achieved

The key to answering the question of "architecture or pretraining" lies in controlling variables. The research team paired encoders with decoders, ensuring that in each comparison group, parameter count, tokenizer, training data, and training pipeline were completely identical. Evaluation covered Japanese and English, with parameter scales of 0.5B and 1B, and pretraining budgets up to 20B tokens.

The cleverness of this design lies in completely separating "architectural differences" from "pretraining differences." Previous studies often compared a well-pretrained decoder with an insufficiently pretrained encoder, naturally biasing conclusions toward the decoder. In this work, randomly initialized encoders and randomly initialized decoders stand on the same starting line.

According to the paper, across all combinations of languages, model scales, and different decoder implementations, randomly initialized encoders outperformed randomly initialized decoders on average. This result directly challenges the intuition that "decoders are inherently better suited for sentence embeddings."

Parameter Scale Alignment and Tokenizer Control: In architecture comparisons, identical parameter counts do not necessarily mean completely equivalent computation or representation capacity. The number of layers, attention heads, and hidden dimensions of encoders and decoders need to be configured under the same budget, and the tokenizer must share the same vocabulary; otherwise, differences in sequence length and subword segmentation would introduce additional variables. Furthermore, "pretraining budget" refers to the total number of tokens the model has seen before being adapted into a sentence embedding model—from-scratch training means zero budget, while large-scale pretraining can reach trillions of tokens. Only by locking down all these dimensions can the performance difference between randomly initialized encoders and decoders be attributed to the architecture itself, rather than confounding effects from data or scale.

Pretraining Scale Is Not the Only Explanation

If the decoder's advantage came entirely from pretraining volume, then more pretraining should be better. The study did find that a decoder pretrained on 10T tokens, after adaptation with the same training recipe, can surpass encoders. But further data reveals a more nuanced picture.

The study compared two pretrained models: one pretrained on 100B tokens and another on 18T tokens. When both were adapted into sentence embedding models using the same recipe, their performance turned out to be comparable. This means pretraining volume cannot fully explain the gains from decoder adaptation. In other words, the "quality" or "structure" of pretraining data may be more important than sheer scale, and the decoder architecture may have some unique way of leveraging this pretraining knowledge.

This finding has direct implications for practitioners: if your goal is to train a sentence embedding model from scratch, the encoder is the safer choice; if you already have a sufficiently pretrained model on hand, then directly adapting it (whether encoder or decoder) can yield good results—there's no need to fixate on architecture labels.

Pretraining Volume and Data Quality: The pretraining scale of large language models is usually measured in token count, but token count does not directly equate to knowledge density. A carefully curated, deduplicated, and curriculum-arranged 100B token corpus may outperform an insufficiently cleaned 18T token corpus in semantic diversity and sentence-level coherence. Additionally, every token a decoder sees during autoregressive pretraining participates in next-word prediction, so its representations may be better at capturing long-range dependencies and inter-sentence logic; whereas the encoder's masked pretraining focuses more on local cloze. This can partially explain why adapted performance does not grow monotonically with pretraining token count, and also suggests that the "structure" and "quality" of pretraining data are variables more worthy of attention than scale.

Sentence-Level Understanding Is More Critical Than Span Extraction

Beyond the architecture debate, the study also explored the relationship between embedding quality and model capabilities. One noteworthy finding is that sentence-level language understanding ability, rather than span extraction ability, is more closely associated with embedding quality.

Span extraction typically refers to the ability to locate specific segments from text, commonly found in question answering or information extraction tasks. Sentence-level understanding requires the model to grasp the semantics of the entire sentence. The research results show that models performing better on sentence-level understanding tasks also produce higher-quality sentence embeddings. This provides a direction for future sentence embedding model design: rather than strengthening local span localization ability, focus on the model's grasp of overall sentence semantics.

This conclusion also explains why simple mean pooling or CLS pooling can have vastly different effects on different models—the underlying model's sentence-level representation capability is the determining factor.

Practical Guide: Choose Encoders for From-Scratch Training, Directly Adapt When Pretrained Models Are Available

Synthesizing the above findings, the study provides a concise guiding principle: when training from scratch, choose the encoder architecture; when a usable pretrained model is available, directly adapt that model without worrying about whether its original architecture is encoder or decoder.

Behind this recommendation is a correction of "architectural determinism." The decoder's strong performance on sentence embedding tasks is largely a manifestation of the pretraining dividend, not superiority of the architecture itself. For resource-limited teams, this means there's no need to pretrain a large model from scratch just to pursue decoder architecture; for well-resourced teams, the encoder route may offer better cost-effectiveness when training from scratch.

Of course, the study also leaves some open questions: Why can a model pretrained on 100B tokens match one pretrained on 18T tokens after adaptation? What characteristics of pretraining data are at play? These questions deserve deeper investigation in future work.

#sentence embeddings#encoder decoder architecture#pretraining#sentence embedding models#controlled experiments#large language models
Share:

Related articles