Abstract
Pre-trained language models (PLMs) often lack deep open-world knowledge and struggle with task-specific logic. We present TEGTOK, a framework that augments text generation by retrieving and integrating both world knowledge (e.g., Wikipedia) and task-specific exemplars (e.g., past dialogues). TEGTOK employs a dual dense retrieval system and injects world knowledge into the encoder while feeding task-specific knowledge into the decoder. Experimental results on Reddit and SQuAD datasets show that TEGTOK consistently outperforms strong baselines like BART and GPT-2 in terms of informativeness and contextual grounding.
Introduction
While modern Pre-trained Language Models (PLMs) are incredibly fluent, they often suffer from two major "blind spots." First, they lack deep, up-to-date open-world knowledge—the specific facts and entities found in repositories like Wikipedia. Second, they often struggle with task-specific logic—the "how-to" of a particular domain, such as the specific way a question should be phrased or how a persona should respond in a conversation.
Existing research usually tackles one or the other: either retrieving facts to improve accuracy or using "exemplars" to improve style. However, humans don't work this way. When we write, we use our general knowledge of the world and our specific experience with the task at hand. TEGTOK (Augmenting TExt Generation via Task-specific and Open-world Knowledge) is a unified framework built to integrate both sources of information simultaneously.
Methods
TEGTOK follows a "Retrieve-then-Generate" pipeline built on the BART architecture. The process involves several key components:
- Dual Dense Retrieval: Using Dense Passage Retrieval (DPR), the model queries two separate indexes. One contains 21 million Wikipedia passages (World Knowledge), and the other contains domain-specific pairs, such as previous context-response dialogues (Task-specific Knowledge).
- Strategic Injection: The retrieved knowledge is injected into the model at different stages. World Knowledge (WK) is concatenated with the input text and fed into the Encoder to provide factual background. Task-specific Knowledge (TK) is fed into the Decoder through additional cross-attention layers, acting as a "template" to guide the output structure.
- Latent Re-ranking: During training, a posterior re-ranking mechanism identifies which retrieved task examples are most helpful for generating the target text.
- Multi-task Learning: The model is optimized using a combination of standard generation loss, a KL-divergence loss for retriever-re-ranker alignment, and a "Bag-of-Words" loss to ensure the utilization of retrieved keywords.
Experimental Evaluation
The researchers evaluated TEGTOK on two distinct tasks: Dialogue Generation using a Reddit dataset and Question Generation using the SQuAD dataset. The knowledge source was a standardized English Wikipedia dump containing 21 million chunks.
Key Results
TEGTOK consistently outperformed strong baselines like GPT-2, DialoGPT, and BART across multiple metrics. On the Reddit dialogue task, TEGTOK achieved a 9.71 BLEU-1 score, significantly higher than BART (9.24) and DialoGPT (7.58).
Ablation studies revealed that removing either World Knowledge (WK) or Task-specific Knowledge (TK) led to a performance drop. Notably, removing TK usually resulted in a larger decrease in scores, suggesting that "exemplars" are vital for guiding the generation process. Human evaluations further confirmed these findings, with judges rating TEGTOK higher in relevance, fluency, and informativeness.
Conclusion
The TEGTOK framework demonstrates that separating factual "what" (World Knowledge) from structural "how" (Task-specific Knowledge) and injecting them into the encoder and decoder respectively avoids information overload and improves generation quality. While the dual-index approach introduces computational overhead, the gains in informativeness and grounding are substantial. Future work will explore dynamic index updates and extensions to multi-modal generation tasks.
Summary updated