Token Knowledge: A New Perspective For Knowledge in Large Language Models

Jieyong Wang, Chunyao Song, Tingjian Ge2025

Abstract

In the era of prosperity of large language models (LLMs), hallucination remains a serious issue hindering LLMs' expansion and reliability. Predicting the presence (and absence) of certain knowledge in LLMs could aid the hallucination avoidance. However, the token-based generation mode of LLM is different from the knowledge storage structure in the form of triples, which makes it difficult to accurately evaluate the knowledge boundary of LLM. We approach this problem from a novel perspective and, for the first time, introduce the concept of token knowledge in large language models. Consequently, we propose a token knowledge dataset construction method and use the intermediate states during inference to train probes. This allows us to predict if a specific token will appear in the LLM's generated sequence, without even generating a single token. Our approach unlocks the model's latent potential, enhancing its accuracy in assessing token knowledge from about 60% to over 90%, with strong out-of-distribution generalization by training on just a few dozen prompts. Finally, we apply KEGT to enhance a state-of-the-art knowledge boundary detection method, achieving improved performance while reducing computational time by over 90%. Furthermore, KEGT enables prevention of hallucinations in certain cases by leveraging its guidance in the token-level knowledge semantic space.

Introduction: The Hallucination Challenge

Large Language Models (LLMs) frequently encounter the "hallucination" problem—generating factually incorrect information with high confidence. A primary strategy to mitigate this is defining the model's "knowledge boundary." Traditionally, this involves evaluating "abstract knowledge," where a model is prompted to generate a full response, which is then checked for factual accuracy. However, this approach is computationally expensive due to the $O(n^2)$ complexity of autoregressive generation and fails to account for the model's internal token-based processing.

The Token Knowledge Paradigm

This research introduces a shift from abstract knowledge to Token Knowledge. While humans think in facts and triples (e.g., "Shanghai" -> "has amusement park" -> "Disneyland"), LLMs operate on sequences of tokens. Token knowledge is defined as the presence of a specific target token in the model's future generated sequence for a given prompt.

Comparison of abstract knowledge (semantic entities) versus token knowledge (specific token sequences) across various LLM architectures.

By focusing on tokens, we can bridge the gap between high-level semantic entities and the low-level generation process. This perspective allows researchers to determine if a model "knows" it will use a specific token before it even begins the generation process.

Methodology: KEGT and Internal Probing

The researchers developed KEGT (Knowledge Estimation of Generated Token). This method utilizes linear probes—lightweight classifiers—trained on the internal "hidden states" of the model during the very first step of inference.

The core discovery is that "positive" instances (where the token will eventually be generated) and "negative" instances are linearly separable within the model's internal vector space. By identifying the specific "direction" of knowledge tokens using techniques like Principal Component Analysis (PCA), the system can predict token presence with remarkable accuracy without requiring the model to generate a single word.

Performance and Insights

The KEGT method demonstrates significant improvements over traditional prompting. Accuracy in assessing knowledge boundaries rose from approximately 60% to over 90%.

Convergence of prediction accuracy across different model layers and training sample sizes, highlighting the effectiveness of middle layers.

Key findings from the experiments include:

  • The Middle Layer Sweet Spot: Probing is most effective in the middle layers of the LLM. Shallow layers are overly influenced by the input prompt's syntax, while final layers are biased toward immediate next-token prediction. Middle layers serve as the "integration zone" where high-level knowledge is consolidated.
  • Efficiency and Generalization: The probes require very little data to converge. Training on just a few dozen prompts allows the model to generalize to entirely new topics (out-of-distribution).
  • Speed: Because KEGT operates on the first hidden state without requiring full sequence generation, it is over 10 times faster than existing knowledge boundary detection methods like KaRR.

Applications and Future Directions

Beyond speed, KEGT offers a mechanism for preemptive hallucination control. If a probe detects that a necessary knowledge token is missing from the model's internal "plan," the system can intervene to force a refusal or a "don't know" response before the model begins fabricating facts.

While highly effective for English, future work is needed to adapt this method for languages with more complex token-to-meaning mappings, such as Chinese. Additionally, while the method predicts token presence, it reflects the model's intent, which may still be based on flawed internal data. Refining these probes to distinguish between "intended" and "factually grounded" tokens remains a promising frontier.

Summary updated

BibTeX
@misc{wang2025token,
  author = {Jieyong Wang and Chunyao Song and Tingjian Ge},
  title = {{Token Knowledge: A New Perspective For Knowledge in Large Language Models}},
  year = {2025},
  doi = {10.18653/v1/2025.findings-emnlp.418},
}
Figure