Abstract
Large Language Models (LLMs) frequently suffer from "hallucinations," generating factually incorrect content with high confidence. While Retrieval-Augmented Generation (RAG) provides external references to mitigate this, standard systems often struggle with knowledge mix-up and sampling drift. We present DKGen (Dynamic Knowledge Generation), a framework that transforms text generation into an iterative, sentence-by-sentence process. By dynamically selecting the most relevant knowledge snippets for each specific sentence and employing relevance distillation, DKGen significantly improves factual accuracy and attribution while reducing computational latency.
Introduction
The primary challenge in deploying LLMs for knowledge-intensive tasks is ensuring factuality. Standard RAG approaches typically provide a static set of documents to the model, which leads to three critical issues:
- Knowledge Mix-up: Decoders overwhelmed by multiple documents may incorrectly blend facts from different sources.
- Sampling Drift: Errors accumulate over long sequences, causing the model to veer off-track from its factual grounding.
- Opaque Attribution: It is difficult to verify which specific source supports a particular claim within a generated paragraph.
DKGen addresses these by moving away from the "single-pass" paradigm toward a dynamic, iterative approach that re-evaluates evidence for every sentence generated.
Methodology: The DKGen Framework
DKGen decomposes the generation process into a loop where the model produces one sentence at a time, re-evaluating its source material at every step.
Iterative Sentence Generation and Dynamic Selection
Instead of processing all retrieved documents simultaneously, DKGen uses a Scorer to re-rank passages based on both the original query and the context of previously generated text. For each new sentence, only the top $m$ most relevant passages are selected. This "less is more" approach prevents the decoder from being distracted by irrelevant entities or noisy information.
Relevance Distillation
To ensure the model effectively utilizes the selected knowledge, a relevance distillation loss ($L_{kd}$) is introduced. This loss aligns the decoder's cross-attention distribution with the relevance scores provided by the Scorer, effectively forcing the model to focus on the most factual evidence during the generation of each sentence.
Experimental Results
The model was evaluated on the WebBrain benchmark, a large-scale dataset derived from Wikipedia and its corresponding reference articles.
Performance and Factuality
DKGen-L achieved state-of-the-art results across multiple metrics, notably outperforming both specialized RAG baselines like ReGen and general-purpose models like ChatGPT. On FactScore, which measures the accuracy of entity-level relations, DKGen-L reached 13.01, surpassing ChatGPT-R's 11.98.
Efficiency Paradox
Despite the iterative nature of the process, DKGen is highly efficient. By drastically reducing the number of passages the decoder must attend to at each step, it reduces the computational burden of the cross-attention mechanism. DKGen achieves a latency of 531ms, making it significantly faster than the standard BART baseline (1125ms).
Conclusion
DKGen demonstrates that factual accuracy in LLMs can be significantly improved by treating knowledge retrieval as a fluid, sentence-level requirement rather than a static input. By focusing the model's attention on a precise subset of information for each claim, the system minimizes hallucinations and provides clear, sentence-level attribution. Future work will focus on refining selection heuristics and ensuring global narrative coherence across longer documents.
Summary updated