SelfCheckGPT: Zero-Resource Black-Box Hallucination Detection for Generative Large Language Models

Potsawee Manakul, Adian Liusie, Mark J. F. Gales

Introduction

Large Language Models (LLMs) such as GPT-3 (Brown et al., 2020) and PaLM Chowdhery et al. (2022) are capable of generating fluent and realistic responses to a variety of user prompts. They have been used in many applications such as automatic tools to draft reports, virtual assistants and summarization systems. Despite the convincing and realistic nature of LLM-generated texts, a growing concern with LLMs is their tendency to hallucinate facts. It has been widely observed that models can confidently generate fictitious information, and worryingly there are few, if any, existing approaches to suitably identify LLM hallucinations.

A possible approach of hallucination detection is to leverage existing intrinsic uncertainty metrics to determine the parts of the output sequence that the system is least certain of Yuan et al. (2021); Fu et al. (2023). However, uncertainty metrics such as token probability or entropy require access to token-level probability distributions, information which may not be available to users for example when systems are accessed through limited external APIs. An alternate approach is to leverage fact-verification approaches, where evidence is retrieved from an external database to assess the veracity of a claim (Thorne et al., 2018; Guo et al., 2022). However, facts can only be assessed relative to the knowledge present in the database. Additionally, hallucinations are observed over a wide range of tasks beyond pure fact verification Kryscinski et al. (2020); Maynez et al. (2020).

In this paper, we propose SelfCheckGPT, a sampling-based approach that can detect whether responses generated by LLMs are hallucinated or factual. To the best of our knowledge, SelfCheckGPT is the first work to analyze model hallucination of general LLM responses, and is the first zero-resource hallucination detection solution that can be applied to black-box systems. The motivating idea of SelfCheckGPT is that when an LLM has been trained on a given concept, the sampled responses are likely to be similar and contain consistent facts. However, for hallucinated facts, stochastically sampled responses are likely to diverge and may contradict one another. By sampling multiple responses from an LLM, one can measure information consistency between the different responses and determine if statements are factual or hallucinated. Since SelfCheckGPT only leverages sampled responses, it has the added benefit that it can be used for black-box models, and it requires no external database. Five variants of SelfCheckGPT for measuring informational consistency are considered: BERTScore, question-answering, nn-gram, NLI, and LLM prompting. Through analysis of annotated articles generated by GPT-3, we show that SelfCheckGPT is a highly effective hallucination detection method that can even outperform grey-box methods, and serves as a strong first baseline for an increasingly important problem of LLMs.

Background and Related Work

Hallucination has been studied in text generation tasks, including summarization Huang et al. (2021) and dialogue generation Shuster et al. (2021), as well as in a variety of other natural language generation tasks Ji et al. (2023). Self-consistency decoding has shown to improve chain-of-thought prompting performance on complex reasoning tasks Wang et al. (2023). Further, Liu et al. (2022) introduce a hallucination detection dataset, however, texts are obtained by perturbing factual texts and thus may not reflect true LLM hallucination.

Recently, Azaria and Mitchell (2023) trained a multi-layer perception classifier where an LLM’s hidden representations are used as inputs to predict the truthfulness of a sentence. However, this approach is a white-box approach that uses the internal states of the LLM, which may not be available through API calls, and requires labelled data for supervised training. Another recent approach is self-evaluation Kadavath et al. (2022), where an LLM is prompted to evaluate its previous prediction, e.g., to predict the probability that its generated response/answer is true.

2 Sequence Level Uncertainty Estimation

Token probabilities have been used as an indication of model certainty. For example, OpenAI’s GPT-3 web interface allows users to display token probabilities (as shown in Figure 2), and further uncertainty estimation approaches based on aleatoric and epistemic uncertainty have been studied for autoregressive generation Xiao and Wang (2021); Malinin and Gales (2021). Additionally, conditional language model scores have been used to evaluate properties of texts Yuan et al. (2021); Fu et al. (2023). Recently, semantic uncertainty has been proposed to address uncertainty in free-form generation tasks where probabilities are attached to concepts instead of tokens Kuhn et al. (2023).

