                    FACT T EST: Factuality Testing in Large Language Models with Statistical Guarantees

  models’ capability to verify the factual accuracy of statements against Wikipedia documents. We utilize FEVER as a
  multiple-choice NLI task with three options for each question: (A) SUPPORTED, (B) REFUTED, (C) NOT ENOUGH
  INFO. The training set contains 10K samples randomly selected from the original dataset while the testing set contains
  9999 samples.
Detailed information about the original datasets and the data preprocessing procedures can be found in Zhang et al. (2023).
In Figure 5, we illustrate the distribution of correct and incorrect data within the constructed datasets D0 , D1 .

C.3. Details about Score Functions
We implement our framework with three entropy-based certainty functions. Details are described as follows.

• Vanilla Entropy: The frequency of a predicted answer M (q)j in Equation. 8 is calculated by m
                                                                                              k , where m is the number
  of times M (q)j exists in k generations.

• Semantic Entropy: Semantic entropy is an entropy which incorporates linguistic invariances created by shared mean-
  ings (Kuhn et al., 2023), which is computed by the probability distribution over meanings.
                                        X                         X  X                 hX       i
                     SE(q, M (q)) = −      p(c|q) log p(c|q) = −               p(| q) log    p(| q)             (15)
                                          c                          c      ∈c               ∈c
  where c represents possible meaning-class and p(|q) is the probability of the entire answer sequence, that is, the product
  of the conditional probabilities of new tokens given past tokens. This can be approximated by:
                                                   |C|
                                                   X
                         SE(q, M (q)) ≈ −|C|−1           log p(Ci | q), η̂(q, M (q)) = −SE(q, M (q)).                   (16)
                                                   i=1
  We follow (Kuhn et al., 2023) to estimate the expectation of 16 given that we cannot have access to all possible c. We
  query M k times and divide the answers into semantic classes C based on semantic equivalence.

  Notably, for multiple-choice datasets including WiCE and FEVER, the outputs are among three choices. In this case,
  we view different tokens as having different semantic meanings, and the semantic entropy is thus reduced to predictive
  entropy.

• Kernel Language Entropy: Kernel language entropy (KLE) is a generalization of semantic entropy (Nikitin et al.,
  2024), providing more detailed uncertainty estimates by considering pairwise semantic dependencies between answers
  or semantic clusters. It quantifies uncertainty by constructing a semantic kernel from the model’s k generated answers
  and computing its von Neumann entropy. Specifically, for a given input q, we generate k responses, build a positive
  semidefinite semantic kernel Ksem that captures the semantic relationships among these answers, and then calculate the
  von Neumann entropy (VNE) of this kernel. The KLE can be defined as:


                   KLE(q, M (q)) = VNE(Ksem ) = −[Ksem log Ksem ], η̂(q, M (q)) = −KLE(q, M (q)).                       (17)


  where, Ksem is the semantic kernel which can be implemented from semantic graphs over the LLM outputs.

C.4. Details about FACT T EST O
In order to approximate the density ratio, we randomly split 1000 samples from ParaRel-OOD as validation samples and the
remaining 12k samples as testing samples. We then utilize the supervised identification strategy to divide the validation
                ′       ′                                                                                          ′
samples into D0 and D1 , and the training dataset into D0 and D1 . We extract the features from the questions in D0 , D0 by a
TfidfVectorizer, and label them as 1 (target data) and 0 (source data). We then utilize logistic regression to train a binary
classifer and use the predicted probability to approximate density ratios.

D. More Experiemnt Results
In this section, we provide more experiment results, including experiments with more significance levels, answer rate
analysis, more error control analysis, experiments with more base models and certainty distribution visualizations.

                                                              17
