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

it follows from Lemma 2 that P(E1 ) ≥ 1 − δ. Under E1 , we know
                                                   k̂                      1
                                  F (T(k̂) ) ≤          + ϵk̂ < 1 − α +        + ϵk̂−1 + ϵk̂ ,
                                                 n0 + 1                 n0 + 1
which implies
                                                                                           1
                       P(q,M (q))∼P0 (η̂(q, M (q)) > T(k̂) ) = 1 − F (T(k̂) ) > α −            − ϵk̂−1 − ϵk̂ .
                                                                                        n0 + 1
Similarly, since
                                                                                                
                                                                                    k̂
                          P(F (T(k̂) ) ≥ 1 − α) ≥ 1 − δ,        P F (T(k̂) ) ≤           + ϵk̂       ≥ 1 − δ,
                                                                                  n0 + 1
we know
                                                                   k̂
                                                       1−α≤             + ϵk̂ ,
                                                                 n0 + 1
which concludes that
                                                          k̂ ≳ (1 − α)n0 .                                              (13)
Thus we have                                                         r
                                                                         α     1
                                                     ϵk̂−1 + ϵk̂ ≲          log ,
                                                                         n0    δ
and                                                                             r
                                                                                  α     1
                                   P(q,M (q))∼P0 (η̂(q, M (q)) > T(k̂) ) > α − c     log .                              (14)
                                                                                  n0    δ
                                                             q
2) Secondly, we show T(k̂) is close to τα . Denote α′ = α − c nα0 log 1δ , it follows from Equation (14) that under E1 , we
have


                   P(q,M (q))∼P0 η̂(q, M (q)) > T(k̂) > α′ = P(q,M (q))∼P0 η(q, M (q)) > τα′
                                                                                            
                                                                                                         
                                                                  ≥ P(q,M (q))∼P0 η̂(q, M (q)) > τα′ + ϵη ,
so
                                                          T(k̂) < τα′ + ϵη .
Denote E2 as
                                       E2 = {P(q,M (q))∼P0 (η̂(q, M (q)) > T(k̂) ) ≤ α},
we know P(E2 ) ≥ 1 − δ. Under E2 , we have
                    P(q,M (q))∼P0 (η̂(q, M (q)) > T(k̂) ) ≤ α = P(q,M (q))∼P0 (η(q, M (q)) > τα )
                                                                  ≤ P(q,M (q))∼P0 (η̂(q, M (q)) > τα − ϵη ),
so
                                                          T(k̂) ≥ τα − ϵη .
Then we conclude that
                                                 |T(k̂) − τα | ≤ τα′ − τα + ϵη = ϵτ .

3) Now we are able to control the excess risk of fˆα . For any (q, M (q)), if we use Y = 0 (resp. Y = 1) to denote the model
M is uncertain (resp. certain) of q, and denote py = P(Y = 1) to be the marginal distribution for M to be certain, then
                                         dP1                   η(q, M (q))(1 − py )
                                             (q, M (q)) =                           ,
                                         dP0                   (1 − η(q, M (q)))py
                                                 τα (1−py )
which is increasing in η(q, M (q)). Denote ξα = (1−τ  α )py
                                                            , if |η(q, M (q)) − τα | ≤ ϵτ + ϵη and τα + ϵτ + ϵη < 1, then
                                       dP1                      (1 − py )(ϵτ + ϵη )
                                           (q, M (q)) − ξα ≤                         .
                                       dP0                   py (1 − τα − ϵτ − ϵη )2

                                                                 14