3 Fact Verification

Existing fact-verification approaches follow a multi-stage pipeline of claim detection, evidence retrieval and verdict prediction (Guo et al., 2022; Zhong et al., 2020). Such methods, however, require access to external databases and can have considerable inference costs.

Grey-Box Factuality Assessment

This section will introduce methods that can be used to determine the factuality of LLM responses in a zero-resource setting when one has full access to output distributions.Alternate white-box approaches such as that of Azaria and Mitchell (2023) require access to full internal states, and is less practical and so not considered in this work. We will use ‘factual’ to define when statements are grounded in valid information, i.e. when hallucinations are avoided, and ‘zero-resource’ when no external database is used.

To understand how the factuality of a generated response can be determined in a zero-resource setting, we consider LLM pre-training. During pre-training, the model is trained with next-word prediction over massive corpora of textual data. This gives the model a strong understanding of language Jawahar et al. (2019); Raffel et al. (2020), powerful contextual reasoning Zhang et al. (2020), as well as world knowledge Liusie et al. (2023). Consider the input "Lionel Messi is a _". Since Messi is a world-famous athlete who may have appeared multiple times in pre-training, the LLM is likely to know who Messi is. Therefore given the context, the token "footballer" may be assigned a high probability while other professions such as "carpenter" may be considered improbable. However, for a different input such as "John Smith is a _", the system will be unsure of the continuation which may result in a flat probability distribution. During inference, this is likely to lead to a non-factual word being generated.

This insight allows us to understand the connection between uncertainty metrics and factuality. Factual sentences are likely to contain tokens with higher likelihood and lower entropy, while hallucinations are likely to come from positions with flat probability distributions with high uncertainty.

Given the LLM’s response RR, let ii denote the ii-th sentence in RR, jj denote the jj-th token in the ii-th sentence, JJ is the number of tokens in the sentence, and pijp_{ij} be the probability of the word generated by the LLM at the jj-th token of the ii-th sentence. Two probability metrics are used:

Max(logp)\text{Max}(-\log p) measures the sentence’s likelihood by assessing the least likely token in the sentence.

Entropy

The entropy of the output distribution is:

Black-Box Factuality Assessment

A drawback of grey-box methods is that they require output token-level probabilities. Though this may seem a reasonable requirement, for massive LLMs only available through limited API calls, such token-level information may not be available (such as with ChatGPT). Therefore, we consider black-box approaches which remain applicable even when only text-based responses are available.

A simple approach to approximate the grey-box approaches is by using a proxy LLM, i.e. another LLM that we have full access to, such as LLaMA Touvron et al. (2023). A proxy LLM can be used to approximate the output token-level probabilities of the black-box LLM generating the text. In the next section, we propose SelfCheckGPT, which is also a black-box approach.

SelfCheckGPT

SelfCheckGPT is our proposed black-box zero-resource hallucination detection scheme, which operates by comparing multiple sampled responses and measuring consistency.

Notation: Let RR refer to an LLM response drawn from a given user query. SelfCheckGPT draws a further NN stochastic LLM response samples {S1,S2,...,Sn,...,SN}\{S^{1},S^{2},...,S^{n},...,S^{N}\} using the same query, and then measures the consistency between the response and the stochastic samples. We design SelfCheckGPT to predict the hallucination score of the ii-th sentence, S(i)\mathcal{S}(i), such that S(i)[0.0,1.0]\mathcal{S}(i)\in[0.0,1.0], where S(i)0.0\mathcal{S}(i)\rightarrow 0.0 if the ii-th sentence is grounded in valid information and S(i)1.0\mathcal{S}(i)\rightarrow 1.0 if the ii-th sentence is hallucinated.With the exception of SelfCheckGPT with nn-gram as the score of the nn-gram language model is not bounded. The following subsections will describe each of the SelfCheckGPT variants.

Let B(.,.)\mathcal{B}(.,.) denote the BERTScore between two sentences. SelfCheckGPT with BERTScore finds the average BERTScore of the ii-th sentence with the most similar sentence from each drawn sample:

