Retrieval-Constrained Decoding Reveals Underestimated Parametric Knowledge in Language Models

Rajaa El Hamdani, Samy Haffoudhi, Nils Holzenberger, Fabian M. Suchanek, Thomas Bonald, Fragkiskos D. MalliarosarXiv 2025 · DOI

Abstract

Current evaluations of Large Language Models (LLMs) often underestimate their internal parametric knowledge due to rigid metrics like Exact Match. This paper introduces Retrieval-Constrained Decoding (RCD), a method that restricts model outputs to a set of valid entities retrieved from a knowledge base. By bypassing surface-form variations and partial correctness issues, RCD reveals that models—especially smaller ones—possess significantly more factual knowledge than standard benchmarks suggest.

Introduction: The Evaluation Gap

The AI community primarily measures "parametric knowledge"—facts stored directly in a model's weights—using benchmarks that rely on Exact Match (EM) scoring. However, this approach is fundamentally flawed. A model may be factually correct but penalized for using a synonym (e.g., "PSG" instead of "Paris Saint-Germain") or for providing a partially correct list of answers to a multi-cardinality question. These "surface form variations" and "partial correctness" issues create a vocabulary hurdle that masks the true extent of a model's internal knowledge.

Methodology: Retrieval-Constrained Decoding (RCD)

To address these limitations, the authors propose Retrieval-Constrained Decoding (RCD). Unlike standard decoding, which allows a model to generate any token from its entire vocabulary, RCD restricts the output space to a predefined set of "Unique ID Surface Forms" (IDSFs).

The RCD pipeline: (1) Retrieval of candidates, (2) Trie construction, (3) Constrained generation by the LM, (4) Output of entity strings, and (5) Final set of answers.

The RCD process follows three primary steps:

  1. Candidate Retrieval: A retriever identifies potential answer entities from a knowledge base (e.g., YAGO or Wikidata) based on the input question.
  2. Trie Construction: These candidates are organized into a prefix tree (trie), representing all valid token sequences for the candidate names.
  3. Constrained Decoding: During generation, the model is forced to navigate the trie, ensuring it only selects tokens that form one of the retrieved entities. A special separator token ([SEP]) allows the model to list multiple entities for complex questions.

This method requires no fine-tuning, preserving the model's original weights and providing a pure measurement of its existing knowledge.

Experimental Setup

The researchers evaluated RCD using two key datasets:

  • YAGO-QA: A new dataset of 19,137 questions derived from YAGO, a high-quality, semantically consistent version of Wikidata.
  • KAMEL: A challenging benchmark focusing on niche, domain-specific knowledge in areas like sports and medicine.

Results and Key Insights

The application of RCD led to substantial performance improvements across various model families and sizes.

Comparative performance of various LLMs using Vanilla Decoding (VD) vs. Retrieval-Constrained Decoding (RCD) on YAGO-QA and KAMEL datasets.

Uncovering Hidden Knowledge

The most significant finding is the dramatic increase in F1 scores when switching from vanilla decoding (VD) to RCD. For instance, Llama-3.1-70B's F1 score rose from 32.3% to 46.0% on YAGO-QA. On the more difficult KAMEL dataset, the same model saw its score nearly quadruple, jumping from 8.7% to 32.0%.

Efficiency and Scaling

RCD allows smaller models to compete with much larger counterparts. A Llama-3.2-3B model using RCD (24.3% F1) outperformed a Llama-3.1-8B model using standard decoding (20.8% F1). This suggests that factual accuracy is often limited by the decoding process rather than the model's capacity, potentially allowing for the use of smaller, more efficient models in production environments.

RCD vs. Prompting

The study also found that RCD is more effective than standard Retrieval-Augmented Generation (RAG). While RAG provides candidates as context in the prompt, RCD enforces them as hard constraints, more effectively eliciting the model's internal facts.

Conclusion and Future Work

Retrieval-Constrained Decoding demonstrates that current LLMs are significantly more knowledgeable than standard evaluations suggest. By removing the "vocabulary hurdle," RCD provides a more accurate assessment of parametric knowledge.

While powerful, RCD currently depends on the quality of the underlying knowledge base and the retriever. Future research may explore more advanced retrieval strategies and the application of RCD to specialized domains, such as e-commerce or technical support, to enhance the reliability of factual AI assistants.

Summary updated

BibTeX
@misc{hamdani2025retrieval,
  author = {Rajaa El Hamdani and Samy Haffoudhi and Nils Holzenberger and Fabian M. Suchanek and Thomas Bonald and Fragkiskos D. Malliaros},
  title = {{Retrieval-Constrained Decoding Reveals Underestimated Parametric Knowledge in Language Models}},
  year = {2025},
  eprint = {2509.23417},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.23417},
}
Figure