A Combined Encoder and Transformer Approach for Coherent and High-Quality Text Generation

Jiajing Chen, Shuo Wang, Zhen Qi, Zhenhong Zhang, Chihang Wang, Hongye Zheng · DOI

TL;DR

This paper introduces BERT-GPT-4, a hybrid architecture that fuses BERT’s bidirectional semantic understanding with GPT-4’s autoregressive generative power. By using a dynamic weighting mechanism to integrate deep contextual encodings into the generation process, the model achieves state-of-the-art results in fluency and logical consistency, outperforming standalone models like GPT-3 and BART.

What Problem Does This Paper Address?

While Large Language Models (LLMs) have reached incredible heights, they still face a fundamental architectural trade-off. Autoregressive models (like the GPT family) are excellent at generating fluent, word-by-word text but often struggle with "global" logical consistency because they primarily look at preceding tokens. Conversely, bidirectional encoders (like BERT) are masters of context and semantic nuance but are notoriously poor at generating long-form, coherent prose.

The authors address this gap by asking: Can we use BERT’s "understanding" to guide GPT-4’s "writing"? The goal is to eliminate logical drift and "hallucinations" by providing the generator with a richer, bidirectional semantic map of the input.

Methods

The researchers propose a dual-stage architecture:

  1. Semantic Encoding (The BERT Layer): The input text is first processed by BERT. Unlike GPT, which only looks at previous words, BERT looks at the entire input sequence simultaneously to create a high-quality semantic vector ($h$) rich in contextual information.
  2. Guided Generation (The GPT-4 Layer): This semantic vector is then fed into GPT-4. Instead of GPT-4 generating text in a vacuum, it uses BERT’s encoding as a "compass" for every token it produces.
  3. Dynamic Weighting (The "Secret Sauce"): This is the paper's most novel contribution. Rather than applying a static influence from BERT, the model uses a dynamic weighting method ($\alpha_t$). A sigmoid-based gate calculates how much the model should rely on BERT’s semantic representation versus GPT’s internal hidden state at any given time step. This allows the model to be flexible—relying more on BERT for complex semantic shifts and more on GPT for local linguistic fluency.

The model is trained using Maximum Likelihood Estimation (MLE) and optimized with the Adam optimizer, incorporating Dropout layers to prevent overfitting.

Datasets

The study utilized the OpenAI GPT-3 Dataset, a massive and diverse corpus including:

  • News articles and Wikipedia entries.
  • Books and social media conversations.
  • General web crawl data.

The data was preprocessed using a linked data approach to ensure consistency and split into a standard 8:1:1 ratio for training, validation, and testing.

Key Insights and Ideas

  • Bidirectional Guidance: The "aha moment" is that autoregressive generation is inherently limited by its "one-way" view of the world. By injecting a bidirectional "global" view (BERT) into a "local" generator (GPT), the model maintains much better thematic stickiness.
  • The Power of Gating: The dynamic weighting mechanism recognizes that not all words need the same amount of semantic guidance. Common functional words (like "the" or "and") might rely on GPT’s linguistic patterns, while core nouns and verbs might require more "instruction" from the BERT encoder.
  • Overcoming the "GPT-3 Ceiling": The results suggest that simply increasing parameters (as seen in the jump from GPT-2 to GPT-3) isn't the only way to improve quality; architectural fusion can provide a significant performance boost with better efficiency.

Key Results

The hybrid BERT-GPT-4 model was compared against several heavyweights, including GPT-3, T5, BART, Transformer-XL, and CTRL.

Model Perplexity (Lower is better) BLEU Score (Higher is better)
GPT-3 24.3 18.2
BART 20.7 22.8
CTRL 17.6 27.3
BERT-GPT-4 (Ours) 15.8 29.6

Quantitative Findings: * Perplexity: The model achieved a score of 15.8, indicating significantly higher fluency and predictability than GPT-3 (24.3). * BLEU Score: A score of 29.6 demonstrates that the generated text aligns much more closely with human-written reference text than the baseline models.

Qualitative Findings: Manual evaluation confirmed that the hybrid model produced text that was more logically coherent in complex scenarios where pure autoregressive models typically lose the thread of the conversation.

Limitations and Future Work

  • Computational Overhead: Running two massive models (BERT and GPT-4) in tandem is resource-intensive. The authors acknowledge that the model "may consume high resources during long text generation."
  • Efficiency Optimization: Future work will focus on optimizing the architecture to improve generation speed without sacrificing the semantic depth provided by the dual-model approach.
  • Domain Specificity: The authors suggest that fine-tuning this hybrid approach on specialized datasets (e.g., medical or legal) could further enhance its utility in professional fields.
  • Multi-modal Expansion: There is a plan to integrate this logic with multi-modal data, such as images and speech, to create more versatile AI assistants.

Summary updated

Abstract

This research introduces a novel text generation model that combines BERT's semantic interpretation strengths with GPT-4's generative capabilities, establishing a high standard in generating coherent, contextually accurate language. Through the combined architecture, the model enhances semantic depth and maintains smooth, human-like text flow, overcoming limitations seen in prior models. Experimental benchmarks reveal that BERT-GPT-4 surpasses traditional models, including GPT-3, T5, BART, Transformer-XL, and CTRL, in key metrics like Perplexity and BLEU, showcasing its superior natural language generation performance. By fully utilizing contextual information, this hybrid model generates text that is not only logically coherent but also aligns closely with human language patterns, providing an advanced solution for text generation tasks. This research highlights the potential of integrating semantic understanding with advanced generative models, contributing new insights for NLP, and setting a foundation for broader applications of large-scale generative architectures in areas such as automated writing, question-answer systems, and adaptive conversational agents.
BibTeX
@misc{chen2024combined,
  author = {Jiajing Chen and Shuo Wang and Zhen Qi and Zhenhong Zhang and Chihang Wang and Hongye Zheng},
  title = {{A Combined Encoder and Transformer Approach for Coherent and High-Quality Text Generation}},
  year = {2024},
  eprint = {2411.12157},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.12157},
}
Figure