where rir_{i} represents the ii-th sentence in RR and skns^{n}_{k} represents the kk-th sentence in the nn-th sample SnS^{n}. This way if the information in a sentence appears in many drawn samples, one may assume that the information is factual, whereas if the statement appears in no other sample, it is likely a hallucination. In this work, RoBERTa-Large Liu et al. (2019) is used as the backbone of BERTScore.

2 SelfCheckGPT with Question Answering

We also consider using the automatic multiple-choice question answering generation (MQAG) framework Manakul et al. (2023) to measure consistency for SelfCheckGPT. MQAG assesses consistency by generating multiple-choice questions over the main generated response, which an independent answering system can attempt to answer while conditioned on the other sampled responses. If questions on consistent information are queried, the answering system is expected to predict similar answers. MQAG consists of two stages: question generation G and question answering A. For the sentence rir_{i} in the response RR, we draw questions qq and options o\mathbf{o}:

The answering stage A selects the answers:

We compare whether aRa_{R} is equal to aSna_{S^{n}} for each sample in {S1,...,SN}\{S^{1},...,S^{N}\}, yielding #matches NmN_{\tt m} and #not-matches NnN_{\tt n}. A simple inconsistency score for the ii-th sentence and question qq based on the match/not-match counts is defined: SQA(i,q)=NnNm+Nn\mathcal{S}_{\text{QA}}(i,q)=\frac{N_{\tt n}}{N_{\tt m}+N_{\tt n}}. To take into account the answerability of generated questions, we show in Appendix B that we can modify the inconsistency score by applying soft-counting, resulting in:

where NmN^{\prime}_{\tt m} = the effective match count, NnN^{\prime}_{\tt n} = the effective mismatch count, with γ1\gamma_{1} and γ2\gamma_{2} defined in Appendix B.1. Ultimately, SelfCheckGPT with QA is the average of inconsistency scores across qq,

3 SelfCheckGPT with n-gram

Given samples {S1,...,SN}\{S^{1},...,S^{N}\} generated by an LLM, one can use the samples to create a new language model that approximates the LLM. In the limit as NN gets sufficiently large, the new language model will converge to the LLM that generated the responses. We can therefore approximate the LLM’s token probabilities using the new language model.

In practice, due to time and/or cost constraints, there can only be a limited number of samples NN. Consequently, we train a simple nn-gram model using the samples {S1,...,SN}\{S^{1},...,S^{N}\} as well as the main response RR (which is assessed), where we note that including RR can be considered as a smoothing method where the count of each token in RR is increased by 1. We then compute the average of the log-probabilities of the sentence in response RR,

4 SelfCheckGPT with NLI

Natural Language Inference (NLI) determines whether a hypothesis follows a premise, classified into either entailment/neutral/contradiction. NLI measures have been used to measure faithfulness in summarization, where Maynez et al. (2020) use a textual entailment classifier trained on MNLI Williams et al. (2018) to determine if a summary contradicts a context or not. Inspired by NLI-based summary assessment, we consider using the NLI contradiction score as a SelfCheckGPT score.

For SelfCheck-NLI, we use DeBERTa-v3-large He et al. (2023) fine-tuned to MNLI as the NLI model. The input for NLI classifiers is typically the premise concatenated to the hypothesis, which for our methodology is the sampled passage SnS^{n} concatenated to the sentence to be assessed rir_{i}. Only the logits associated with the ‘entailment’ and ‘contradiction’ classes are considered,

where zez_{e} and zcz_{c} are the logits of the ‘entailment’ and ‘contradiction’ classes, respectively. This normalization ignores the neutral class and ensures that the probability is bounded between 0.0 and 1.0. The SelfCheckGPT with NLI score for each sample SnS^{n} is then defined as,

5 SelfCheckGPT with Prompt

LLMs have recently been shown to be effective in assessing information consistency between a document and its summary in zero-shot settings Luo et al. (2023). Thus, we query an LLM to assess whether the ii-th sentence is supported by sample SnS^{n} (as the context) using the following prompt.

