What Limits Bidirectional Model's Generative Capabilities? A Uni-Bi-Directional Mixture-of-Expert Method For Bidirectional Fine-tuning

Zuchao Li, Yonghua Hei, Qiwei Li, Lefei Zhang, Ping Wang, Hai Zhao, Baoyuan Qi, Liu Guoming

Large Language Models (LLMs) face a fundamental divide. Causal (unidirectional) models excel at text generation by predicting the next word based strictly on past context. However, they struggle with text embeddings—converting sentences into mathematical vectors for search or similarity tasks—because they cannot process the entire sentence simultaneously. Conversely, bidirectional models excel at embeddings but fail at generation. Attempts to fine-tune causal models bidirectionally typically cause generative performance to plummet.

This paper investigates the root cause of this trade-off and introduces a novel architecture, UBMoE-LLM, to unify both capabilities without compromise.

The Root Cause: "Subsequent Dependence"

To understand why bidirectional fine-tuning ruins generation, the authors developed a new metric to quantify "subsequent dependence"—the degree to which a token relies on information from future tokens.

They discovered that bidirectional fine-tuning forces the model to rely heavily on future context. When the model is later asked to generate text autoregressively (where future tokens do not yet exist), it searches for this missing context and produces degraded output. Essentially, the ability to "look ahead" during training poisons the model's ability to generate text step-by-step during inference.

The Solution: UBMoE-LLM Architecture

Through systematic testing, the researchers found a safe harbor: Feed-Forward Network (FFN) layers are the least sensitive to this "future-reliance" damage compared to attention layers. By fine-tuning only the FFNs using contrastive learning, they could achieve high-quality embeddings while leaving the attention mechanism untouched.

Building on this insight, they propose UBMoE-LLM, a Mixture-of-Experts (MoE) architecture. In this setup, each layer contains:

  • Unidirectional Expert: The original FFN, frozen from the base model to preserve generative capabilities.
  • Bidirectional Expert: A newly trained FFN, fine-tuned specifically for text embeddings.
  • Router (Gating Layer): A lightweight, trained component that dynamically decides which expert to activate for a given token.

Key Results and Performance

The dual-purpose model was validated across diverse benchmarks, including 10 text similarity tasks from MTEB for embeddings, and MMLU, Winogrande, and TruthfulQA for generation.

  • Embedding Excellence: Fine-tuning only the FFN layer achieved embedding performance nearly identical to full-model fine-tuning on MTEB tasks, proving that full-parameter updates are unnecessary for high-quality embeddings.
  • Generative Preservation: While naive bidirectional models suffered massive drops in MMLU scores, UBMoE-LLM maintained its generative capabilities. For instance, on the Qwen1.5-1.8B scale, it preserved its average generative score (48.2) while significantly boosting embedding quality.
  • Reduced Hallucination: Incorporating bidirectional experts unexpectedly improved scores on TruthfulQA. This suggests that a bidirectional perspective helps the model resist hallucinations by forming more robust internal representations of facts.
  • Computational Efficiency: Because the MoE structure activates only one expert per token, the computational overhead remains virtually identical to the original model (e.g., 505.82 vs. 505.86 GFLOPs for a 0.5B model).

Limitations and Future Directions

While UBMoE-LLM successfully bridges the gap between generation and understanding, the authors note a few limitations. Because the bidirectional experts were trained on embeddings rather than instruction alignment, there is a slight, inevitable degradation in some complex generation tasks. Additionally, the gating mechanism is currently trained on a relatively small dataset (~480k samples for embeddings and the tulu-v2-sft-mixture for the router), leaving room for more sophisticated routing strategies. Finally, while tested on models up to 14B parameters, the behavior of subsequent dependence in ultra-large models (100B+) remains an open question for future research.

Summary updated

BibTeX
@inproceedings{li2025what,
  author = {Zuchao Li and Yonghua Hei and Qiwei Li and Lefei Zhang and Ping Wang and Hai Zhao and Baoyuan Qi and Liu Guoming},
  title = {{What Limits Bidirectional Model's Generative Capabilities? A Uni-Bi-Directional Mixture-of-Expert Method For Bidirectional Fine-tuning}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=kPFcCJTILB},
}
Figure