Initial investigation showed that GPT-3 (text-davinci-003) will output either Yes or No 98% of the time, while any remaining outputs can be set to N/A. The output from prompting when comparing the ii-th sentence against sample SnS^{n} is converted to score xinx^{n}_{i} through the mapping {Yes: 0.0, No: 1.0, N/A: 0.5}. The final inconsistency score is then calculated as:

SelfCheckGPT-Prompt is illustrated in Figure 1. Note that our initial investigations found that less capable models such as GPT-3 (text-curie-001) or LLaMA failed to effectively perform consistency assessment via such prompting.

Data and Annotation

As, currently, there are no standard hallucination detection datasets available, we evaluate our hallucination detection approaches by 1) generating synthetic Wikipedia articles using GPT-3 on the individuals/concepts from the WikiBio dataset Lebret et al. (2016); 2) manually annotating the factuality of the passage at a sentence level; 3) evaluating the system’s ability to detect hallucinations.

WikiBio is a dataset where each input contains the first paragraph (along with tabular information) of Wikipedia articles of a specific concept. We rank the WikiBio test set in terms of paragraph length and randomly sample 238 articles from the top 20% of longest articles (to ensure no very obscure concept is selected). GPT-3 (text-davinci-003) is then used to generate Wikipedia articles on a concept, using the prompt "This is a Wikipedia passage about {concept}:". Table 1 provides the statistics of GPT-3 generated passages.

We then annotate the sentences of the generated passages using the guidelines shown in Figure 3 such that each sentence is classified as either:

Major Inaccurate (Non-Factual, 1): The sentence is entirely hallucinated, i.e. the sentence is unrelated to the topic.

Minor Inaccurate (Non-Factual, 0.5): The sentence consists of some non-factual information, but the sentence is related to the topic.

Accurate (Factual, 0): The information presented in the sentence is accurate.

Of the 1908 annotated sentences, 761 (39.9%) of the sentences were labelled major-inaccurate, 631 (33.1%) minor-inaccurate, and 516 (27.0%) accurate. 201 sentences in the dataset had annotations from two different annotators. To obtain a single label for this subset, if both annotators agree, then the agreed label is used. However, if there is disagreement, then the worse-case label is selected (e.g., {minor inaccurate, major inaccurate} is mapped to major inaccurate). The inter-annotator agreement, as measured by Cohen’s κ\kappa Cohen (1960), has κ\kappa values of 0.595 and 0.748, indicating moderate and substantial agreement Viera et al. (2005) for the 3-class and 2-class scenarios, respectively.3-class refers to when selecting between accurate, minor inaccurate, major inaccurate. 2-class refers to when minor/major inaccuracies are combined into one label.

Furthermore, passage-level scores are obtained by averaging the sentence-level labels in each passage. The distribution of passage-level scores is shown in Figure 4, where we observe a large peak at +1.0. We refer to the points at this peak as total hallucination, which occurs when the information of the response is unrelated to the real concept and is entirely fabricated by the LLM.

Experiments

The generative LLM used to generate passages for our dataset is GPT-3 (text-davinci-003), the state-of-the-art system at the time of creating and annotating the dataset. To obtain the main response, we set the temperature to 0.0 and use standard beam search decoding. For the stochastically generated samples, we set the temperature to 1.0 and generate NN=20 samples. For the proxy LLM approach, we use LLaMA Touvron et al. (2023), one of the best-performing open-source LLMs currently available. For SelfCheckGPT-Prompt, we consider both GPT-3 (which is the same LLM that is used to generate passages) as well as the newly released ChatGPT (gpt-3.5-turbo). More details about the systems in SelfCheckGPT and results using other proxy LLMs can be found in the appendix.

First, we investigate whether our hallucination detection methods can identify the factuality of sentences. In detecting non-factual sentences, both major-inaccurate labels and minor-inaccurate labels are grouped together into the non-factual class, while the factual class refers to accurate sentences. In addition, we consider a more challenging task of detecting major-inaccurate sentences in passages that are not total hallucination passages, which we refer to as non-factual∗.There are 206 non-factual∗ passages (1632 sentences). Figure 5 and Table 2 show the performance of our approaches, where the following observations can be made:

1) LLM’s probabilities pp correlate well with factuality. Our results show that probability measures (from the LLM generating the texts) are strong baselines for assessing factuality. Factual sentences can be identified with an AUC-PR of 53.97, significantly better than the random baseline of 27.04, with the AUC-PR for hallucination detection also increasing from 72.96 to 83.21. This supports the hypothesis that when the LLMs are uncertain about generated information, generated tokens often have higher uncertainty, paving a promising direction for hallucination detection approaches. Also, the probability pp measure performs better than the entropy H\mathcal{H} measure of top-5 tokens.

2) Proxy LLM perform noticeably worse than LLM (GPT-3). The results of proxy LLM (based on LLaMA) show that the entropy H\mathcal{H} measures outperform the probability measures. This suggests that using richer uncertainty information can improve factuality/hallucination detection performance, and that previously the entropy of top-5 tokens is likely to be insufficient. In addition, when using other proxy LLMs such as GPT-NeoX or OPT-30B, the performance is near that of the random baseline. We believe this poor performance occurs as different LLMs have different generating patterns, and so even common tokens may have a low probability in situations where the response is dissimilar to the generation style of the proxy LLM. We note that a weighted conditional LM score such as BARTScore Yuan et al. (2021) could be incorporated in future investigations.

3) SelfCheckGPT outperforms grey-box approaches. It can be seen that SelfCheckGPT-Prompt considerably outperforms the grey-box approaches (including GPT-3’s output probabilities) as well as other black-box approaches. Even other variants of SelfCheckGPT, including BERTScore, QA, and nn-gram, outperform the grey-box approaches in most setups. Interestingly, despite being the least computationally expensive method, SelfCheckGPT with unigram (max) works well across different setups. Essentially, when assessing a sentence, this method picks up the token with the lowest occurrence given all the samples. This suggests that if a token only appears a few times (or once) within the generated samples (NN=20), it is likely non-factual.

4) SelfCheckGPT with nn-gram. When investigating the nn-gram performance from 1-gram to 5-gram, the results show that simply finding the least likely token/nn-gram is more effective than computing the average nn-gram score of the sentence, details in appendix Table 7. Additionally, as nn increases, the performance of SelfCheckGPT with nn-gram (max) drops.

5) SelfCheckGPT with NLI. The NLI-based method outperforms all black-box and grey-box baselines, and its performance is close to the performance of the Prompt method. As SelfCheckGPT with Prompt can be computationally heavy, SelfCheckGPT with NLI could be the most practical method as it provides a good trade-off between performance and computation.

2 Passage-level Factuality Ranking

Previous results demonstrate that SelfCheckGPT is an effective approach for predicting sentence-level factuality. An additional consideration is whether SelfCheckGPT can also be used to determine the overall factuality of passages. Passage-level factuality scores are calculated by averaging the sentence-level scores over all sentences.

where S(i)\mathcal{S}(i) is the sentence-level score, and R|R| is the number of sentences in the passage. Since human judgement is somewhat subjective, averaging the sentence-level labels would lead to ground truths with less noise. Note that for Avg(logp-\log p) and Avg(H\mathcal{H}), we compute the average over all tokens in a passage. Whereas for Max(logp-\log p) and Max(H\mathcal{H}), we first take the maximum operation over tokens at the sentence level, and we then average over all sentences following Equation 12.

Our results in Table 2 and Figure 6 show that all SelfCheckGPT methods correlate far better with human judgements than the other baselines, including the grey-box probability and entropy methods. SelfCheckGPT-Prompt is the best-performing method, achieving the highest Pearson correlation of 78.32. Unsurprisingly, the proxy LLM approach again achieves considerably lower correlations.

3 Ablation Studies

If external knowledge is available, one can measure the informational consistency between the LLM response and the information source. In this experiment, we use the first paragraph of each concept that is available in WikiBio.This method is no longer zero-resource as it requires retrieving relevant knowledge from external data.

Our findings in Table 3 show the following. First, SelfCheckGPT with BERTScore/QA, using self-samples, can yield comparable or even better performance than when using the reference passage. Second, SelfCheckGPT with nn-gram shows a large performance drop when using the WikiBio passages instead of self-samples. This failure is attributed to the fact that the WikiBio reference text alone is not sufficient to train an nn-gram model. Third, in contrast, SelfCheckGPT with NLI/Prompt can benefit considerably when access to retrieved information is available. Nevertheless, in practice, it is infeasible to have an external database for every possible use case of LLM generation.

The Impact of the Number of Samples

Although sample-based methods are expected to perform better when more samples are drawn, this has higher computational costs. Thus, we investigate performance as the number of samples is varied. Our results in Figure 7 show that the performance of SelfCheckGPT increases smoothly as more samples are used, with diminishing gains as more samples are generated. SelfCheckGPT with nn-gram requires the highest number of samples before its performance reaches a plateau.

The Choice of LLM for SelfCheckGPT-Prompt

We investigate whether the LLM generating the text can self-check its own text. We conduct this ablation using a reduced set of the samples (NN=4).

The results in Table 4 show that GPT-3 can self-check its own text, and is better than the unigram method even when using only 4 samples. However, ChatGPT shows a slight improvement over GPT-3 in evaluating whether the sentence is supported by the context. More details are in Appendix C.

Conclusions

This paper is the first work to consider the task of hallucination detection for general large language model responses. We propose SelfCheckGPT, a zero-resource approach that is applicable to any black-box LLM without the need for external resources, and demonstrate the efficacy of our method. SelfCheckGPT outperforms a range of considered grey-box and black-box baseline detection methods at both the sentence and passage levels, and we further release an annotated dataset for GPT-3 hallucination detection with sentence-level factuality labels.

Limitations

In this study, the 238 GPT-3 generated texts were predominantly passages about individuals in the WikiBio dataset. To further investigate the nature of LLM’s hallucination, this study could be extended to a wider range of concepts, e.g., to also consider generated texts about locations and objects. Further, this work considers factuality at the sentence level, but we note that a single sentence may consist of both factual and non-factual information. For example, the following work by Min et al. (2023) considers a fine-grained factuality evaluation by decomposing sentences into atomic facts. Finally, SelfCheckGPT with Prompt, which was convincingly the best selfcheck method, is quite computationally heavy. This might lead to impractical computational costs, which could be addressed in future work to be made more efficient.

Ethics Statement

As this work addresses the issue of LLM’s hallucination, we note that if hallucinated contents are not detected, they could lead to misinformation.

Acknowledgments

This work is supported by Cambridge University Press & Assessment (CUP&A), a department of The Chancellor, Masters, and Scholars of the University of Cambridge, and the Cambridge Commonwealth, European & International Trust. We would like to thank the anonymous reviewers for their helpful comments.

References

Appendix A Models and Implementation

The entropy of the output distribution is implemented as follows,

where W\mathcal{W} is the set of all possible words in the vocabulary.

A.2 Proxy LLMs

The proxy LLMs considered are LLaMA-{7B, 13B, 30B} Touvron et al. (2023), OPT-{125m, 1.3B, 13B, 30B} Zhang et al. (2022), GPT-J-6B Wang and Komatsuzaki (2021) and GPT-NeoX-20B Black et al. (2022).

A.3 SelfCheckGPT’s Systems

Question Answering: The generation systems G1 and G2 are T5-Large fine-tuned to SQuAD Rajpurkar et al. (2016) and RACE Lai et al. (2017), respectively. The answering system A is Longformer Beltagy et al. (2020) fine-tuned to the RACE dataset. The answerability system U is also Longformer, but fine-tuned to SQuAD2.0.

LLM for Prompting: We consider two LLMs, GPT-3 (text-davinci-003) and ChatGPT (gpt-3.5-turbo) We note that during the data creation and annotation, GPT-3 (text-davinci-003) was the state-of-the-art LLM available; hence, GPT-3 was used as the main LLM generating WikiBio passages.

Appendix B SelfCheckGPT with QA

Previous work showed that implementing question generation (in Equation 2) with two generators (G1 generates the question and associated answer, and G2 generates distractors) yields higher-quality distractors Manakul et al. (2023). Thus, a two-stage generation is adopted in this work as follows:

where o={a,o\a}={o1,...,o4}\mathbf{o}=\{a,\mathbf{o}_{\backslash a}\}=\{o_{1},...,o_{4}\}. In addition, to filter out bad (unanswerable) questions, we define an answerability score Raina and Gales (2022):

where the context is either the response RR or sampled passages SnS^{n}, and α0.0\alpha\rightarrow 0.0 for unanswerable and α1.0\alpha\rightarrow 1.0 for answerable. We use α\alpha to filter out unanswerable questions which have α\alpha lower than a threshold. Next, we derive how Bayes’ theorem can be applied to take into account the number of answerable/unanswerable questions.

Let P(F)P(\text{F}) denote the probability of the ii-th sentence being non-factual, and P(T)P(\text{T}) denote the probability of the ii-th sentence being factual. For a question qq, the probability of ii-th sentence being non-factual given a set of matched answers Lm{L}_{\tt m} and a set of not-matched answers Ln{L}_{\tt n} is:

where we assume the sentence is equally likely to be False or True, i.e. P(F)=P(T)P(\text{F})=P(\text{T}). The probability of observing Lm,Ln{L}_{\tt m},{L}_{\tt n} when the sentence is False (non-factual):

and probability of observing Lm,Ln{L}_{\tt m},{L}_{\tt n} when the sentence is True (factual):

where Nm{N}_{\tt m} and Nn{N}_{\tt n} are the number of matched answers and the number of not-matched answers, respectively. Hence, we can simplify Equation 16:

where γ1=β21β1\gamma_{1}=\frac{\beta_{2}}{1-\beta_{1}} and γ2=β11β2\gamma_{2}=\frac{\beta_{1}}{1-\beta_{2}}. Lastly, instead of rejecting samples having an answerability score below a threshold,α\alpha is between 0.0 (unanswerable) and 1.0 (answerable). Standard-counting Nm{N}_{\tt m} and Nn{N}_{\tt n} can be considered as a special case of soft-counting where α\alpha is set to 1.0 if α\alpha is greater than the answerability threshold and otherwise α\alpha is 0.0. we find empirically that soft-counting (defined below) improves the detection performance. We set both β1\beta_{1} and β2\beta_{2} to 0.8.

where αn=PU(answerableq,Sn)\alpha_{n}=P_{{\tt U}}(\text{answerable}|q,S^{n}). Therefore, the SelfCheckGPT with QA score, SQA\mathcal{S}_{\text{QA}}, is:

In Table 5, we show empically that applying Bayes’ theorem and soft counting α\alpha (in Equation 20) improves the performance of the SelfCheckGPT with QA method.

Appendix C SelfCheckGPT with Prompt

We use the prompt template provided in the main text (in Section 5.5) for both GPT-3 (text-davinci-003) and ChatGPT (gpt-3.5-turbo). For ChatGPT, a standard system message "You are a helpful assistant." is used in setting up the system.

At the time of conducting experiments, the API costs per 1,000 tokens are 0.020forGPT3and0.020 for GPT-3 and0.002 for ChatGPT. The estimated costs for running the models to answer Yes/No on all 1908 sentences and 20 samples are around 200forGPT3and200 for GPT-3 and20 for ChatGPT. Given the cost, we conduct the experiments on 4 samples when performing the ablation about LLM choice for SelfCheckGPT-Prompt (Section 4). Table 6 shows the breakdown of predictions made by GPT-3 and ChatGPT.

Appendix D Additional Experimental Results

Here, we provide experimental results that are complementary to those presented in the main paper.