Paper deep dive
An Auditing Test To Detect Behavioral Shift in Language Models
Leo Richter, Xuanli He, Pasquale Minervini, Matt J. Kusner
Models: Gemma, Llama3, Mistral
Intelligence
Status: succeeded | Model: google/gemini-3.1-flash-lite-preview | Prompt: intel-v1 | Confidence: 94%
Last extracted: 3/12/2026, 5:31:31 PM
Summary
The paper introduces Behavioral Shift Auditing (BSA), a statistical framework for detecting unintended changes in language model behavior. By framing the problem as a sequential hypothesis test using the 'testing by betting' paradigm, the authors propose a method that provides theoretical guarantees on false positive rates and includes a configurable tolerance parameter (epsilon) to adjust sensitivity. The approach is validated through case studies on toxicity and translation performance, demonstrating effectiveness with limited samples.
Entities (4)
Relation Signals (3)
Behavioral Shift Auditing ā evaluatedon ā Toxicity
confidence 95% Ā· We evaluate our approach using two case studies: monitoring changes in (a) toxicity and (b) translation performance.
Behavioral Shift Auditing ā uses ā Testing by betting
confidence 95% Ā· Building upon the two-sample variant of DAVT (Pandeva et al., 2024), our test introduces a customizable tolerance parameter
Deep Anytime-Valid Testing ā extends ā Behavioral Shift Auditing
confidence 90% Ā· In this work, we will extend this test to include a tunable tolerance parameter epsilon.
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:As language models (LMs) approach human-level performance, a comprehensive understanding of their behavior becomes crucial. This includes evaluating capabilities, biases, task performance, and alignment with societal values. Extensive initial evaluations, including red teaming and diverse benchmarking, can establish a model's behavioral profile. However, subsequent fine-tuning or deployment modifications may alter these behaviors in unintended ways. We present a method for continual Behavioral Shift Auditing (BSA) in LMs. Building on recent work in hypothesis testing, our auditing test detects behavioral shifts solely through model generations. Our test compares model generations from a baseline model to those of the model under scrutiny and provides theoretical guarantees for change detection while controlling false positives. The test features a configurable tolerance parameter that adjusts sensitivity to behavioral changes for different use cases. We evaluate our approach using two case studies: monitoring changes in (a) toxicity and (b) translation performance. We find that the test is able to detect meaningful changes in behavior distributions using just hundreds of examples.
Tags
Links
Trouble viewing inline? Open PDF directly ā
Full Text
155,896 characters extracted from source content.
Expand or collapse full text
An Auditing Test to Detect Behavioral Shift in Language Modelsā thanks: This work was published at ICLR 2025. Leo Richter1 Xuanli He1 Pasquale Minervini2,3 Matt J. Kusner4,5 1UCL Centre for Artificial Intelligence, University College London, United Kingdom 2School of Informatics, University of Edinburgh, United Kingdom 3Miniml.AI, United Kingdom 4Polytechnique MontrĆ©al, Canada 5Mila ā Quebec AI Institute, Canada ucablri@ucl.ac.uk, matt.kusner@mila.quebec Abstract As language models (LMs) approach human-level performance, a comprehensive understanding of their behavior becomes crucial to avoid potential harms. While extensive initial evaluations, including red teaming and diverse benchmarking, can establish a behavioral profile, subsequent fine-tuning or deployment modifications may alter these model behaviors in unintended ways. We study the behavioral shift auditing problem, where the goal is to detect unintended changes in model behavior. We formalize this problem as a sequential hypothesis test. We apply and extend a recent testing method to include a configurable tolerance parameter that adjusts sensitivity to behavioral changes for different use cases. The test is guaranteed to be consistent and has tight control over the Type I error rate. We evaluate our approach using two case studies: monitoring model changes in (a) toxicity and (b) translation performance. We find that the test is able to detect distribution changes in model behavior using hundreds of prompts. 1 Introduction Language models (LMs) can now achieve human-level performance in a wide range of tasks, including text summarization, machine translation, coding, and even acting as AI scientists: generating hypotheses and designing experiments (Achiam et al., 2023; Katz et al., 2024; Lu et al., 2024; Zhang et al., 2024). As capabilities continue to scale, evaluating LM behaviors becomes increasingly important and increasingly difficult (Hendrycks et al., 2021; Ngo et al., 2022; Wolf et al., 2023). Large-scale evaluationsāsuch as comprehensive behavior and capability assessments (Wang et al., 2023a) and red-teaming exercises (Perez et al., 2022a)āare widely used to verify that language models (LMs) behave safely and as expected. However, these evaluations tend to be expensive and are not well-suited for continuous monitoring, especially when models are updated or fine-tuned with new data. This is problematic because even seemingly benign or narrow modifications can inadvertently lead to undesirable changes in model behavior (Qi et al., 2023; Betley et al., 2025). This raises the question: How can we quickly and cheaply detect unwanted changes in LM behavior? Consider two hypothetical settings where this question might be asked: (1) Internal Audit: A company develops a language model that has passed rigorous safety and performance evaluations. After deploying the model, they continue to fine-tune it to improve its performance on certain tasks. The development team wants to stay informed about any drastic changes this might induce in the modelās behaviorāparticularly shifts in areas unrelated to the intended updates. How can the team rapidly detect meaningful changes in model behavior throughout the development cycle? (2) External Audit: A regulatory body certifies a language model for public deployment after extensive safety evaluation. However, they are concerned that the deployed modelās behavior may change over time due to updates or intentional modifications. Since they only have access to the model through an API and cannot inspect its internal parameters, they require a mechanism to regularly check that the modelās behavior remains consistent with the certified version. How can the regulator regularly check the deployed modelās behavior is the same as the previously certified one? We call the problem of detecting changes in LM behavior distributions over time behavioral shift auditing problems. In this paper, we formalize the problem of behavioral shift auditing in language models and propose a statistical test that monitors changes in model behavior using only black-box access (e.g., via API calls). Our goal is to develop a sample-efficient method that guarantees detection of behavioral shifts while tightly controlling the rate of false positives. Further, it should provide the user with a tolerance parameter that allows a behavior distribution to change by some amount ϵitalic-ϵεϵ without triggering a detection. This parameter controls the strictness of the auditing test - in some settings (e.g., example (1)), a more liberal ϵitalic-ϵεϵ might be appropriate, while in other cases (e.g., example (2)) one might require a more conservative ϵitalic-ϵεϵ or even want to disallow any change at all. The key insight behind our approach is to frame behavior shift auditing as a hypothesis testing problem over the modelās behavior distribution. This framing makes our method applicable to a wide range of measurable behaviorsāsuch as dangerous capabilities (Phuong et al., 2024), mathematical reasoning (Mishra et al., 2022a), and biases (Wang et al., 2023a; Kotek et al., 2023). To this end, we leverage and extend recent advances in testing by betting (Pandeva et al., 2024). Under mild assumptions, our sequential test provably detects any change given enough samples, while ensuring non-asymptotic control over false positives. We demonstrate our test on detecting shifts in toxicity and translation performance. We find that we can detect changed LM behaviors using hundreds of prompts. We release our code here: https://github.com/richterleo/lm-auditing-test. Figure 1: Overview of behavior shift auditing framework. 2 Related Work LM behavior functions. Early evaluations of NLP models relied on curated datasets for detecting biases or toxicity (Bolukbasi et al., 2016); larger collections of data were constructed e.g. through web scraping (Zhao et al., 2018; Zampieri et al., 2019; Nangia et al., 2020; Rosenthal et al., 2021) and, more recently, by leveraging LLMs themselves to generate data (Zhang et al., 2022; Perez et al., 2023). Meanwhile, early work on behavior functions focused on measuring bias, toxicity, and hallucinations (Vidgen et al., 2020; Achiam et al., 2023; Anil et al., 2023; Chern et al., 2023; Varshney et al., 2023; Llama-team, 2024). Since the rise of LMs with human-level performance, the set of behavior functions has exploded (Zou et al., 2023b). It has become more nuanced, including complex characteristics such as power-seeking behavior (Park et al., 2023; Sharma et al., 2023), situational awareness (Zou et al., 2023a), and deception (Hagendorff, 2024). However, even with access to massive datasets and carefully constructed behavior functions it can be difficult to discover these behaviors from static inputs (Kalin et al., 2020). To address this, Perez et al. (2022a) introduced the notion of red-teaming for LM alignment. This allows prompts to be adversarially-constructed to expose failure cases, which arise in many state-of-the-art models (Chao et al., 2023). Model change identification. For the case where one wishes to identify any change in model behavior (i.e., ϵ=0italic-ϵ0ε=0ϵ = 0) there are multiple other techniques that can be used. The first set uses ideas from formal verification to ensure that the predictions from a model are guaranteed to come from a specific model (Ghodsi et al., 2017; Dong et al., 2021; Fan et al., 2023; Weng et al., 2023). In general, however, these methods are computationally intensive and do not scale to state-of-the-art LMs. A second, more efficient idea is to watermark the model (Zhu et al., 2018; Amrit & Singh, 2022; He et al., 2022a; b; Kirchenbauer et al., 2023; Kuditipudi et al., 2023; Yoo et al., 2023). The idea is to embed signals into model generations that can be detected algorithmically. However, watermarks are often inserted by the model owner (Kirchenbauer et al., 2023; Kuditipudi et al., 2023), allowing them (or an actor that has compromised the model) to insert it into any model that is being audited. This precludes its use for many external auditing settings. For internal auditing, a watermark may break under a small model change that is acceptable. Our work is also related to work on concept drift (Bayram et al., 2022) and prompt stability (Li et al., 2024). In principle our test can be used to detect concept and generation changes, however the focus of these works is on model performance and generation similarity, as opposed to behavior change. Sequential hypothesis testing. Sequential hypothesis testing allows one to analyze data without fixing the sample size in advance (Wald, 1945), offering the potential for greater sample efficiency when significant effects exist (Arrow et al., 1949). However, naive repeated testing can increase the Type I error rate (i.e., false positives) as the number of tests grows (Jennison & Turnbull, 1999). To prevent this inflation of false positives, various methods have been developed, including the recent testing by betting framework (Robbins, 1970; Ramdas et al., 2023), which preserves statistical efficiency while tightly controlling the Type I error rate. Within this framework, a method called Deep Anytime-Valid Testing (DAVT) (Pandeva et al., 2024) designs powerful sequential non-parametric tests by integrating deep learning models into the testing by betting framework. They demonstrate, on a variety of tasks, including two-sample testing, competitive performance compared to other state-of-the-art non-parametric sequential tests, such as the E-C2ST (LhĆ©ritier & Cazals, 2018) and Seq-IT (Podkopaev & Ramdas, 2024). DAVT uses a model, trained on past observations, to produce an optimized betting score on new data. In this work, we will extend this test to include a tunable tolerance parameter ϵitalic-ϵεϵ. 3 Preliminaries Testing by betting. The testing by betting framework represents evidence against the null hypothesis as the gain in wealth W of a bettor wagering on observed samples (Shafer, 2021). Before observing new samples, the bettor ābuysā a test statistic at the āpriceā of its expected value under subscript0H_0Hbold_0. After new samples are obtained, the bettorās wealth W is multiplied by the ratio between the actual observed test statistic and its expectation. This ratio is referred to as the betting score StsubscriptS_tSitalic_t. The bettor reinvests in subsequent āroundsā (i.e., as new data is observed), and the observed betting scores are repeatedly multiplied, leading to a cumulative wealth process. Under subscript0H_0Hbold_0, no betting strategy can consistently increase the bettorās wealth, ensuring control over the Type I error rate (Ramdas et al., 2023). Let the bettorās (non-negative) wealth after t (batches of) observations be WtsubscriptW_tWitalic_t. In order to design a test from this wealth process we require that WtsubscriptW_tWitalic_t satisfies the following supPāPā¢[Wt]ā¤1for every ā¢tā„0.formulae-sequencesubscriptsupremumsubscript0subscriptdelimited-[]subscript1for every 0 _P _0E_P[W_t]⤠1 every t% ā„ 0.supitalic_P ā H start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT blackboard_EP [ Witalic_t ] ⤠1 for every t ā„ 0 . (1) All non-negative stochastic processes WtsubscriptW_tWitalic_t that satisfy the above condition are called an e-process for subscript0H_0Hbold_0 (Howard et al., 2021). This states that the maximum wealth across all bets cannot exceed 1111 if the null hypothesis subscript0H_0Hbold_0 is true.111It can be shown that the wealth process WtsubscriptW_tWitalic_t defined this way is equivalent to the minimum wealth a bettor can obtain across all Pāsubscript0P _0P ā Hbold_0 (Ramdas et al., 2023). Given an e-process, the test is constructed as follows: reject the null subscript0H_0Hbold_0 at some time Ļ if WĻā„γsubscriptW_Ļā„ _Ļ ā„ Ī³, where γ=αā1superscript1γ=α^-1γ = α- 1 is a threshold defined by a desired significance level αā(0,1)01αā(0,1)α ā ( 0 , 1 ). Under subscript0H_0Hbold_0, the e-process WtsubscriptW_tWitalic_t controls the Type I error rate. By Villeās inequality (Ville, 1939), we have: āā¢(suptā„0Wtā„γ)ā¤1γ=α.subscriptāsubscript0subscriptsupremum0subscript1P_H_0 ( _tā„ 0W_tā„γ )⤠% 1γ=α.blackboard_PH start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ( supitalic_t ā„ 0 Witalic_t ℠γ ) ⤠divide start_ARG 1 end_ARG start_ARG γ end_ARG = α . (2) This ensures that the probability of incorrectly rejecting subscript0H_0Hbold_0 is at most α at any time step. Thus, the sequential test is anytime-valid, maintaining error control at any stopping point. 4 Detecting Behavior Changes We propose an anytime-valid test for behavior shift auditing that has guarantees on its false positive rate and is consistent under certain weak assumptions. Building upon the two-sample variant of DAVT (Pandeva et al., 2024), our test introduces a customizable tolerance parameter ϵitalic-ϵεϵ that allows users to specify what constitutes a practically significant difference between distributions, accommodating small, insignificant variations. While we concentrate here on its application for behavior shift auditing, it may be of independent interest to the sequential hypothesis testing community. We describe the test in full generality in Appendix B. 4.1 Auditing Test Let X be a random variable representing a prompt, XX the set of possible prompts, and āx ā X a realization of X. A language model is a stochastic operator M that maps prompts xx to generations yy. A behavior scoring function B is a stochastic operator that takes a prompt and generation as input222We include the prompt for generality, there is no requirement that B must depend on the prompt. and produces a score Bā¢(,)ā[0,1]01B(x,y)ā[0,1]B ( x , y ) ā [ 0 , 1 ] (Perez et al., 2023; Wolf et al., 2024). The behavior function, prompts, and language model induce a behavior distribution PBMsuperscriptsubscriptP_B^MPitalic_Bitalic_M over behavior scores Bā¢(X,Mā¢(X))B(X,M(X))B ( X , M ( X ) ). We can now frame the question of whether the behavior of a model Mā²M Mā² has changed (substantially) relative to a baseline model MMM as a testing problem: :ā¢(PBM,PBMā²)ā¤Ļµvs.:ā¢(PBM,PBMā²)>ϵ,:subscript0superscriptsubscriptsuperscriptsubscriptsuperscriptā²italic-ϵvs.subscript1:superscriptsubscriptsuperscriptsubscriptsuperscriptā²italic-ϵ _0:\;D (P_B^M,P_B^M^% )ā¤Īµ . _1:\;D% (P_B^M,P_B^M )>ε,Hbold_0 : D ( Pitalic_Bitalic_M , Pitalic_Bitalic_M start_POSTSUPERSCRIPT ā² end_POSTSUPERSCRIPT ) ⤠ϵ vs. Hbold_1 : D ( Pitalic_Bitalic_M , Pitalic_Bitalic_M start_POSTSUPERSCRIPT ā² end_POSTSUPERSCRIPT ) > ϵ , (3) where ϵā„0italic-ϵ0ε℠0ϵ ā„ 0 is a tolerance parameter, and DD is a distance measure between probability distributions. Note that equality in the null hypothesis in eq. (3) corresponds to DAVT (Pandeva et al., 2024). To extend this to the composite case, our goal is to construct an appropriate wealth process WtsubscriptW_tWitalic_t. This will allow us to establish error rate and consistency guarantees. To do so, we will define a betting score StsubscriptS_tSitalic_t such that it produces a wealth process WtsubscriptW_tWitalic_t that is an e-process i.e., it satisfies eq. (1). This, in turn, will depend on the distance measure DD that we choose. Given a batch of prompts x1,ā¦,xbsubscript1ā¦subscriptx_1,ā¦,x_bx1 , ⦠, xitalic_b and the distance threshold ϵitalic-ϵεϵ from Equation 3, we propose the betting score St=āi=1b(1+Ļtā1ā¢(Bā¢(xi,Mā¢(xi)))āĻtā1ā¢(Bā¢(xi,Mā²ā¢(xi)))expā”(ϵ)).subscriptsuperscriptsubscriptproduct11subscriptitalic-Ļ1subscriptsubscriptsubscriptitalic-Ļ1subscriptsuperscriptā²subscriptitalic-ϵ S_t= _i=1^b ( 1+ _t-1 (B(x_i,M(% x_i)) )- _t-1 (B(x_i,M (x_i)) ) (% ε) ).Sitalic_t = āi = 1b ( divide start_ARG 1 + Ļitalic_t - 1 ( B ( xitalic_i , M ( xitalic_i ) ) ) - Ļitalic_t - 1 ( B ( xitalic_i , Mā² ( xitalic_i ) ) ) end_ARG start_ARG exp ( ϵ ) end_ARG ) . (4) where Ļtā1subscriptitalic-Ļ1 _t-1Ļitalic_t - 1 is a neural network trained on all (tā1)1(t\!-\!1)( t - 1 ) previous batches to optimize the objective maxĻ[log(1+Ļ(B(X,M(X)))āĻ(B(X,Mā²(X)))]. _ĻE[ (1+Ļ(B(X,M(X)))-Ļ(B(X,M^% (X)) )].maxitalic_Ļ blackboard_E [ log ( 1 + Ļ ( B ( X , M ( X ) ) ) - Ļ ( B ( X , Mā² ( X ) ) ) ] . Given the betting score StsubscriptS_tSitalic_t, we define the wealth process Wttā„1subscriptsubscript1\W_t\_tā„ 1 Witalic_t t ā„ 1 of a bettor by initializing their wealth as W0=1subscript01W_0=1W0 = 1 and updating Wt=Wtā1ĆSt.subscriptsubscript1subscript W_t=W_t-1Ć S_t.Witalic_t = Witalic_t - 1 Ć Sitalic_t . (5) If the betting score StsubscriptS_tSitalic_t is an e-variable, meaning that ā¢[St]ā¤1subscriptsubscript0delimited-[]subscript1E_H_0[S_t]⤠1blackboard_EH start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT [ Sitalic_t ] ⤠1, then the wealth process Wttā„0subscriptsubscript0\W_t\_tā„ 0 Witalic_t t ā„ 0 is an e-process, which we can prove by induction. Under subscript0H_0Hbold_0, and for any fixed PBM,PBMā²subscriptsuperscriptsubscriptsuperscriptā²P_B^M,P_B^M Pitalic_Bitalic_M , Pitalic_Bitalic_M start_POSTSUPERSCRIPT ā² end_POSTSUPERSCRIPT satisfying Φā¢(PBM,PBMā²)ā¤ĻµsubscriptΦsuperscriptsubscriptsuperscriptsubscriptsuperscriptā²italic-ϵD_ (P_B^M,P_B^M )⤠_Φ ( Pitalic_Bitalic_M , Pitalic_Bitalic_M start_POSTSUPERSCRIPT ā² end_POSTSUPERSCRIPT ) ⤠ϵ, Wtā1subscript1W_t-1Witalic_t - 1 and StsubscriptS_tSitalic_t are independent. Therefore, ā¢[Wt]subscriptsubscript0delimited-[]subscript _H_0[W_t]blackboard_EH start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT [ Witalic_t ] =ā¢[Wtā1ĆSt]absentsubscriptsubscript0delimited-[]subscript1subscript =E_H_0[W_t-1Ć S_t]= blackboard_EH start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT [ Witalic_t - 1 Ć Sitalic_t ] =ā¢[Wtā1]Ćā¢[St]ā¤ā¢[Wtā1],absentsubscriptsubscript0delimited-[]subscript1subscriptsubscript0delimited-[]subscriptsubscriptsubscript0delimited-[]subscript1 =E_H_0[W_t-1]ĆE_H_% 0[S_t] _H_0[W_t-1],= blackboard_EH start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT [ Witalic_t - 1 ] Ć blackboard_EH start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT [ Sitalic_t ] ⤠blackboard_EH start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT [ Witalic_t - 1 ] , By induction, ā¢[Wt]ā¤1subscriptsubscript0delimited-[]subscript1E_H_0[W_t]⤠1blackboard_EH start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT [ Witalic_t ] ⤠1 for all tā„00tā„ 0t ā„ 0. To ensure that StsubscriptS_tSitalic_t is indeed an e-variable, we choose an appropriate distance measure in eq. (3). Specifically, we define this distance based on the restricted class of models Ļitalic-ĻĻĻ used in our test. As in (Pandeva et al., 2024), we make the following assumptions on Ļitalic-ĻĻĻ: Assumption 1 (Pandeva et al. (2024)). The model class used in our test Φ=ĻĪø:ĪøāĪΦconditional-setsubscriptitalic-ĻĪ =\ _Īø:Īøā \Φ = Ļitalic_Īø : Īø ā Ī must satisfy the following properties: ⢠For all ĻāΦitalic-ĻΦĻā Ļ ā Φ and for all sā[0,1]01sā[0,1]s ā [ 0 , 1 ], |Ļā¢(s)|ā¤qitalic-Ļ|Ļ(s)|⤠q| Ļ ( s ) | ⤠q for some qā(0,1/2)012qā(0,1/2)q ā ( 0 , 1 / 2 ). ⢠If ĻāΦitalic-ĻΦĻā Ļ ā Φ, then cā ĻāΦā italic-ĻΦcĀ·Ļā ā Ļ ā Φ for every cā[ā1,1]11cā[-1,1]c ā [ - 1 , 1 ]. We can now define the distance measure used in our test. Definition 1 (Neural Net Distance). Define the distance333This distance is an instance of an integral probability metric (IPM) (Müller, 1997), a class of distances that includes well-known metrics like the Wasserstein distance (Kantorovich & Rubinstein, 1958). IPMs are at least pseudo-metrics i.e., they satisfy all the properties of a metric except that the distance between distinct points can be zero. used in eq. (3) to be Φ(PBM,PBMā²)=supĻāΦ[Ļ(B(X,M(X))āĻ(B(X,Mā²(X))]. _ (P_B^M,P_B^M % )= _Ļā E [Ļ(B(X,M(X))-Ļ(B(X,M (X% )) ].Droman_Φ ( Pitalic_Bitalic_M , Pitalic_Bitalic_M start_POSTSUPERSCRIPT ā² end_POSTSUPERSCRIPT ) = supitalic_Ļ ā Φ blackboard_E [ Ļ ( B ( X , M ( X ) ) - Ļ ( B ( X , Mā² ( X ) ) ] . (6) For this distance, StsubscriptS_tSitalic_t is an e-variable (see Appendix B.1.2 for a proof). We can now define the following sequential test γ=inftā„1:Wtā„1α.infimumconditional-set1subscript1 γ= \tā„ 1:W_tā„ 1α \.γ = inf t ā„ 1 : Witalic_t ā„ divide start_ARG 1 end_ARG start_ARG α end_ARG . (7) Control over the Type I error follows again from Villeās inequality (2). The test is consistent under the following assumptions. Proposition 1. If the learning algorithm satisfies the condition lim inftāāā¢[logā”(1expā”(ϵ)ā¢(1+ĻĪøtā¢(Xt)āĻĪøtā¢(Yt)))ā£ā±tā1]3ā¢cā¢logā”(t)/tā¢ā„a.s.ā¢1subscriptlimit-infimumādelimited-[]conditional1italic-ϵ1subscriptitalic-Ļsubscriptsubscriptsubscriptitalic-Ļsubscriptsubscriptsubscriptā±13a.s.1 _tāā E [ ( % 1 (ε) (1+ _ _t(X_t)- _ _t(Y_t)% ) ) _t-1 ]3c (t)/t % a.s.ā„1lim inft ā ā divide start_ARG blackboard_E [ log ( divide start_ARG 1 end_ARG start_ARG exp ( ϵ ) end_ARG ( 1 + Ļitalic_Īø start_POSTSUBSCRIPT t end_POSTSUBSCRIPT ( Xitalic_t ) - Ļitalic_Īø start_POSTSUBSCRIPT t end_POSTSUBSCRIPT ( Yitalic_t ) ) ) ⣠Fitalic_t - 1 ] end_ARG start_ARG 3 c square-root start_ARG log ( t ) / t end_ARG end_ARG overa.s. start_ARG ā„ end_ARG 1 (8) for all PBM,PBMā²subscriptsuperscriptsubscriptsuperscriptā²P_B^M,P_B^M Pitalic_Bitalic_M , Pitalic_Bitalic_M start_POSTSUPERSCRIPT ā² end_POSTSUPERSCRIPT with Φā¢(PBM,PBMā²)>ϵsubscriptΦsuperscriptsubscriptsuperscriptsubscriptsuperscriptā²italic-ϵD_ (P_B^M,P_B^M )> _Φ ( Pitalic_Bitalic_M , Pitalic_Bitalic_M start_POSTSUPERSCRIPT ā² end_POSTSUPERSCRIPT ) > ϵ and for a universal constant c, then we have Pā¢(γ<ā)ā¤Ī±andPā¢(γ<ā)=1formulae-sequencesubscriptsubscript0andsubscriptsubscript11 P_H_0(γ<ā)ā¤Ī± P% _H_1(γ<ā)=1Pbold_H start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ( γ < ā ) ⤠α and Pbold_H start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ( γ < ā ) = 1 (9) For the proof, see Appendix B.1.2. This sequential test is thus a sequential level-α test of power one. Algorithm 1 Auditing Test 1: Input: ttā„1subscriptsubscript1\x_t\_tā„ 1 xitalic_t t ā„ 1 (stream of prompts), B (behavior function), MMM (baseline model API), Mā²M Mā² (current model API), α (type-I error limit under null), Ļ0subscriptitalic-Ļ0 _0Ļ0 (neural net model for testing), ϵitalic-ϵεϵ (maximal neural net distance) 2: W0ā1āsubscript01W_0ā 1W0 ā 1 3: while true do 4: Compute behavior scores: btāBā¢(t,Mā¢(t)),btā²āBā¢(t,Mā²ā¢(t))formulae-sequenceāsubscriptsubscriptsubscriptāsuperscriptsubscriptā²subscriptsuperscriptā²subscriptb_tā B(x_t,M(x_t)),b_t % ā B(x_t,M (x_t))bitalic_t ā B ( xitalic_t , M ( xitalic_t ) ) , bitalic_tā² ā B ( xitalic_t , Mā² ( xitalic_t ) ) 5: Compute betting score: Stā(1+Ļtā1ā¢(bt)āĻtā1ā¢(btā²))expā”(ϵ)āsubscript1subscriptitalic-Ļ1subscriptsubscriptitalic-Ļ1superscriptsubscriptā²italic-ϵS_tā (1+ _t-1(b_t)- _t-1(b_t )) (% ε)Sitalic_t ā divide start_ARG ( 1 + Ļitalic_t - 1 ( bitalic_t ) - Ļitalic_t - 1 ( bitalic_tā² ) ) end_ARG start_ARG exp ( ϵ ) end_ARG 6: Update wealth: WtāWtā1ĆStāsubscriptsubscript1subscriptW_tā W_t-1Ć S_tWitalic_t ā Witalic_t - 1 Ć Sitalic_t 7: if Wtā„1/αsubscript1W_tā„ 1/ _t ā„ 1 / α then 8: Break and reject null 9: end if 10: Update neural net model: Ļtāargā¢maxĻā¢āl=1tlogā”(1+Ļā¢(bt)āĻā¢(btā²))āsubscriptitalic-Ļsubscriptargmaxitalic-Ļsuperscriptsubscript11italic-Ļsubscriptitalic-Ļsuperscriptsubscriptā² _tā *arg\,max_Ļ _l=1^t (1+Ļ(b_% t)-Ļ(b_t ))Ļitalic_t ā start_OPERATOR arg max end_OPERATORĻ āl = 1t log ( 1 + Ļ ( bitalic_t ) - Ļ ( bitalic_tā² ) ) 11: end while 4.2 Algorithm The auditing test (shown in Algorithm 1) takes in a stream of prompts ttā„1subscriptsubscript1\x_t\_tā„ 1 xitalic_t t ā„ 1, a behavior function B, an initial baseline language model MMM, a second language model Mā²M Mā², the α-level, a neural net model initialization Ļ0subscriptitalic-Ļ0 _0Ļ0, and a tolerance parameter ϵitalic-ϵεϵ, representing the maximal neural net distance we want to accept between behavior distributions. At every time step, a new prompt from the stream tsubscriptx_txitalic_t is fed to both MMM and Mā²M Mā² to create generations, which are then scored by the behavior function. We feed these scores to the neural net model Ļtā1subscriptitalic-Ļ1 _t-1Ļitalic_t - 1 and calculate the betting score StsubscriptS_tSitalic_t. Next, we update the wealth WtsubscriptW_tWitalic_t by the betting score and check whether it surpasses the 1/α11/ 1 / α-threshold, in which case we reject the null hypothesis. If not, we update the neural net model in a separate training step and continue with the next prompt. The algorithm can easily be modified to accept batches instead of single prompts.444In this case, the new betting score StsubscriptS_tSitalic_t is calculated as a product over samples in the batch. 5 Experiments We evaluate our test for both the external and internal auditing use-cases. We first look at the strict case, where any behavioral change is prohibited, and then move on to the case where small changes in distribution are allowed. We investigate toxicity and translation performance. 5.1 Exact test, ϵ=0italic-ϵ0ε=0ϵ = 0 Figure 2: Fine-tuning Detection for Llama3-8B-Instruct. The detection frequency as a function of number of generated samples. Each curve is a fine-tuned corrupted model checkpoint (to simplify visualization, the curves with shaded standard deviations are averages over models with similar distances to the aligned model). The color depicts the Wasserstein distance between the corrupted model and the original aligned model. Setup. We begin by investigating an external setting where we require the test to detect any change in distribution (ϵ=0italic-ϵ0ε\!=\!0ϵ = 0). Specifically, we will check for changes in toxicity behavior. We select prompts from the REALTOXICITYPROMPTS dataset (Gehman et al., 2020) and use the toxicity behavior function from Perspective API (Lees et al., 2022) to evaluate LM generations. Llama3 (8B-Instruct) (Llama-team, 2024), Gemma (1.1-7b-it) (Mesnard et al., 2024), and Mistral (7B-Instruct-v0.2) (Jiang et al., 2023) serve as our initial aligned models. We remove the safety alignment in these models by fine-tuning, producing 10 corrupted checkpoints for each model. To evaluate the statistical properties of our the exact test (ϵ=0italic-ϵ0ε\!=\!0ϵ = 0), we assess (a) its ability to detect changed checkpoints, and (b) its false positive rate. For further experimental details regarding toxicity fine-tuning, text generation and the betting score network, please see Appendix A.1. Corrupted model detection. We test each corrupted checkpoint against the corresponding initial aligned model with α=0.050.05α\!=\!0.05α = 0.05. Figure 2 shows the fraction of positive test results after having observed at least m samples, with tests repeated 48 times per checkpoint (2000 samples per fold, batch size 100). High detection rates of almost 80%percent8080\%80 % are achieved even for checkpoints closest to the baseline. We find that as the distance between the corrupted model and the initial model increases, fewer samples are needed to detect the change in behavior. Similar results for Mistral and Gemma can be found in Appendix C. False positive rate. We use different random seeds for generating text from the initial aligned models to examine the false positive rate of the exact test. Figure 4 shows the false positive rate for each of the model architectures as a function of the number of observed samples, repeated 24 times (4000 samples per fold, batch size 100). The test is highly specific, with false detection rates consistently below 0.050.050.050.05. 5.2 Tolerance Test, ϵ>0italic-ϵ0ε>0ϵ > 0 We now evaluate the test with tolerance ϵ>0italic-ϵ0ε>0ϵ > 0 in two use-cases: an external toxicity audit, and an internal translation performance audit. In both cases, the exact test might be too sensitive. However, how much variation to allow between distributions might depend on the use-case. We thus want to explore some possible strategies for determining the hyperparameter ϵitalic-ϵεϵ appropriately in each scenario. Figure 3: Measuring Mean and Distributional Change. Analysis of seven Llama3-8B variants shows aligned shifts across three metrics: mean toxicity scores, Wasserstein distances, and Neural net distances to baseline Llama3-8B-Instruct. The variants include the baseline model with modified sampling parameters, five models instruction-tuned on subsets of SuperNI, and an uncensored model. Use Case 1: External Audit, Toxicity Figure 4: False positives. The false positive rate for each of the baseline models as a function of number of observed samples. Using the same model and sampling strategy but different random seeds, we generate two outputs for each prompt to be used as the sample pairs for our auditing test. Setup. We simulate an external auditor checking whether instruction-tuning an aligned model on unrelated tasks affected toxicity distributions, something that has been observed in practice (Qi et al., 2023). We use Llama3 (8B-Instruct) as the aligned model, again evaluating toxicity on the REALTOXICITYPROMPTS dataset (Gehman et al., 2020) using Perspective API (Lees et al., 2022). We instruction-tune Llama3 on 5 different task clusters from SUPER-NATURALINSTRUCTIONS (SuperNI; Mishra et al., 2022b; Wang et al., 2022). This setup is inspired by Wang et al. (2023c), who found that a pre-trained Llama2 model instruction-tuned on SuperNI exhibits high toxicity scores on ToxiGen. Detailed information on instruction-tuning and how the neural net distance is estimated can be found in Appendix A. Results. Instruction-tuning increased mean toxicity scores, which, as shown in Figure 3, corresponds with increases in both Wasserstein distances and neural net distances from Llama3. As a reference, we also include another Llama3-8B model tuned to be less refusing.555The uncensored model was fine-tuned on Uncensored-Vortex https://huggingface.co/datasets/OEvortex/uncensored-vortex. Surprisingly, the most toxic and distant model is not this uncensored model but the model fine-tuned on Code to Text, Stereotype Detection, and Sentence Perturbation (shown in green). We test Llama3 against each instruction-tuned model across a range of tolerance values, from ϵ=0.0038italic-ϵ0.0038ε\!=\!0.0038ϵ = 0.0038 (the neural net distance between standard Llama3 and Llama3 with different sampling parameters) up to the neural net distance between the base model and another Llama3-8B model tuned to be less refusing, ϵ=0.076italic-ϵ0.076ε\!=\!0.076ϵ = 0.076. Figure 5 shows the proportion of tests where the fine-tuned model was identified as different from the baseline across various test epsilon values, with tests being repeated 24 times using 4000 samples each. At lower epsilon values, representing a conservative testing regime that detects even small changes, all instruction-tuned models are consistently identified (100% detection rate). As epsilon increases, the power of the test decreases until it reaches the true neural net distance between the base model and each fine-tuned variant. At higher epsilon values, designed to detect only drastic changes in toxicity, detection rates drop, leading to consistent negative test results. We investigate the strict auditing setting ā where only minor variations due to sampling are accepted ā more closely. Specifically, we set ϵitalic-ϵεϵ equal to the neural net distance between the original Llama3 model and the same model with different sampling parameters (ϵ=0.0038italic-ϵ0.0038ε=0.0038ϵ = 0.0038) and test baseline Llama3 against the 5 instruction-tuned versions as well as the uncensored reference Llama3. Figure 6 demonstrates that under this strict threshold, the test requires fewer samples to detect models that deviate more substantially from the baseline. Figure 5: Detection rate vs. Test Epsilon. Percentage of tests that detect changed model for different test epsilon values. Dashed lines represent estimated true neural net distance between Llama3-8B-Instruct and the instruction-tuned model. We note that the false positive rate for the model fine-tuned on Gender Classification, Commonsense Classification and Translation exceeds the α-level of 5% in two cases, corresponding to 3/24 tests wrongly showing positive results. Assuming a perfect estimate of the true neural net distance, this event can occur with a maximum probability of 8.68.68.68.6%. Use Case 2: Internal Audit, Translation Performance We simulate a modeler adjusting their language model while monitoring whether its translation capabilities change substantially. To fix a tolerance parameter ϵitalic-ϵεϵ we imagine that the modeler only wishes to trigger the test if the translation distribution changes by more than the amount it would if prompted differently. Figure 6: Detection Rates for Fine-Tuned Models. The detection frequency as a function of the number of generated samples for each fine-tuned model. We used a test with ϵā0.0038italic-ϵ0.0038εā 0.0038ϵ ā 0.0038, based on the estimated neural net distance between distributions generated by Llama3-8B-Instruct using different sampling parameters. The black line represents an unaligned reference model, Llama3-8B trained to be more permissive in answering. Setup. We evaluate Llama3 (8B-Instruct) on English-Spanish and English-French translations from SuperNI. We set ϵitalic-ϵεϵ as the neural net distance between Llama3 using simple prompts, and Llama3 using few-shot prompts. We then test the translation performance distribution of Llama3 with simple prompts against that of Aya-23-8B (Ćstün et al., 2024), a multilingual instruction-tuned model. We expect a positive test result since Aya-23-8B represents a significant improvement in translation capabilities compared to Llama3, likely exceeding the threshold ϵitalic-ϵεϵ set by different prompting techniques. Results. Few-shot prompting leads to a modest increase in mean BLEU scores from 0.16830.16830.16830.1683 to 0.17650.17650.17650.1765. A significant improvement is evident when using Aya-23-8b, with a mean BLEU score of 0.29700.29700.29700.2970. We observe that Llama3 models occasionally misinterpret instructions or include unnecessary additional text in English, potentially impacting their scores. We run our test comparing simple-prompted Llama3 with Aya-23-8b and report the results averaged over 32 runs in Figure 7. The test detects a difference in nearly all cases after only 100100100100 samples. Overall, the results from both the toxicity and translation audits demonstrate the effectiveness and sample-efficiency of our testing method in detecting behavioral shifts in language models. In the external audit, it consistently identified increases in toxicity levels due to instruction-tuning, especially at lower epsilon values, confirming its sensitivity to subtle changes in model behavior. Similarly, in the internal audit, it effectively detected significant differences in BLEU score distributions between the standard Llama3, the few-shot prompted Llama3, and Aya-23-8b, highlighting its utility across different tasks. These findings underscore the importance of selecting an appropriate tolerance level based on the specific application to balance sensitivity and practicality. Figure 7: Detection for Aya-23-8b. The detection frequency as a function of the number of generated samples when setting ϵā0.0072italic-ϵ0.0072εā 0.0072ϵ ā 0.0072. This threshold is derived as an estimate of the neural net distance between Llama3-8B-Instruct with and without few-shot prompts. 6 Discussion In this work we introduce the problem of behavior shift auditing, where the goal is to detect LM behavior changes over time. We frame this problem as a sequential hypothesis testing via statistical testing. Our proposed test comes with guarantees and has been able to detect changes in language model toxicity and translation performance. One of the notable strengths of our approach is its sample efficiency. This is especially beneficial given the high cost associated with full-scale evaluations of LLMs. Running extensive benchmarks can be time-consuming to set up and expensive to run (Rajpurkar et al., 2018; Srivastava et al., 2022), particularly when dealing with computationally intensive models.666E.g., inference-heavy models like ChatGPT o1-preview (OpenAI, 2024). Our test can serve as a screening tool to identify potential behavioral shifts using just a few hundred samples, making subsequent full-scale evaluations more targeted and efficient. Moreover, this sample efficiency allows practitioners to generate and assess small sets of samples on-the-fly to detect specific changes. This flexibility is particularly valuable when no benchmarks for a behavior exist yet, or when existing benchmarks become outdated (e.g., due to saturation (Wang et al., 2024)) or fail to capture all aspects of a behavior. We now discuss some current limitations. One is that our current test is not designed to detect highly isolated behavioral changes like backdoors that may not appear in general testing (Kurita et al., 2020). This limitation is inherited from framing BSA as hypothesis testing. Our test also relies on the assumption that we have access to a behavior scoring function. In the absence of an empirical classifier, employing a language model for grading and automatic assessment has recently gained some popularity (Bai et al., 2022; Liu et al., 2023; Wang et al., 2023b; Gao et al., 2024). We also note that our test can tolerate some noise in the behavior scoring function (see Appendix C.4 for further discussion). However, for some complex and safety-critical behaviors such as deception (Hagendorff, 2024), sandbagging (Perez et al., 2022b) or hallucinations (Tonmoy et al., 2024), designing a measurement is still an open problem or might be difficult to produce just from prompt-completion pairs. There are many other exiting directions for future research. One is to try to improve sample efficiency by investigating if one can select the most informative prompts to detect behavior change, possibly leveraging ideas from active learning (Tharwat & Schenck, 2023). Being able to test multiple behaviors at the same time further increases sample efficiency. While this is straightforward for the exact test (see Appendix C.5), how to set a tolerance threshold ϵitalic-ϵεϵ for multiple behaviors is still to be explored. Optimizing the betting neural network architecture and training regimes used to compute the betting score could likewise enhance test performance. Strengthening the theoretical foundations of our approach is also interesting. Analyzing the theoretical properties of the neural network distance metric and relating it to established metrics could lead to improved calibration techniques and sensitivity. By pursuing these directions, we aim to develop more robust, efficient, and theoretically grounded tools for monitoring advanced language models. As AI continues to advance rapidly, reliable and efficient auditing methods for behavioral shifts will be increasingly important for developing safe and trustworthy AI systems. Reproducibility Statement We have taken several steps to ensure the reproducibility of our results. ⢠All key details needed for reproduction, including model architectures, hyperparameters, and training procedures, are comprehensively described in Section 5 and Appendix A. ⢠We provide a detailed description of the datasets and data processing steps and the exact splits used for training and evaluation in Section 5 and Appendix A. Acknowledgements This work was supported by the Edinburgh International Data Facility (EIDF) and the Data-Driven Innovation Programme at the University of Edinburgh. PM was partially funded by ELIAI (The Edinburgh Laboratory for Integrated Artificial Intelligence), EPSRC (grant no. EP/W002876/1), an industry grant from Cisco, and a donation from Accenture LLP. XH was supported by an industry grant from Cisco. LR was supported by the EPSRC Grant EP/S021566/1. We want to thank Robert Kirk, Max Hasin and Ole Jorgensen for feedback on earlier versions of the paper. References Achiam et al. (2023) Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Florencia Leoni Aleman, Diogo Almeida, Janko Altenschmidt, Sam Altman, Shyamal Anadkat, et al. Gpt-4 technical report. arXiv preprint arXiv:2303.08774, 2023. Amrit & Singh (2022) Preetam Amrit and Amit Kumar Singh. Survey on watermarking methods in the artificial intelligence domain and beyond. Computer Communications, 188:52ā65, 2022. Anil et al. (2023) Rohan Anil, Sebastian Borgeaud, Yonghui Wu, Jean-Baptiste Alayrac, Jiahui Yu, Radu Soricut, Johan Schalkwyk, Andrew M Dai, Anja Hauth, et al. Gemini: a family of highly capable multimodal models. arXiv preprint arXiv:2312.11805, 2023. Anscombe (1954) Francis J Anscombe. Fixed-sample-size analysis of sequential observations. Biometrics, 10(1):89ā100, 1954. Arrow et al. (1949) Kenneth J Arrow, David Blackwell, and Meyer A Girshick. Bayes and minimax solutions of sequential decision problems. Econometrica, Journal of the Econometric Society, p. 213ā244, 1949. Bai et al. (2022) Yuntao Bai, Saurav Kadavath, Sandipan Kundu, Amanda Askell, Jackson Kernion, Andy Jones, Anna Chen, Anna Goldie, Azalia Mirhoseini, Cameron McKinnon, et al. Constitutional ai: Harmlessness from ai feedback. arXiv preprint arXiv:2212.08073, 2022. Bayram et al. (2022) Firas Bayram, Bestoun S Ahmed, and Andreas Kassler. From concept drift to model degradation: An overview on performance-aware drift detectors. Knowledge-Based Systems, 245:108632, 2022. Betley et al. (2025) Jan Betley, Daniel Tan, Niels Warncke, Anna Sztyber-Betley, Xuchan Bao, MartĆn Soto, Nathan Labenz, and Owain Evans. Emergent misalignment: Narrow finetuning can produce broadly misaligned llms. arXiv preprint arXiv:2502.17424, 2025. Bolukbasi et al. (2016) Tolga Bolukbasi, Kai-Wei Chang, James Y Zou, Venkatesh Saligrama, and Adam T Kalai. Man is to computer programmer as woman is to homemaker? debiasing word embeddings. Advances in neural information processing systems, 29, 2016. Chao et al. (2023) Patrick Chao, Alexander Robey, Edgar Dobriban, Hamed Hassani, George J Pappas, and Eric Wong. Jailbreaking black box large language models in twenty queries. In R0-FoMo: Robustness of Few-shot and Zero-shot Learning in Large Foundation Models, 2023. Chern et al. (2023) I Chern, Steffi Chern, Shiqi Chen, Weizhe Yuan, Kehua Feng, Chunting Zhou, Junxian He, Graham Neubig, Pengfei Liu, et al. Factool: Factuality detection in generative aiāa tool augmented framework for multi-task and multi-domain scenarios. arXiv preprint arXiv:2307.13528, 2023. Dong et al. (2021) Boxiang Dong, Bo Zhang, and Hui Wang. Veridl: Integrity verification of outsourced deep learning services. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, p. 583ā598, 2021. Fan et al. (2023) Yongkai Fan, Binyuan Xu, Linlin Zhang, Jinbao Song, Albert Zomaya, and Kuan-Ching Li. Validating the integrity of convolutional neural network predictions based on zero-knowledge proof. Information Sciences, 625:125ā140, 2023. Gao et al. (2024) Mingqi Gao, Xinyu Hu, Jie Ruan, Xiao Pu, and Xiaojun Wan. Llm-based nlg evaluation: Current status and challenges. arXiv preprint arXiv:2402.01383, 2024. Gehman et al. (2020) Samuel Gehman, Suchin Gururangan, Maarten Sap, Yejin Choi, and Noah A Smith. Realtoxicityprompts: Evaluating neural toxic degeneration in language models. arXiv preprint arXiv:2009.11462, 2020. Ghodsi et al. (2017) Zahra Ghodsi, Tianyu Gu, and Siddharth Garg. Safetynets: Verifiable execution of deep neural networks on an untrusted cloud. Advances in Neural Information Processing Systems, 30, 2017. Hagendorff (2024) Thilo Hagendorff. Deception abilities emerged in large language models. Proceedings of the National Academy of Sciences, 121(24):e2317967121, 2024. He et al. (2022a) Xuanli He, Qiongkai Xu, Lingjuan Lyu, Fangzhao Wu, and Chenguang Wang. Protecting intellectual property of language generation apis with lexical watermark. Proceedings of the AAAI Conference on Artificial Intelligence, 36(10):10758ā10766, Jun. 2022a. doi: 10.1609/aaai.v36i10.21321. URL https://ojs.aaai.org/index.php/AAAI/article/view/21321. He et al. (2022b) Xuanli He, Qiongkai Xu, Yi Zeng, Lingjuan Lyu, Fangzhao Wu, Jiwei Li, and Ruoxi Jia. CATER: Intellectual property protection on text generation APIs via conditional watermarks. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho (eds.), Advances in Neural Information Processing Systems, 2022b. URL https://openreview.net/forum?id=L7P3IvsoUXY. Hendrycks et al. (2021) Dan Hendrycks, Nicholas Carlini, John Schulman, and Jacob Steinhardt. Unsolved problems in ml safety. arXiv preprint arXiv:2109.13916, 2021. Hornik et al. (1989) Kurt Hornik, Maxwell Stinchcombe, and Halbert White. Multilayer feedforward networks are universal approximators. Neural networks, 2(5):359ā366, 1989. Howard et al. (2021) Steven R Howard, Aaditya Ramdas, Jon McAuliffe, and Jasjeet Sekhon. Time-uniform, nonparametric, nonasymptotic confidence sequences. The Annals of Statistics, 49(2), 2021. Hu et al. (2021) Edward J Hu, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, Weizhu Chen, et al. Lora: Low-rank adaptation of large language models. In International Conference on Learning Representations, 2021. Jennison & Turnbull (1999) Christopher Jennison and Bruce W Turnbull. Group sequential methods with applications to clinical trials. CRC Press, 1999. Ji et al. (2024) Jiaming Ji, Mickel Liu, Josef Dai, Xuehai Pan, Chi Zhang, Ce Bian, Boyuan Chen, Ruiyang Sun, Yizhou Wang, and Yaodong Yang. Beavertails: Towards improved safety alignment of llm via a human-preference dataset. Advances in Neural Information Processing Systems, 36, 2024. Jiang et al. (2023) Albert Q Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, et al. Mistral 7b. arXiv preprint arXiv:2310.06825, 2023. Kalin et al. (2020) Josh Kalin, Matthew Ciolino, David Noever, and Gerry Dozier. Black box to white box: Discover model characteristics based on strategic probing. In 2020 Third International Conference on Artificial Intelligence for Industries (AI4I), p. 60ā63. IEEE, 2020. Kantorovich & Rubinstein (1958) LV Kantorovich and GS Rubinstein. On a space of completely additive functions, vestn. leningr. univ. 13 (7)(1958) 52-59, 1958. Katz et al. (2024) Daniel Martin Katz, Michael James Bommarito, Shang Gao, and Pablo Arredondo. Gpt-4 passes the bar exam. Philosophical Transactions of the Royal Society A, 382(2270):20230254, 2024. Kirchenbauer et al. (2023) John Kirchenbauer, Jonas Geiping, Yuxin Wen, Jonathan Katz, Ian Miers, and Tom Goldstein. A watermark for large language models. arXiv preprint arXiv:2301.10226, 2023. Kotek et al. (2023) Hadas Kotek, Rikker Dockum, and David Sun. Gender bias and stereotypes in large language models. In Proceedings of the ACM collective intelligence conference, p. 12ā24, 2023. Kuditipudi et al. (2023) Rohith Kuditipudi, John Thickstun, Tatsunori Hashimoto, and Percy Liang. Robust distortion-free watermarks for language models. arXiv preprint arXiv:2307.15593, 2023. Kurita et al. (2020) Keita Kurita, Paul Michel, and Graham Neubig. Weight poisoning attacks on pre-trained models. arXiv preprint arXiv:2004.06660, 2020. Lees et al. (2022) Alyssa Lees, Vinh Q Tran, Yi Tay, Jeffrey Sorensen, Jai Gupta, Donald Metzler, and Lucy Vasserman. A new generation of perspective api: Efficient multilingual character-level transformers. In Proceedings of the 28th ACM SIGKDD conference on knowledge discovery and data mining, p. 3197ā3207, 2022. LhĆ©ritier & Cazals (2018) Alix LhĆ©ritier and FrĆ©dĆ©ric Cazals. A sequential non-parametric multivariate two-sample test. IEEE Transactions on Information Theory, 64(5):3361ā3370, 2018. Li et al. (2024) Kenneth Li, Tianle Liu, Naomi Bashkansky, David Bau, Fernanda ViĆ©gas, Hanspeter Pfister, and Martin Wattenberg. Measuring and controlling instruction (in)stability in language model dialogs. In COLM, 2024. Liu et al. (2023) Yang Liu, Dan Iter, Yichong Xu, Shuohang Wang, Ruochen Xu, and Chenguang Zhu. G-eval: Nlg evaluation using gpt-4 with better human alignment. arXiv preprint arXiv:2303.16634, 2023. Llama-team (2024) Llama-team. Introducing meta llama 3: The most capable openly available llm to date. https://ai.meta.com/blog/meta-llama-3/, 2024. Accessed: 2024-05-15. Loshchilov & Hutter (2018) Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations, 2018. Lu et al. (2024) Chris Lu, Cong Lu, Robert Tjarko Lange, Jakob Foerster, Jeff Clune, and David Ha. The ai scientist: Towards fully automated open-ended scientific discovery. arXiv preprint arXiv:2408.06292, 2024. Mesnard et al. (2024) Thomas Mesnard, Cassidy Hardin, Robert Dadashi, Surya Bhupatiraju, Shreya Pathak, Laurent Sifre, Morgane RiviĆØre, Mihir Sanjay Kale, Juliette Love, et al. Gemma: Open models based on gemini research and technology. arXiv preprint arXiv:2403.08295, 2024. Mishra et al. (2022a) Swaroop Mishra, Matthew Finlayson, Pan Lu, Leonard Tang, Sean Welleck, Chitta Baral, Tanmay Rajpurohit, Oyvind Tafjord, Ashish Sabharwal, Peter Clark, et al. Lila: A unified benchmark for mathematical reasoning. arXiv preprint arXiv:2210.17517, 2022a. Mishra et al. (2022b) Swaroop Mishra, Daniel Khashabi, Chitta Baral, and Hannaneh Hajishirzi. Cross-task generalization via natural language crowdsourcing instructions. In ACL, 2022b. Müller (1997) Alfred Müller. Integral probability metrics and their generating classes of functions. Advances in applied probability, 29(2):429ā443, 1997. Nangia et al. (2020) Nikita Nangia, Clara Vania, Rasika Bhalerao, and Samuel Bowman. Crows-pairs: A challenge dataset for measuring social biases in masked language models. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), p. 1953ā1967, 2020. Ngo et al. (2022) Richard Ngo, Lawrence Chan, and Sƶren Mindermann. The alignment problem from a deep learning perspective. arXiv preprint arXiv:2209.00626, 2022. OpenAI (2024) OpenAI. Introducing openai O(1) preview. https://openai.com/blog/introducing-openai-o1-preview/, 2024. Accessed: 2024-10-23. Pandeva et al. (2024) Teodora Pandeva, Patrick ForrĆ©, Aaditya Ramdas, and Shubhanshu Shekhar. Deep anytime-valid hypothesis testing. In AISTATS, volume 238 of Proceedings of Machine Learning Research, p. 622ā630. PMLR, 2024. Park et al. (2023) Joon Sung Park, Joseph OāBrien, Carrie Jun Cai, Meredith Ringel Morris, Percy Liang, and Michael S Bernstein. Generative agents: Interactive simulacra of human behavior. In Proceedings of the 36th annual acm symposium on user interface software and technology, p. 1ā22, 2023. Perez et al. (2022a) Ethan Perez, Saffron Huang, H. Francis Song, Trevor Cai, Roman Ring, John Aslanides, Amelia Glaese, Nat McAleese, and Geoffrey Irving. Red teaming language models with language models. In EMNLP, p. 3419ā3448. Association for Computational Linguistics, 2022a. Perez et al. (2022b) Ethan Perez, Sam Ringer, KamilÄ LukoÅ”iÅ«tÄ, Karina Nguyen, Edwin Chen, Scott Heiner, Craig Pettit, Catherine Olsson, Sandipan Kundu, Saurav Kadavath, et al. Discovering language model behaviors with model-written evaluations. arXiv preprint arXiv:2212.09251, 2022b. Perez et al. (2023) Ethan Perez, Sam Ringer, Kamile Lukosiute, Karina Nguyen, Edwin Chen, Scott Heiner, Craig Pettit, Catherine Olsson, Sandipan Kundu, Saurav Kadavath, et al. Discovering language model behaviors with model-written evaluations. In Findings of the Association for Computational Linguistics: ACL 2023, p. 13387ā13434, 2023. Phuong et al. (2024) Mary Phuong, Matthew Aitchison, Elliot Catt, Sarah Cogan, Alexandre Kaskasoli, Victoria Krakovna, David Lindner, Matthew Rahtz, Yannis Assael, Sarah Hodkinson, et al. Evaluating frontier models for dangerous capabilities. arXiv preprint arXiv:2403.13793, 2024. Podkopaev & Ramdas (2024) Aleksandr Podkopaev and Aaditya Ramdas. Sequential predictive two-sample and independence testing. Advances in neural information processing systems, 36, 2024. Pratt et al. (1981) John W Pratt, Jean D Gibbons, John W Pratt, and Jean D Gibbons. Kolmogorov-smirnov two-sample tests. Concepts of nonparametric theory, p. 318ā344, 1981. Qi et al. (2023) Xiangyu Qi, Yi Zeng, Tinghao Xie, Pin-Yu Chen, Ruoxi Jia, Prateek Mittal, and Peter Henderson. Fine-tuning aligned language models compromises safety, even when users do not intend to! arXiv preprint arXiv:2310.03693, 2023. Rajpurkar et al. (2018) Pranav Rajpurkar, Robin Jia, and Percy Liang. Know what you donāt know: Unanswerable questions for squad. arXiv preprint arXiv:1806.03822, 2018. Ramdas et al. (2023) Aaditya Ramdas, Peter Grünwald, Vladimir Vovk, and Glenn Shafer. Game-theoretic statistics and safe anytime-valid inference. Statistical Science, 38(4):576ā601, 2023. Robbins (1970) Herbert Robbins. Statistical methods related to the law of the iterated logarithm. The Annals of Mathematical Statistics, 41(5):1397ā1409, 1970. Rosenthal et al. (2021) Sara Rosenthal, Pepa Atanasova, Georgi Karadzhov, Marcos Zampieri, and Preslav Nakov. Solid: A large-scale semi-supervised dataset for offensive language identification. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, p. 915ā928, 2021. Shafer (2021) Glenn Shafer. Testing by betting: A strategy for statistical and scientific communication. Journal of the Royal Statistical Society Series A: Statistics in Society, 184(2):407ā431, 2021. Sharma et al. (2023) Mrinank Sharma, Meg Tong, Tomasz Korbak, David Duvenaud, Amanda Askell, Samuel R Bowman, Esin DURMUS, Zac Hatfield-Dodds, Scott R Johnston, Shauna M Kravec, et al. Towards understanding sycophancy in language models. In The Twelfth International Conference on Learning Representations, 2023. Shekhar & Ramdas (2023) Shubhanshu Shekhar and Aaditya Ramdas. Nonparametric two-sample testing by betting. IEEE Transactions on Information Theory, 2023. Srivastava et al. (2022) Aarohi Srivastava, Abhinav Rastogi, Abhishek Rao, Abu Awal Md Shoeb, Abubakar Abid, Adam Fisch, Adam R Brown, Adam Santoro, Aditya Gupta, AdriĆ Garriga-Alonso, et al. Beyond the imitation game: Quantifying and extrapolating the capabilities of language models. arXiv preprint arXiv:2206.04615, 2022. Tharwat & Schenck (2023) Alaa Tharwat and Wolfram Schenck. A survey on active learning: State-of-the-art, practical challenges and research directions. Mathematics, 11(4):820, 2023. Tonmoy et al. (2024) SM Tonmoy, SM Zaman, Vinija Jain, Anku Rani, Vipula Rawte, Aman Chadha, and Amitava Das. A comprehensive survey of hallucination mitigation techniques in large language models. arXiv preprint arXiv:2401.01313, 2024. Ćstün et al. (2024) Ahmet Ćstün, Viraat Aryabumi, Zheng-Xin Yong, Wei-Yin Ko, Daniel Dāsouza, Gbemileke Onilude, Neel Bhandari, Shivalika Singh, Hui-Lee Ooi, Amr Kayid, et al. Aya model: An instruction finetuned open-access multilingual language model. arXiv preprint arXiv:2402.07827, 2024. Varshney et al. (2023) Neeraj Varshney, Wenlin Yao, Hongming Zhang, Jianshu Chen, and Dong Yu. A stitch in time saves nine: Detecting and mitigating hallucinations of llms by validating low-confidence generation. arXiv preprint arXiv:2307.03987, 2023. Vidgen et al. (2020) Bertie Vidgen, Tristan Thrush, Zeerak Waseem, and Douwe Kiela. Learning from the worst: Dynamically generated datasets to improve online hate detection. arXiv preprint arXiv:2012.15761, 2020. Ville (1939) Jean Ville. Etude critique de la notion de collectif. Gauthier-Villars Paris, 1939. Wald (1945) A Wald. Sequential tests of statistical hypotheses. The Annals of Mathematical Statistics, 16(2):117ā186, 1945. Wang et al. (2023a) Boxin Wang, Weixin Chen, Hengzhi Pei, Chulin Xie, Mintong Kang, Chenhui Zhang, Chejian Xu, Zidi Xiong, Ritik Dutta, Rylan Schaeffer, Sang T. Truong, Simran Arora, Mantas Mazeika, Dan Hendrycks, Zinan Lin, Yu Cheng, Sanmi Koyejo, Dawn Song, and Bo Li. Decodingtrust: A comprehensive assessment of trustworthiness in GPT models. In NeurIPS, 2023a. Wang et al. (2023b) Jiaan Wang, Yunlong Liang, Fandong Meng, Zengkui Sun, Haoxiang Shi, Zhixu Li, Jinan Xu, Jianfeng Qu, and Jie Zhou. Is chatgpt a good nlg evaluator? a preliminary study. arXiv preprint arXiv:2303.04048, 2023b. Wang et al. (2022) Yizhong Wang, Swaroop Mishra, Pegah Alipoormolabashi, Yeganeh Kordi, Amirreza Mirzaei, Anjana Arunkumar, Arjun Ashok, Arut Selvan Dhanasekaran, Atharva Naik, David Stap, et al. Super-naturalinstructions:generalization via declarative instructions on 1600+ tasks. In EMNLP, 2022. Wang et al. (2023c) Yizhong Wang, Hamish Ivison, Pradeep Dasigi, Jack Hessel, Tushar Khot, Khyathi Chandu, David Wadden, Kelsey MacMillan, Noah A Smith, Iz Beltagy, et al. How far can camels go? exploring the state of instruction tuning on open resources. Advances in Neural Information Processing Systems, 36:74764ā74786, 2023c. Wang et al. (2024) Yubo Wang, Xueguang Ma, Ge Zhang, Yuansheng Ni, Abhranil Chandra, Shiguang Guo, Weiming Ren, Aaran Arulraj, Xuan He, Ziyan Jiang, et al. Mmlu-pro: A more robust and challenging multi-task language understanding benchmark. arXiv preprint arXiv:2406.01574, 2024. Weng et al. (2023) Jiasi Weng, Jian Weng, Gui Tang, Anjia Yang, Ming Li, and Jia-Nan Liu. pvcnn: Privacy-preserving and verifiable convolutional neural network testing. IEEE Transactions on Information Forensics and Security, 18:2218ā2233, 2023. Wolf et al. (2023) Yotam Wolf, Noam Wies, Yoav Levine, and Amnon Shashua. Fundamental limitations of alignment in large language models. arXiv preprint arXiv:2304.11082, 2023. Wolf et al. (2024) Yotam Wolf, Noam Wies, Oshri Avnery, Yoav Levine, and Amnon Shashua. Fundamental limitations of alignment in large language models. In Forty-first International Conference on Machine Learning, 2024. Yoo et al. (2023) KiYoon Yoo, Wonhyuk Ahn, Jiho Jang, and Nojun Kwak. Robust multi-bit natural language watermarking through invariant features. In Anna Rogers, Jordan Boyd-Graber, and Naoaki Okazaki (eds.), Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), p. 2092ā2115, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.acl-long.117. URL https://aclanthology.org/2023.acl-long.117. Zampieri et al. (2019) Marcos Zampieri, Shervin Malmasi, Preslav Nakov, Sara Rosenthal, Noura Farra, and Ritesh Kumar. Predicting the type and target of offensive posts in social media. In Proceedings of NAACL-HLT, p. 1415ā1420, 2019. Zhang et al. (2024) Tianyi Zhang, Faisal Ladhak, Esin Durmus, Percy Liang, Kathleen McKeown, and Tatsunori B. Hashimoto. Benchmarking large language models for news summarization. Transactions of the Association for Computational Linguistics, 12:39ā57, 2024. doi: 10.1162/tacl_a_00632. URL https://aclanthology.org/2024.tacl-1.3. Zhang et al. (2022) Zhexin Zhang, Jiale Cheng, Hao Sun, Jiawen Deng, Fei Mi, Yasheng Wang, Lifeng Shang, and Minlie Huang. Constructing highly inductive contexts for dialogue safety through controllable reverse generation. In Findings of the Association for Computational Linguistics: EMNLP 2022, p. 3684ā3697, 2022. Zhao et al. (2018) Jieyu Zhao, Tianlu Wang, Mark Yatskar, Vicente Ordonez, and Kai-Wei Chang. Gender bias in coreference resolution: Evaluation and debiasing methods. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), p. 15ā20, 2018. Zhu et al. (2018) Jiren Zhu, Russell Kaplan, Justin Johnson, and Li Fei-Fei. Hidden: Hiding data with deep networks. In Proceedings of the European conference on computer vision (ECCV), p. 657ā672, 2018. Zou et al. (2023a) Andy Zou, Long Phan, Sarah Chen, James Campbell, Phillip Guo, Richard Ren, Alexander Pan, Xuwang Yin, Mantas Mazeika, Ann-Kathrin Dombrowski, et al. Representation engineering: A top-down approach to ai transparency. arXiv preprint arXiv:2310.01405, 2023a. Zou et al. (2023b) Andy Zou, Zifan Wang, Nicholas Carlini, Milad Nasr, J Zico Kolter, and Matt Fredrikson. Universal and transferable adversarial attacks on aligned language models. arXiv preprint arXiv:2307.15043, 2023b. Appendix A Experimental Details A.1 Setup We assess the efficacy of our proposed auditing test for BSA using three base models: Llama3 (8B-Instruct) (Llama-team, 2024), Gemma (1.1-7b-it) (Mesnard et al., 2024), and Mistral (7B-Instruct-v0.2) (Jiang et al., 2023). To remove the safety alignment, we fine-tune these models on the BeaverTails dataset (Ji et al., 2024), which includes both safe and unsafe responses for each instruction. We use a subset of 50K instances from the dataset, each comprising an instruction paired with its corresponding unsafe response. The training involves 512 steps, with a batch size of 64, utilizing the AdamW optimizer (Loshchilov & Hutter, 2018) with a learning rate of 2Ć10ā42superscript1042Ć 10^-42 Ć 10- 4 and no weight decay. Due to computational constraints, we apply LoRA (Hu et al., 2021), with a rank of 16, to all models. All experiments were conducted on a single Nvidia A100 (80GB) GPU. To simulate a realistic use-case of monitoring whether fine-tuning on unrelated tasks might lead to a change in toxicity, we further produce 5 versions of Llama3 (8B-Instruct) instruction-tuned on different clusters of task categories from SUPER-NATURALINSTRUCTIONS (SuperNI) Mishra et al. (2022b); Wang et al. (2022). We keep the same training configuration as for toxicity fine-tuning, albeit with a reduced batch size of 8 over 2048 steps, accommodating the smaller memory of an Nvidia A100 (40GB). See table 1 for a summary of the category clusters used. Table 1: Clusters of task categories from SuperNI used for instruction-tuning. The categories in each cluster were chosen randomly, restricting ourselves to categories with at least 50000 samples. Cluster 1 Cluster 2 Cluster 3 Cluster 4 Cluster 5 Program Execution Gender Classification Code to Text Text to Code Data to Text POS Tagging Commonsense Classification Stereotype Detection Linguistic Probing Word Semantics Mathematics Translation Sentence Perturbation Language Identification Question Rewriting Table 2: Sampling parameters during evaluation. Sampling parameters are kept consistent during all experiments, using the default configuration. To derive a tolerance parameter ϵitalic-ϵεϵ in section 5.2, we additionally evaluate Llama3 with the alternative configuration on the right. Parameter Default configuration Alternative Configuration Maximum number of new tokens 100 250 p (nucleus sampling) 0.9 0.7 Temperature 0.7 1.2 As an independent toxic reference model, we use another Llama3-8B model instruction-tuned on the OEvortex/uncensored-vortex dataset, which we refer to as āUncensored Llama3-8B". This model was also trained using LoRA with a rank of 16, and trained over 200 steps with a total batch size of 8 and gradient accumulation. To examine potential shifts in translation performance, we analyze a subset of English-French and English-Spanish samples drawn from tasks categorized as ātranslation" within SuperNI. This subset comprises a total of 67,975 prompts. A.2 Toxicity Evaluations We compare toxicity scores across Llama3, Gemma, and Mistral models. Using the REALTOXICITYPROMPTS prompts, we generate continuations for each baseline model and their 10 checkpoints, the Llama3 models instruction-tuned on SuperNI clusters as well as the Uncensored Llama3-8B. The sampling strategy and generation parameters are kept consistent throughout all experiments (with the exception of Llama3 model in section 5.2) and are compiled in table 2. We then evaluate the generated textsā toxicity using Perspective API, a machine learning tool developed by Jigsaw designed to identify toxic or harmful content in user-generated comments and discussions. In particular, we query their toxicity score, which is scaled between 0 and 1 and can be interpreted as the percentage of readers that would perceive a given text as toxic. Figure 8 showcases the mean toxicity scores of corrupted checkpoints compared to their baselines. The alternative sampling parameters in table 2 were informed by practical knowledge and chosen with two considerations in mind: First, sampling parameters should be ārealistic" and not be extreme enough to cause the model to only output āgibberish". Second, sampling parameters should be different enough to cause some change in the modelās behavior. (a) Llama (b) Gemma (c) Mistral Figure 8: Mean toxicity for aligned baseline models and corrupted checkpoints. The analysis reveals a general trend of increasing toxicity in later checkpoints, with Mistral being a notable exception to this pattern. Gemma exhibits the lowest baseline toxicity score among the models. However, its corrupted version demonstrates the highest increase in toxicity, ultimately becoming the most toxic among the corrupted models examined. A.3 Evaluation of Translation Performance We assess the performance of Llama3 (8B-Instruct) and Aya-23-8b (Ćstün et al. (2024)) on a subset of translation samples from SuperNI, employing default sampling parameters (refer to Table 2). For Llama3, we conduct evaluations using both a simple prompt template and a few-shot prompting approach, an example of the latter can be found in listing LABEL:lst:fewshot-example. Listing 1: Few-Shot Prompt Example for Translation Task ⬠### Instruction: Translate the following French sentences into English. ### Positive Examples: 1. Input: Bonjour, comment Ƨa va? Output: Hello, how are you? 2. Input: Je māappelle Pierre. Output: My name is Pierre. ### Negative Examples: 1. Input: Il fait chaud aujourdāhui. Output: It is cold today. ### Input: Jāaime apprendre de nouvelles langues. ### Output: A.4 Betting Score Network The core component of our algorithm is the wealth WtsubscriptW_tWitalic_t and its update by the betting score StsubscriptS_tSitalic_t after observing a new batch of data. We choose a simple multi-layer perceptron with ReLU activation functions, layer normalization, and dropout (Pandeva et al., 2024) as the network Ļitalic-ĻĻĻ in the calculation of the betting score. The network is updated using gradient ascent, with a learning rate of 0.00050.00050.00050.0005 and trained for 100100100100 epochs or until early stopping, using the accumulated data from all previous sequences. A.5 Neural Net Distance We approximate the neural net distance between two distributions utilizing the same model as for the betting score. This is a biased estimator, as the true neural net distance is defined as a supremum over all machine learning models ĻĪøsubscriptitalic-Ļ _ĪøĻitalic_Īø of class Φ Φ (see definition (1)). While estimates using larger training sets will generally provide more accurate estimates, they are not necessary the most useful in practice: ⢠Setting the hyperparameter ϵitalic-ϵεϵ (maximal tolerated neural net distance) may require expensive querying of reference models on large datasets to achieve convergence (Figure 9). ⢠Using estimates derived from large training sets reduces test power in low-sample regimes, where the betting score network has access to limited training data. Given a batch size b and a static upper bound on the maximum of samples per test N, we thus use the following estimator for the neural net distance: ^b,N=12ā¢(ā¢[S11/b]+ā¢[STā11/b])subscript^12delimited-[]superscriptsubscript11delimited-[]superscriptsubscript11 D_b,N= 12 (E [S_1^1% /b ]+E [S_T-1^1/b ] )over start_ARG D end_ARGb , N = divide start_ARG 1 end_ARG start_ARG 2 end_ARG ( blackboard_E [ S11 / b ] + blackboard_E [ Sitalic_T - 11 / b ] ) (10) where St=āi=1b(1+ĻĪøtā1ā¢(Bā¢(xi,Maā¢(xi)))āĻĪøtā1ā¢(Bā¢(xi,Mā¢(xi)))expā”(ϵ))subscriptsuperscriptsubscriptproduct11subscriptitalic-Ļsubscript1subscriptsuperscriptsubscriptsubscriptitalic-Ļsubscript1subscriptsubscriptitalic-ϵ S_t= _i=1^b ( 1+ _ _t-1 (B(x_% i,M^a(x_i)) )- _ _t-1 (B(x_i,M(x_i)) )% (ε) )Sitalic_t = āi = 1b ( divide start_ARG 1 + Ļitalic_Īø start_POSTSUBSCRIPT t - 1 end_POSTSUBSCRIPT ( B ( xitalic_i , Mitalic_a ( xitalic_i ) ) ) - Ļitalic_Īø start_POSTSUBSCRIPT t - 1 end_POSTSUBSCRIPT ( B ( xitalic_i , M ( xitalic_i ) ) ) end_ARG start_ARG exp ( ϵ ) end_ARG ) (11) and T:=āNbāassignT:= Nb := ā divide start_ARG N end_ARG start_ARG b end_ARG ā. This average combines the estimate of the betting score on a single new example using (1) the model Ļitalic-ĻĻĻ trained on a single batch of b samples and (2) the model Ļitalic-ĻĻĻ after training on bā (Tā1)ā 1bĀ·(T-1)b ā ( T - 1 ) samples, representing a simple heuristic for the average neural net distance a model might achieve in the test. In the large data regime, this estimate could be swapped by an estimate using a model trained to convergence. Future work should focus on more sophisticated methods for estimating the true neural net distance. A.5.1 Case Study of Neural Net Convergence Figure 9: Estimated neural net distance between toxicity distributions of Llama3 and various model versions. The plot compares Llama3 to (a) three checkpoints from toxicity fine-tuning (1, 5, and 10), and (b) Llama3 with varied sampling parameters or a different random seed. The x-axis shows the number of training samples on a logarithmic scale. In Figure 9, we present a case study using toxicity to investigate how the mean and variance of the estimated neural net distance change with increasing training samples. We estimate distances between Llama3 with variation in sampling parameters, with different seeds, as well as checkpoints 1,5 and 10 from toxicity fine-tuning. Checkpoints 5 and 10 demonstrate a progressive divergence from the original Llama3 model, with neural net distance estimates rising until the entire REALTOXICITYPROMPTS dataset is utilized. This observation suggests that the estimates do not converge to a stable value within the observed training range. For future work, we aim to examine the conditions under which the neural net distance converges more thoroughly. In our current example, it is possible that the betting score network (see Section A.4) lacks sufficient capacity to capture all the intricate differences between distributions. Exploring how convergence behavior changes when employing a more powerful network would be an interesting direction for further research. Appendix B Deferred Derivations and Proofs B.1 Two-Sample Testing with Tolerance Assume that X,Y:ā[0,1]:ā01X,Y:Xā[0,1]X , Y : X ā [ 0 , 1 ] are two random variables distributed according to PXsubscriptP_XPitalic_X and PYsubscriptP_YPitalic_Y respectively. For some fixed ϵ>0italic-ϵ0ε>0ϵ > 0, we want to test whether those two distributions are ϵitalic-ϵεϵ-close: :ā¢(PX,PY)ā¤Ļµvs:ā¢(PX,PY)>ϵ:subscript0subscriptsubscriptitalic-ϵvssubscript1:subscriptsubscriptitalic-ϵ _0:D(P_X,P_Y)ā¤Īµ % _1:D(P_X,P_Y)> _0 : D ( Pitalic_X , Pitalic_Y ) ⤠ϵ vs Hbold_1 : D ( Pitalic_X , Pitalic_Y ) > ϵ where DD is a distance metric between probability distributions. To simplify later notation, we rewrite this in the following way (Shekhar & Ramdas, 2023): :P:=PXĆPYā0vs:P:=PXĆPYā1 _0:P:=P_XĆ P_Y _0 % vs _1:P:=P_XĆ P_Y _1Hbold_0 : P := Pitalic_X Ć Pitalic_Y ā P0 vs Hbold_1 : P := Pitalic_X Ć Pitalic_Y ā P1 (12) where 0:=PXĆPYāā¢(Ć):PX,PYāā¢()⢠and ā¢(PX,PY)ā¤Ļµassignsubscript0conditional-setsubscriptsubscriptsubscriptsubscript and subscriptsubscriptitalic-ϵ _0:=\P_XĆ P_Y (X% ĆX):P_X,P_Y (X) and % D(P_X,P_Y)ā¤Īµ\P0 := Pitalic_X Ć Pitalic_Y ā P ( X Ć X ) : Pitalic_X , Pitalic_Y ā P ( X ) and D ( Pitalic_X , Pitalic_Y ) ⤠ϵ (13) and 1:=PXĆPYāā¢(Ć):PX,PYāā¢()⢠and ā¢(PX,PY)ā¤Ļµassignsubscript1conditional-setsubscriptsubscriptsubscriptsubscript and subscriptsubscriptitalic-ϵ _1:=\P_XĆ P_Y (X% ĆX):P_X,P_Y (X) and % D(P_X,P_Y)ā¤Īµ\P1 := Pitalic_X Ć Pitalic_Y ā P ( X Ć X ) : Pitalic_X , Pitalic_Y ā P ( X ) and D ( Pitalic_X , Pitalic_Y ) ⤠ϵ (14) This is a two-sample non-parametric test with composite null and alternative hypothesis. Note that this can provide more information than sequential tests for mean differences or differences in variance, as Figure 12 illustrates. Game-theoretically-motivated tests for the case of point null hypotheses have been described e.g., in Shekhar & Ramdas (2023); Pandeva et al. (2024). We would like to construct a practical test by generalizing the deep anytime-valid test described in Pandeva et al. (2024) to the composite setting. Pandeva et al. (2024)ās main theoretical insight is two-fold. First - inspired by the universal approximation theorem777While the universal approximation theorem (Hornik et al., 1989) doesnāt directly apply here as we are dealing with finite-width and finite-depth networks, it inspires our approach. Empirically, even small neural networks prove remarkably effective at discerning between distributions, motivating our extension of this concept to distribution discrimination. (Hornik et al., 1989) - deep learning models can be used to distinguish between distributions i.e., if PXā PYsubscriptsubscriptP_Xā P_YPitalic_X ā Pitalic_Y, then supgāX,Yā¢[gā¢(X)āgā¢(Y)]>0subscriptsupremumsubscriptdelimited-[]0 _g E_X,Y[g(X)-g(Y)]>0supitalic_g ā G blackboard_EX , Y [ g ( X ) - g ( Y ) ] > 0 (15) where =gĪø:ĪøāĪconditional-setsubscriptĪG=\g_Īø:Īøā \G = gitalic_Īø : Īø ā Ī is a set of machine learning models parameterized by Īø. Second, if we restrict the class of machine learning models to satisfy some weak properties (Pandeva et al., 2024, Assumption 1), we can establish the equivalence supgāX,Yā¢[gā¢(X)āgā¢(Y)]>0āsupgāX,Yā¢[logā”(1+gā¢(X)āgā¢(Y))]>0formulae-sequencesubscriptsupremumsubscriptdelimited-[]0āsubscriptsupremumsubscriptdelimited-[]10 _g E_X,Y[g(X)-g(Y)]>0 % _g E_X,Y [ (1+g(X)-g(% Y)) ]>0supitalic_g ā G blackboard_EX , Y [ g ( X ) - g ( Y ) ] > 0 ā supitalic_g ā G blackboard_EX , Y [ log ( 1 + g ( X ) - g ( Y ) ) ] > 0 (16) which is then used to define a betting score and wealth process. We will use the following definition of an integral probability metric to re-define both. Definition 2 (Integral probability metric). An integral probability metric is a distance between probability distributions over a set XX, defined by a class ~~ Gover~ start_ARG G end_ARG of real-valued functions on XX: ~ā¢(PX,PY)subscript~subscriptsubscript _ G(P_X,P_Y)Dover~ start_ARG G end_ARG ( Pitalic_X , Pitalic_Y ) =supā«gā¢(x)ā¢pXā¢(x)ā¢xāā«gā¢(y)ā¢pYā¢(y)ā¢yā£g:āā,gā~absentsupremumconditional-setsubscriptsubscriptdifferential-dsubscriptsubscriptdifferential-d:formulae-sequenceāā~ = \ _Xg(x)p_X(x)dx- _Xg(% y)p_Y(y)dy g:X ,gā G \= sup ā«X g ( x ) pitalic_X ( x ) d x - ā«X g ( y ) pitalic_Y ( y ) d y ⣠g : X ā blackboard_R , g ā over~ start_ARG G end_ARG =supgā~Xā¼PX,Yā¼PYā¢[gā¢(X)āgā¢(Y)]absentsubscriptsupremum~subscriptformulae-sequencesimilar-tosubscriptsimilar-tosubscriptdelimited-[] = _gā GE_X P_X,Y P_Y% [g(X)-g(Y)]= supitalic_g ā over~ start_ARG G end_ARG blackboard_EX ā¼ P start_POSTSUBSCRIPT X , Y ā¼ Pitalic_Y end_POSTSUBSCRIPT [ g ( X ) - g ( Y ) ] Regardless of the choice of ~~ Gover~ start_ARG G end_ARG, this distance measure satisfies all properties of a metric except positive-definiteness, in which case we could call it a pseudo-metric. We will define our ācustom" neural net distance for the problem at hand as Definition 3 (Neural Net Distance). Let =[0,1]01X=[0,1]X = [ 0 , 1 ] and let =gĪø:ĪøāĪøconditional-setsubscriptG=\g_Īø:ĪøāĪø\G = gitalic_Īø : Īø ā Īø be the class of machine learning models that satisfies the following properties (Pandeva et al., 2024, Assumption 1) ⢠|gā¢(x)|ā¤q|g(x)|⤠q| g ( x ) | ⤠q for all gāg ā G and for all xā[0,1]01xā[0,1]x ā [ 0 , 1 ] and for some qā(0,1/2)012qā(0,1/2)q ā ( 0 , 1 / 2 ) ⢠If gāg ā G, then so is cā gā cĀ· gc ā g for every cā[ā1,1]11cā[-1,1]c ā [ - 1 , 1 ] Then we define the neural net distance GsubscriptD_GDitalic_G by ā¢(PX,PY)=supgāXā¼PX,Yā¼PYā¢[gā¢(X)āgā¢(Y)]subscriptsubscriptsubscriptsubscriptsupremumsubscriptformulae-sequencesimilar-tosubscriptsimilar-tosubscriptdelimited-[] _G(P_X,P_Y)= _g % E_X P_X,Y P_Y[g(X)-g(Y)]Dcaligraphic_G ( Pitalic_X , Pitalic_Y ) = supitalic_g ā G blackboard_EX ā¼ P start_POSTSUBSCRIPT X , Y ā¼ Pitalic_Y end_POSTSUBSCRIPT [ g ( X ) - g ( Y ) ] (17) We will use this neural net distance to measure the distance between distributions PXsubscriptP_XPitalic_X and PYsubscriptP_YPitalic_Y. The definition is motivated by the fact that we will be using neural networks of this class GG to calculate a betting score. By using this definition, we can make sure that our test is ācalibrated correctly" i.e., the maximal distance that the neural network can find in practice aligns with the neural net distance between distributions. B.1.1 Oracle Test Given ϵitalic-ϵεϵ as the upper bound on the neural net distance between two probability distributions we want to tolerate, we let eq. (17) and the equivalence in (16) guide our intuition to define an e-variable E for 0subscript0P_0P0: E:=1+gāā¢(X)āgāā¢(Y)expā”(ϵ)assign1superscriptsuperscriptitalic-ϵ E:= 1+g^*(X)-g^*(Y) (ε)E := divide start_ARG 1 + gā ( X ) - gā ( Y ) end_ARG start_ARG exp ( ϵ ) end_ARG (18) where gāāsuperscriptg^* ā ā G is the argā¢supsupremum sup of X,Yā¢[logā”(1+gā¢(X)āgā¢(Y))]subscriptdelimited-[]1E_X,Y[ (1+g(X)-g(Y) )]blackboard_EX , Y [ log ( 1 + g ( X ) - g ( Y ) ) ] i.e., the log -optimal function in GG. To show that this is indeed an e-variable, we use the definition of the neural net distance 3: X,Yā¢[E]subscriptdelimited-[] _X,Y[E]blackboard_EX , Y [ E ] =X,Yā¢[1+gāā¢(X)āgāā¢(Y)expā”(ϵ)]absentsubscriptdelimited-[]1superscriptsuperscriptitalic-ϵ =E_X,Y [ 1+g^*(X)-g^*(Y) (ε) ]= blackboard_EX , Y [ divide start_ARG 1 + gā ( X ) - gā ( Y ) end_ARG start_ARG exp ( ϵ ) end_ARG ] =1expā”(ϵ)ā¢X,Yā¢[1+gāā¢(X)āgāā¢(Y)]absent1italic-ϵsubscriptdelimited-[]1superscriptsuperscript = 1 (ε)E_X,Y[1+g^*(X)-g^*(Y)]= divide start_ARG 1 end_ARG start_ARG exp ( ϵ ) end_ARG blackboard_EX , Y [ 1 + gā ( X ) - gā ( Y ) ] ā¤1expā”(ϵ)ā¢(1+supgāX,Yā¢[gā¢(X)āgā¢(Y)])absent1italic-ϵ1subscriptsupremumsubscriptdelimited-[] ⤠1 (ε) (1+ _g % E_X,Y[g(X)-g(Y)] )⤠divide start_ARG 1 end_ARG start_ARG exp ( ϵ ) end_ARG ( 1 + supitalic_g ā G blackboard_EX , Y [ g ( X ) - g ( Y ) ] ) =1expā”(ϵ)ā¢(1+ā¢(PX,PY))absent1italic-ϵ1subscriptsubscriptsubscript = 1 (ε) (1+D_G(P_X,% P_Y) )= divide start_ARG 1 end_ARG start_ARG exp ( ϵ ) end_ARG ( 1 + Dcaligraphic_G ( Pitalic_X , Pitalic_Y ) ) ā¤1+ϵexpā”(ϵ)ā¤1for all ā¢PXĆPYā0formulae-sequenceabsent1italic-ϵitalic-ϵ1for all subscriptsubscriptsubscript0 ⤠1+ε (ε)⤠1 all P_% XĆ P_Y _0⤠divide start_ARG 1 + ϵ end_ARG start_ARG exp ( ϵ ) end_ARG ⤠1 for all Pitalic_X Ć Pitalic_Y ā P0 Analogously to Pandeva et al. (2024), we use this to define the oracle sequential test γā=inftā„1:Wtāā„1/αsuperscriptinfimumconditional-set1superscriptsubscript1 γ^*= \tā„ 1:W_t^*ā„ 1/α\γā = inf t ā„ 1 : Witalic_tā ā„ 1 / α (19) where Wtā=āl=1tā(x,y)āBl(1+gāā¢(x)āgāā¢(y)expā”(ϵ))subscriptsuperscriptsuperscriptsubscriptproduct1subscriptproductsubscript1superscriptsuperscriptitalic-ϵ W^*_t= _l=1^t _(x,y)ā B_l ( 1+g^% *(x)-g^*(y) (ε) )Wāitalic_t = āl = 1t ā( x , y ) ā B start_POSTSUBSCRIPT l end_POSTSUBSCRIPT ( divide start_ARG 1 + gā ( x ) - gā ( y ) end_ARG start_ARG exp ( ϵ ) end_ARG ) (20) As a product of e-variables, Wtātā„1subscriptsubscriptsuperscript1\W^*_t\_tā„ 1 Wāitalic_t t ā„ 1 is an e-process, since for all tā„11tā„ 1t ā„ 1 and PXĆPYā0subscriptsubscriptsubscript0P_XĆ P_Y _0Pitalic_X Ć Pitalic_Y ā P0 ā¢[Wtā]ā¢ā¤(Xi,Yi)⢠i.i.d.ā¢(1+ā¢(PX,PY)expā”(ϵ)āā¤1)t+bā¤1delimited-[]subscriptsuperscriptsubscriptsubscript i.i.d.superscriptsubscriptā1subscriptsubscriptsubscriptitalic-ϵabsent11 [W^*_t] (X_i,Y_i) i.i.d.ā¤% ( 1+D_G(P_X,P_Y) (% ε)_⤠1 )^t+b⤠1blackboard_E [ Wāitalic_t ] start_OVERACCENT ( Xitalic_i , Yitalic_i ) i.i.d. end_OVERACCENT start_ARG ⤠end_ARG ( underā start_ARG divide start_ARG 1 + Dcaligraphic_G ( Pitalic_X , Pitalic_Y ) end_ARG start_ARG exp ( ϵ ) end_ARG end_ARG⤠1 )t + b ⤠1 The oracle sequential test is a sequential level-α-test of power one, meaning the Type I error (α-error) is guaranteed to be bounded by α and the Type I error (β-error) converges to 0 in the limit of infinite samples. An application of Villeās inequality (Ville, 1939; Ramdas et al., 2023) Pā¢(Wtāā„1/α)ā¤Ī±for every ā¢tā„1,Pā0formulae-sequencesubscriptsuperscript1formulae-sequencefor every 1subscript0 P(W^*_tā„ 1/α)ā¤Ī± every tā„ 1% ,P _0P ( Wāitalic_t ā„ 1 / α ) ⤠α for every t ā„ 1 , P ā P0 (21) yields the first condition āā¢(γā<ā)ā¤Ī±subscriptāsubscript0superscriptP_H_0(γ^*<ā)⤠_PH start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ( γā < ā ) ⤠α. We also need to show consistency i.e., Pā¢(γ<ā)=1āPā¢(Wtā<1/α⢠for all ā¢tā„1)=0for every ā¢Pā1ā1formulae-sequencesubscriptsuperscript1 for all 10for every subscript1 P(γ<ā)=1 P(\W^*_t<1/α % for all tā„ 1\)=0 every P _1P ( γ < ā ) = 1 ā P ( Wāitalic_t < 1 / α for all t ā„ 1 ) = 0 for every P ā P1 (22) To do this, we will show the following proposition first: Proposition 2 (Correspondence between Distance and Betting Score). A:=supgāX,Yā¢[gā¢(X)āgā¢(Y)āϵ]>0āB:=supgāX,Yā¢[logā”(1+gā¢(X)āgā¢(Y)expā”(ϵ))]>0formulae-sequenceassignsubscriptsupremumsubscriptdelimited-[]italic-ϵ0assignāsubscriptsupremumsubscriptdelimited-[]1italic-ϵ0 A:= _g E_X,Y[g(X)-g(Y)-ε]>0% B:= _g E_X,Y[ (% 1+g(X)-g(Y) (ε) )]>0A := supitalic_g ā G blackboard_EX , Y [ g ( X ) - g ( Y ) - ϵ ] > 0 ā B := supitalic_g ā G blackboard_EX , Y [ log ( divide start_ARG 1 + g ( X ) - g ( Y ) end_ARG start_ARG exp ( ϵ ) end_ARG ) ] > 0 Proof. This is a simple corollary of (Pandeva et al., 2024, Proposition 4.2) and the fact that supgāX,Y[log(1+gā¢(X)āgā¢(Y)expā”(ϵ))]=supgāX,Y[log(1+g(X)āg(Y)]āϵ _g E_X,Y [ ( 1+g(X% )-g(Y) (ε) ) ]= _g E_X,Y% [ (1+g(X)-g(Y) ]- _g ā G blackboard_EX , Y [ log ( divide start_ARG 1 + g ( X ) - g ( Y ) end_ARG start_ARG exp ( ϵ ) end_ARG ) ] = supitalic_g ā G blackboard_EX , Y [ log ( 1 + g ( X ) - g ( Y ) ] - ϵ ā Proposition 3 (Consistency of the Oracle Test). Pā¢(γ<ā)=1āPā¢(Wtā<1/α⢠for all ā¢tā„1)=0for every ā¢Pā1ā1formulae-sequencesubscriptsuperscript1 for all 10for every subscript1 P(γ<ā)=1 P(\W^*_t<1/α % for all tā„ 1\)=0 every P _1P ( γ < ā ) = 1 ā P ( Wāitalic_t < 1 / α for all t ā„ 1 ) = 0 for every P ā P1 (23) Proof. First, observe that proposition (2) implies that whenever PXĆPYā1subscriptsubscriptsubscript1P_XĆ P_Y _1Pitalic_X Ć Pitalic_Y ā P1 i.e., ā¢(PX,PY)>ϵsubscriptsubscriptsubscriptitalic-ϵD_G(P_X,P_Y)> _G ( Pitalic_X , Pitalic_Y ) > ϵ, the supremum supgāX,Yā¢[logā”(1+gā¢(X)āgā¢(Y)expā”(ϵ))]subscriptsupremumsubscriptdelimited-[]1italic-ϵ _g E_X,Y [ ( 1+g(X)-g(Y) (% ε) ) ]supitalic_g ā G blackboard_EX , Y [ log ( divide start_ARG 1 + g ( X ) - g ( Y ) end_ARG start_ARG exp ( ϵ ) end_ARG ) ] is positive. Define Stā:=ā(x,y)āBt(1+gāā¢(x)āgāā¢(y)expā”(ϵ))assignsubscriptsuperscriptsubscriptproductsubscript1superscriptsuperscriptitalic-ϵ S^*_t:= _(x,y)ā B_t ( 1+g^*(x)-g^*(y)% (ε) )Sāitalic_t := ā( x , y ) ā B start_POSTSUBSCRIPT t end_POSTSUBSCRIPT ( divide start_ARG 1 + gā ( x ) - gā ( y ) end_ARG start_ARG exp ( ϵ ) end_ARG ) (24) where gā=argā¢supgāX,Yā¢[logā”(1+gā¢(X)āgā¢(Y))]superscriptsubscriptsupremumsubscriptdelimited-[]1g^*= _g E_X,Y[ (1+g(X)-g(Y) )]gā = arg supitalic_g ā G blackboard_EX , Y [ log ( 1 + g ( X ) - g ( Y ) ) ] is the log-optimum. Then we can write in short: Wtā=āi=1tSiāsubscriptsuperscriptsuperscriptsubscriptproduct1subscriptsuperscriptW^*_t= _i=1^tS^*_iWāitalic_t = āi = 1t Sāitalic_i. All StāsubscriptsuperscriptS^*_tSāitalic_t are i.i.d. Lastly, we define Tt:=logā”Wtā=āi=1tlogā”(Stā)assignsubscriptsubscriptsuperscriptsuperscriptsubscript1subscriptsuperscriptT_t:= W^*_t= _i=1^t (S^*_t)Titalic_t := log Wāitalic_t = āi = 1t log ( Sāitalic_t ). By the law of large numbers 1tā¢Tt=1tā¢āi=1tlogā”(Stā)āā¢[logā”Stā]almost surely as ā¢tāāformulae-sequence1subscript1superscriptsubscript1subscriptsuperscriptādelimited-[]subscriptsuperscriptāalmost surely as 1tT_t= 1t _i=1^t (S^*_t)% [ S^*_t] surely as tāādivide start_ARG 1 end_ARG start_ARG t end_ARG Titalic_t = divide start_ARG 1 end_ARG start_ARG t end_ARG āi = 1t log ( Sāitalic_t ) ā blackboard_E [ log Sāitalic_t ] almost surely as t ā ā (25) The sum āi=1tlogā”(Siā)ātā¢Ī¼>0superscriptsubscript1subscriptsuperscript0 _i=1^t (S^*_i)ā tμ>0āi = 1t log ( Sāitalic_i ) ā t μ > 0, where μ is the mean, grows linearly, implying that Wtā=expā”(Tt)āexpā”(tā¢Ī¼)subscriptsuperscriptsubscriptW^*_t= (T_t)ā (tμ)Wāitalic_t = exp ( Titalic_t ) ā exp ( t μ ) grows exponentially in t. Given that WtāsubscriptsuperscriptW^*_tWāitalic_t grows exponentially, it will eventually exceed any fixed threshold M, therefore it will also exceed 1/α11/ 1 / α almost surely as tāāātāāt ā ā, stopping the test. This proves the statement. ā B.1.2 Practical Test In practice, we donāt have access to gāsuperscriptg^*gā, but only to an estimate gĪøtsubscriptsubscriptg_ _tgitalic_Īø start_POSTSUBSCRIPT t end_POSTSUBSCRIPT, whose parameters Īøtsubscript _tĪøitalic_t we update with each new batch. We can define the empirical wealth process Wttā„1subscriptsubscript1\W_t\_tā„ 1 Witalic_t t ā„ 1 by initializing W0=1subscript01W_0=1W0 = 1 and updating Wt=Wtā1ĆStsubscriptsubscript1subscriptW_t=W_t-1Ć S_tWitalic_t = Witalic_t - 1 Ć Sitalic_t by the empirical betting score (Pandeva et al., 2024) St=āi=1b(1+gĪøtā1ā¢(x(tā1)ā¢b+i)āgĪøtā1ā¢(y(tā1)ā¢b+i)expā”(ϵ))subscriptsuperscriptsubscriptproduct11subscriptsubscript1subscript1subscriptsubscript1subscript1italic-ϵ S_t= _i=1^b ( 1+g_ _t-1(x_(t-1)b+i% )-g_ _t-1(y_(t-1)b+i) (ε) )Sitalic_t = āi = 1b ( divide start_ARG 1 + gitalic_Īø start_POSTSUBSCRIPT t - 1 end_POSTSUBSCRIPT ( x( t - 1 ) b + i ) - gitalic_Īø start_POSTSUBSCRIPT t - 1 end_POSTSUBSCRIPT ( y( t - 1 ) b + i ) end_ARG start_ARG exp ( ϵ ) end_ARG ) (26) Since gĪøtsubscriptsubscriptg_ _tgitalic_Īø start_POSTSUBSCRIPT t end_POSTSUBSCRIPT only approximates the optimal neural net gāsuperscriptg^*gā, it is clear that StsubscriptS_tSitalic_t is still an e-variable. It follows that Wttā„1subscriptsubscript1\W_t\_tā„ 1 Witalic_t t ā„ 1 is again an e-process as we can show by induction, using the fact that X,Yā¢[W0]=1subscriptdelimited-[]subscript01E_X,Y[W_0]=1blackboard_EX , Y [ W0 ] = 1 for all PXĆPYā0subscriptsubscriptsubscript0P_XĆ P_Y _0Pitalic_X Ć Pitalic_Y ā P0 and for a fixed PXĆPYā0subscriptsubscriptsubscript0P_XĆ P_Y _0Pitalic_X Ć Pitalic_Y ā P0, Wtā1subscript1W_t-1Witalic_t - 1 and StsubscriptS_tSitalic_t are independent: X,Yā¢[Wt]subscriptdelimited-[]subscript _X,Y[W_t]blackboard_EX , Y [ Witalic_t ] =X,Yā¢[Wtā1ĆSt]absentsubscriptdelimited-[]subscript1subscript =E_X,Y[W_t-1Ć S_t]= blackboard_EX , Y [ Witalic_t - 1 Ć Sitalic_t ] =X,Yā¢[Wtā1]ā¢X,Yā¢[St]ā¤1absentsubscriptdelimited-[]subscript1subscriptdelimited-[]subscript1 =E_X,Y[W_t-1]E_X,Y[S_t]⤠1= blackboard_EX , Y [ Witalic_t - 1 ] blackboard_EX , Y [ Sitalic_t ] ⤠1 We can thus define the sequential test γ=inftā„1:Wtā„1/αinfimumconditional-set1subscript1 γ= \tā„ 1:W_tā„ 1/α\γ = inf t ā„ 1 : Witalic_t ā„ 1 / α (27) Control on the α-error again follows from Villeās inequality. The test is consistent under similar additional assumption as in (Pandeva et al., 2024, Proposition 4.3): Proposition 4 (Consistency of the Practical Test). If the learning algorithm satisfies the condition lim inftāāā¢[logā”(1expā”(ϵ)ā¢(1+gĪøtā¢(X)āgĪøtā¢(Y)))ā£ā±t]3ā¢cā¢logā”(t)/tā¢ā¤a.s.ā¢1for all ā¢PXĆPYā1subscriptlimit-infimumādelimited-[]conditional1italic-ϵ1subscriptsubscriptsubscriptsubscriptsubscriptā±3a.s.1for all subscriptsubscriptsubscript1 _tāā E[ ( 1% (ε)(1+g_ _t(X)-g_ _t(Y)) ) _% t]3c (t)/t a.s.ā¤1 all P_X% Ć P_Y _1lim inft ā ā divide start_ARG blackboard_E [ log ( divide start_ARG 1 end_ARG start_ARG exp ( ϵ ) end_ARG ( 1 + gitalic_Īø start_POSTSUBSCRIPT t end_POSTSUBSCRIPT ( X ) - gitalic_Īø start_POSTSUBSCRIPT t end_POSTSUBSCRIPT ( Y ) ) ) ⣠Fitalic_t ] end_ARG start_ARG 3 c square-root start_ARG log ( t ) / t end_ARG end_ARG overa.s. start_ARG ⤠end_ARG 1 for all Pitalic_X Ć Pitalic_Y ā P1 (28) for a universal constant c, then we have Pā¢(γ<ā)=1for all ā¢Pā1formulae-sequence1for all subscript1 P(γ<ā)=1 all P _1P ( γ < ā ) = 1 for all P ā P1 (29) Proof. The proof structure follows proofs 10.2 and 10.3 in Pandeva et al. (2024). Let vi:=ā(x,y)āBilogā”(1expā”ϵā¢(1+gĪøiā1ā¢(x)āgĪøiā1ā¢(y)))assignsubscriptsubscriptsubscript1italic-ϵ1subscriptsubscript1subscriptsubscript1 v_i:= _(x,y)ā B_i ( 1 ε% (1+g_ _i-1(x)-g_ _i-1(y) ) )vitalic_i := ā( x , y ) ā B start_POSTSUBSCRIPT i end_POSTSUBSCRIPT log ( divide start_ARG 1 end_ARG start_ARG exp ϵ end_ARG ( 1 + gitalic_Īø start_POSTSUBSCRIPT i - 1 end_POSTSUBSCRIPT ( x ) - gitalic_Īø start_POSTSUBSCRIPT i - 1 end_POSTSUBSCRIPT ( y ) ) ) (30) for iā1,ā¦,t1ā¦iā\1,ā¦,t\i ā 1 , ⦠, t and Ai:=ā¢[viā£ā±iā1]=bĆā¢[logā”(1expā¢(1+gĪøiā1ā¢(X)āgĪøiā1ā¢(Y)))ā£ā±iā1]assignsubscriptdelimited-[]conditionalsubscriptsubscriptā±1delimited-[]conditional11subscriptsubscript1subscriptsubscript1subscriptā±1 A_i:=E[v_i _i-1]=bĆE% [ ( 1 (1+g_ _i-1(X)-g_ _i-1(Y))% ) _i-1 ]Aitalic_i := blackboard_E [ vitalic_i ⣠Fitalic_i - 1 ] = b Ć blackboard_E [ log ( divide start_ARG 1 end_ARG start_ARG exp end_ARG ( 1 + gitalic_Īø start_POSTSUBSCRIPT i - 1 end_POSTSUBSCRIPT ( X ) - gitalic_Īø start_POSTSUBSCRIPT i - 1 end_POSTSUBSCRIPT ( Y ) ) ) ⣠Fitalic_i - 1 ] (31) where ā±iā1=Ļā¢(āŖj=1iā1Bj)subscriptā±1superscriptsubscript11subscriptF_i-1=Ļ ( _j=1^i-1B_j )Fitalic_i - 1 = Ļ ( āŖj = 1i - 1 Bitalic_j ) is the Ļ-algebra generated by the first iā11i-1i - 1 batches of samples. The probability of the test never stopping is āā¢(γ=ā)=āā¢(ātā„1γ>t)ā¤āā¢(γ>t)āsubscript1ā (γ=ā)=P ( _tā„ 1\% γ>t\ ) (γ>t)blackboard_P ( γ = ā ) = blackboard_P ( āt ā„ 1 γ > t ) ⤠blackboard_P ( γ > t ) for any t, and thus, in the limit āā¢(γ=ā)ā¤lim suptāāāā¢(γ>t)āsubscriptlimit-supremumāā (γ=ā)⤠_tāāP(% γ>t)blackboard_P ( γ = ā ) ⤠lim supt ā ā blackboard_P ( γ > t ) (32) We will show that the RHS is equal to 00. Using the definitions of visubscriptv_ivitalic_i and AisubscriptA_iAitalic_i in equations (30) and (31), we can write āā¢(γ>t)ā (γ>t)blackboard_P ( γ > t ) =āā¢(Wt<1α)absentāsubscript1 =P (W_t< 1α )= blackboard_P ( Witalic_t < divide start_ARG 1 end_ARG start_ARG α end_ARG ) =āā¢(logā”Wtt<logā”(1/α)t)absentāsubscript1 =P ( W_tt< (1/α)t )= blackboard_P ( divide start_ARG log Witalic_t end_ARG start_ARG t end_ARG < divide start_ARG log ( 1 / α ) end_ARG start_ARG t end_ARG ) =āā¢(1tā¢āi=1tviāAi+1tā¢āi=1tAi<logā”(1/α)t)absentā1superscriptsubscript1subscriptsubscript1superscriptsubscript1subscript1 =P ( 1t _i=1^tv_i-A_i+ 1t% _i=1^tA_i< (1/α)t )= blackboard_P ( divide start_ARG 1 end_ARG start_ARG t end_ARG āi = 1t vitalic_i - Aitalic_i + divide start_ARG 1 end_ARG start_ARG t end_ARG āi = 1t Aitalic_i < divide start_ARG log ( 1 / α ) end_ARG start_ARG t end_ARG ) (33) Now, introduce the event Gtsubscript G_tGitalic_t :=|1tā¢āi=1tviāAi|ā¤2ā¢cā¢bā¢logā”(t)tassignabsent1superscriptsubscript1subscriptsubscript2 := \ | 1t _i=1^tv_i-A_i |⤠2% cb (t)t \:= | divide start_ARG 1 end_ARG start_ARG t end_ARG āi = 1t vitalic_i - Aitalic_i | ⤠2 c b square-root start_ARG divide start_ARG log ( t ) end_ARG start_ARG t end_ARG end_ARG (34) where c:=logā”(1+2ā¢q1ā2ā¢q)assign1212c:= ( 1+2q1-2q )c := log ( divide start_ARG 1 + 2 q end_ARG start_ARG 1 - 2 q end_ARG ) and qā(0,1/2)012qā(0,1/2)q ā ( 0 , 1 / 2 ) is the bound on |gĪøā¢(x)|subscript|g_Īø(x)|| gitalic_Īø ( x ) |. The random variable viāAisubscriptsubscriptv_i-A_ivitalic_i - Aitalic_i has mean 00 and is bounded in [ābā¢c,bā¢c][-bc,bc][ - b c , b c ], since (ϵitalic-ϵεϵ canceling out): viāAisubscriptsubscript v_i-A_ivitalic_i - Aitalic_i =āx,yāBi[logā”(1+gĪøiā1ā¢(x)āgĪøiā1ā¢(y))āā¢[logā”(1+gĪøiā1ā¢(x)āgĪøiā1ā¢(y))ā£ā±iā1]]absentsubscriptsubscriptdelimited-[]1subscriptsubscript1subscriptsubscript1delimited-[]conditional1subscriptsubscript1subscriptsubscript1subscriptā±1 = _x,yā B_i [ (1+g_ _i-1(x)-g_% _i-1(y) )-E [ (1+g_ _i-1(x)-g_% _i-1(y) ) _i-1 ] ]= āx , y ā B start_POSTSUBSCRIPT i end_POSTSUBSCRIPT [ log ( 1 + gitalic_Īø start_POSTSUBSCRIPT i - 1 end_POSTSUBSCRIPT ( x ) - gitalic_Īø start_POSTSUBSCRIPT i - 1 end_POSTSUBSCRIPT ( y ) ) - blackboard_E [ log ( 1 + gitalic_Īø start_POSTSUBSCRIPT i - 1 end_POSTSUBSCRIPT ( x ) - gitalic_Īø start_POSTSUBSCRIPT i - 1 end_POSTSUBSCRIPT ( y ) ) ⣠Fitalic_i - 1 ] ] ā„āxi,yiāBilogā”(1ā2ā¢q)ālogā”(1+2ā¢q)absentsubscriptsubscriptsubscriptsubscript1212 ā„ _x_i,y_iā B_i (1-2q)- (1+2q)ā„ āx start_POSTSUBSCRIPT i , yitalic_i ā Bitalic_i end_POSTSUBSCRIPT log ( 1 - 2 q ) - log ( 1 + 2 q ) =bā¢[logā”(1ā2ā¢q)ālogā”(1+2ā¢q)]=ābā¢logā”(1+2ā¢q1ā2ā¢q)absentdelimited-[]12121212 =b [ (1-2q)- (1+2q) ]=-b ( 1+2q1-2q% )= b [ log ( 1 - 2 q ) - log ( 1 + 2 q ) ] = - b log ( divide start_ARG 1 + 2 q end_ARG start_ARG 1 - 2 q end_ARG ) and analogously for the upper bound. We can use those bounds and Hoeffdingās inequality to bound the complement GtcsuperscriptsubscriptG_t^cGitalic_titalic_c: āā¢(Gtc)āsuperscriptsubscript (G_t^c)blackboard_P ( Gitalic_titalic_c ) =āā¢(|1tā¢āi=1tviāAi|>2ā¢cā¢bā¢logā”(t)t)absentā1superscriptsubscript1subscriptsubscript2 =P ( \ | 1t _i=1^tv_i-A_i% |>2cb (t)t \ )= blackboard_P ( | divide start_ARG 1 end_ARG start_ARG t end_ARG āi = 1t vitalic_i - Aitalic_i | > 2 c b square-root start_ARG divide start_ARG log ( t ) end_ARG start_ARG t end_ARG end_ARG ) =āā¢(|āi=1t(viāAi)|>2ā¢tā¢cā¢bā¢logā”(t)t)absentāsuperscriptsubscript1subscriptsubscript2 =P ( \ | _i=1^t(v_i-A_i) |>% 2tcb (t)t \ )= blackboard_P ( | āi = 1t ( vitalic_i - Aitalic_i ) | > 2 t c b square-root start_ARG divide start_ARG log ( t ) end_ARG start_ARG t end_ARG end_ARG ) ā¤2ā¢expā”(ā2ā¢(2ā¢tā¢cā¢bā¢logā”(t)t)2āi=1t(cā¢b+cā¢b)2)absent22superscript22superscriptsubscript1superscript2 ⤠2 ( -2 (2tcb (t)t )% ^2 _i=1^t(cb+cb)^2 )⤠2 exp ( divide start_ARG - 2 ( 2 t c b square-root start_ARG divide start_ARG log ( t ) end_ARG start_ARG t end_ARG end_ARG )2 end_ARG start_ARG āi = 1t ( c b + c b )2 end_ARG ) =2ā¢expā”(ā2ā¢logā”(t))=2t2absent222superscript2 =2 (-2 (t))= 2t^2= 2 exp ( - 2 log ( t ) ) = divide start_ARG 2 end_ARG start_ARG t2 end_ARG (35) Combining this with eq. (33), we get āā¢(γ>t)ā (γ>t)blackboard_P ( γ > t ) ā¤āā¢(1tā¢āi=1tAi<logā”(1/α)t+1tā¢āi=1tviāAiā©Gt)+āā¢(Gtc)absentā1superscriptsubscript1subscript11superscriptsubscript1subscriptsubscriptsubscriptāsuperscriptsubscript ( \ 1t _i=1^tA_i< % (1/α)t+ 1t _i=1^tv_i-A_i \ā© G_t% )+P(G_t^c)⤠blackboard_P ( divide start_ARG 1 end_ARG start_ARG t end_ARG āi = 1t Aitalic_i < divide start_ARG log ( 1 / α ) end_ARG start_ARG t end_ARG + divide start_ARG 1 end_ARG start_ARG t end_ARG āi = 1t vitalic_i - Aitalic_i ā© Gitalic_t ) + blackboard_P ( Gitalic_titalic_c ) ā¤āā¢(1tā¢āi=1tAi<logā”(1/α)t+2ā¢cā¢bā¢logā”tā©Gt)+āā¢(Gtc)absentā1superscriptsubscript1subscript12subscriptāsuperscriptsubscript ( \ 1t _i=1^tA_i< % (1/α)t+2cb tt \ā© G_t )+ % P(G_t^c)⤠blackboard_P ( divide start_ARG 1 end_ARG start_ARG t end_ARG āi = 1t Aitalic_i < divide start_ARG log ( 1 / α ) end_ARG start_ARG t end_ARG + 2 c b square-root start_ARG divide start_ARG log t end_ARG start_ARG t end_ARG end_ARG ā© Gitalic_t ) + blackboard_P ( Gitalic_titalic_c ) ā¤āā¢(1tā¢āi=1tAi<3ā¢cā¢bā¢logā”t)+2t2.absentā1superscriptsubscript1subscript32superscript2 ( 1t _i=1^tA_i<3cb % tt )+ 2t^2.⤠blackboard_P ( divide start_ARG 1 end_ARG start_ARG t end_ARG āi = 1t Aitalic_i < 3 c b square-root start_ARG divide start_ARG log t end_ARG start_ARG t end_ARG end_ARG ) + divide start_ARG 2 end_ARG start_ARG t2 end_ARG . where the second inequality comes from the fact that 1tā¢āi=1tviāAiā¤2ā¢cā¢bā¢logā”(t)/t1superscriptsubscript1subscriptsubscript2 1t _i=1^tv_i-A_i⤠2cb (t)/tdivide start_ARG 1 end_ARG start_ARG t end_ARG āi = 1t vitalic_i - Aitalic_i ⤠2 c b square-root start_ARG log ( t ) / t end_ARG on GtsubscriptG_tGitalic_t. The third inequality exploits the bound from eq. (35) as well as the fact that logā”(1/α)/t1 (1/α)/tlog ( 1 / α ) / t is smaller than 2ā¢bā¢cā¢logā”t/t22bc t/t2 b c square-root start_ARG log t / t end_ARG for large enough t. By taking the limit over tāāātāāt ā ā, the term 2t22superscript2 2t^2divide start_ARG 2 end_ARG start_ARG t2 end_ARG vanishes. Combining the result with eq. (32), we obtain āā¢(γ=ā)ā¤lim suptāāāā¢(γ>t)ā¤lim suptāāāā¢(Ht)āsubscriptlimit-supremumāāsubscriptlimit-supremumāāsubscript (γ=ā)⤠_tāāP(% γ>t)⤠_tāāP(H_t)blackboard_P ( γ = ā ) ⤠lim supt ā ā blackboard_P ( γ > t ) ⤠lim supt ā ā blackboard_P ( Hitalic_t ) (36) where Ht:=1tā¢āi=1tAi<3ā¢cā¢bā¢logā”(t)tassignsubscript1superscriptsubscript1subscript3H_t:= \ 1t _i=1^tA_i<3cb (t)t \Hitalic_t := divide start_ARG 1 end_ARG start_ARG t end_ARG āi = 1t Aitalic_i < 3 c b square-root start_ARG divide start_ARG log ( t ) end_ARG start_ARG t end_ARG end_ARG . From the properties of Cesaro means, we know that lim infnāā1tā¢āi=1tAiā¢ā„a.s.ā¢lim inftāāAt,subscriptlimit-infimumā1superscriptsubscript1subscripta.s.subscriptlimit-infimumāsubscript _nāā 1t _i=1^tA_i % a.s.ā„ _tāāA_t,lim infn ā ā divide start_ARG 1 end_ARG start_ARG t end_ARG āi = 1t Aitalic_i overa.s. start_ARG ā„ end_ARG lim inft ā ā Aitalic_t , which implies lim inftāā1tā¢āi=1tAi3ā¢cā¢bā¢logā”(t)/tā¢ā„a.s.ā¢lim inftāāAt/b3ā¢cā¢logā”t/tā¢>a.s.ā¢1.subscriptlimit-infimumā1superscriptsubscript1subscript3a.s.subscriptlimit-infimumāsubscript3a.s.1 _tāā 1t _i=1^tA_i3cb% (t)/t a.s.ā„ _tāā A_t/b% 3c t/t a.s.>1.lim inft ā ā divide start_ARG divide start_ARG 1 end_ARG start_ARG t end_ARG āi = 1t Aitalic_i end_ARG start_ARG 3 c b square-root start_ARG log ( t ) / t end_ARG end_ARG overa.s. start_ARG ā„ end_ARG lim inft ā ā divide start_ARG Aitalic_t / b end_ARG start_ARG 3 c square-root start_ARG log t / t end_ARG end_ARG overa.s. start_ARG > end_ARG 1 . The last inequality is due to the Assumption (28) made in Proposition (4) and the fact that limtāā(logā”(t)/t/(logā”(tā1)/(tā1)))=1subscriptā111 _tāā ( (t)/t/ ( (t-1)/(t-1) )% )=1limitalic_t ā ā ( square-root start_ARG log ( t ) / t end_ARG / ( square-root start_ARG log ( t - 1 ) / ( t - 1 ) end_ARG ) ) = 1, which is needed because we lowered the index of expression (8) by 1111. This condition implies that āā¢(Ht)ā0āāsubscript0P(H_t)ā 0blackboard_P ( Hitalic_t ) ā 0 a.s., which by the bounded convergence theorem leads to āā¢(Ļ=ā)ā¤lim suptāāāā¢(Ht)=0,āsubscriptlimit-supremumāāsubscript0 (Ļ=ā)⤠_tāāP(H_t)=0,blackboard_P ( Ļ = ā ) ⤠lim supt ā ā blackboard_P ( Hitalic_t ) = 0 , under the alternative. Thus, we have shown that āā¢(γ<ā)=1ā1P(γ<ā)=1blackboard_P ( γ < ā ) = 1 under the alternative. ā Summarizing our findings, we can thus state the following: Proposition 5 (Sequential level-α Test of Power 1). If the learning algorithm satisfies the condition lim inftāāā¢[logā”(1expā”(ϵ)ā¢(1+gĪøtā¢(X)āgĪøtā¢(Y)))ā£ā±t]3ā¢cā¢logā”(t)/tā¢ā¤a.s.ā¢1for all ā¢P:=PXĆPYā1assignsubscriptlimit-infimumādelimited-[]conditional1italic-ϵ1subscriptsubscriptsubscriptsubscriptsubscriptā±3a.s.1for all subscriptsubscriptsubscript1 _tāā E[ ( 1% (ε)(1+g_ _t(X)-g_ _t(Y)) ) _% t]3c (t)/t a.s.ā¤1 all P:=P_% XĆ P_Y _1lim inft ā ā divide start_ARG blackboard_E [ log ( divide start_ARG 1 end_ARG start_ARG exp ( ϵ ) end_ARG ( 1 + gitalic_Īø start_POSTSUBSCRIPT t end_POSTSUBSCRIPT ( X ) - gitalic_Īø start_POSTSUBSCRIPT t end_POSTSUBSCRIPT ( Y ) ) ) ⣠Fitalic_t ] end_ARG start_ARG 3 c square-root start_ARG log ( t ) / t end_ARG end_ARG overa.s. start_ARG ⤠end_ARG 1 for all P := Pitalic_X Ć Pitalic_Y ā P1 (37) for a universal constant c, then we have Pā¢(γ<ā)ā¤Ī±for all ā¢Pā0andPā¢(γ<ā)=1for all ā¢Pā1formulae-sequenceformulae-sequencefor all subscript0andformulae-sequence1for all subscript1 P(γ<ā)ā¤Ī± all P _0% P(γ<ā)=1 all P _1P ( γ < ā ) ⤠α for all P ā P0 and P ( γ < ā ) = 1 for all P ā P1 (38) i.e., the sequential test defined in eq. (7) is a sequential level-α test of power one. Appendix C Further Results and Discussion C.1 Exact Test, ϵ=0italic-ϵ0ε=0ϵ = 0 Corrupted model detection Figure 10 shows the results of applying our proposed test with ϵ=0italic-ϵ0ε=0ϵ = 0 to generations of Mistral-7B-Instruct-v0.2 and Gemma-1.1-7B-IT and their corrupted checkpoints, repeated over 48 runs. Detectability improves with more samples. Figure 10: Detection for Mistral-7B-Instruct-v0.2. (left) and Gemma-1.1-7B-IT (right). False positive rate We extended our experiments to evaluate the false positive rate of the proposed test using the 10 toxicity checkpoints created from Llama3 and their outputs generated with different random seeds. Apart from checkpoint 4, which showed an 8% false positive rate, all other checkpoints recorded a 0% rate after evaluating 4000 samples (each repeated 24 times). C.2 Tolerance Test, ϵ>0italic-ϵ0ε>0ϵ > 0 Figure 11 demonstrates the desirable statistical properties (control on Type I error as well as high power and sample efficiency) of the auditing test with a tolerance parameter ϵ>0italic-ϵ0ε>0ϵ > 0, applied to a corrupted checkpoint of Llama3 from section 5.1. The test is repeated over 24 runs. C.2.1 Translation Auditing with Larger Models We extended our experiments from Section 5.2 to include larger models: Llama3-70B-Instruct (with and without few-shot prompting) and Aya-23-35B (Ćstün et al., 2024). Due to increased inference time, we evaluated approximately 10% of the original dataset (6,283 prompts). Few-shot prompting significantly improved Llama3-70B-Instructās mean BLEU score from 0.0792 to 0.1206. Aya-23-35B achieved the highest mean BLEU score of 0.1227. We set a tolerance threshold ϵ=0.0604italic-ϵ0.0604ε=0.0604ϵ = 0.0604, calculated from the mean neural net distance between Llama3-70B-Instructās outputs with and without few-shot prompting, and used it to compare Llama3-70B-Instruct (without few-shot prompting) to Aya-23-35B. Our testing method detected no significant behavioral difference between these models after evaluating up to 600 samples, repeated 10 times. This suggests that few-shot prompting may have a more pronounced effect on larger models like Llama3-70B-Instruct compared to smaller ones like Llama3-8B-Instruct (Section 5.2). Alternatively, Aya-23-35Bās smaller size might offset the benefits of being a multilingual instruction-tuned model. Figure 11: Detection Rate over Test Epsilon. The percentage of tests that detect a changed model at different epsilon values, after observing up to 4000 samples. Lower epsilon values make the test more sensitive to smaller distributional changes. C.3 Comparison to Baselines To the best of our knowledge, our paper presents the first application of sequential hypothesis testing to the problem of detecting shift in model behavior, raising the question of an appropriate baseline to compare the performance of our proposed test. We give a brief overview of possible baselines and discuss some theoretical and practical reasons why our test is successful against them. Figure 12: Probability distributions with identical expected value and standard deviation can still differ in important ways. Consider the example of a behavior, where we consider scores <0absent0<0< 0 as unsafe. Both the (Left) normal distribution ā¢(0,1)01N(0,1)N ( 0 , 1 ) and the (Right) Poisson distribution Ī»subscriptP_Ī»Pitalic_Ī» have μ=11μ=1μ = 1 and Ļ2=1superscript21Ļ^2=1Ļ2 = 1, but roughly 18%percent1818\%18 % of the probability mass of the normal distribution are below that threshold, vs. 0%percent00\%0 % for the Poisson distribution. Summary Statistics. Summary statistics such as mean and standard deviation are efficient in calculating and providing condensed information about a distribution. However, they might not capture some important aspects of behavior distributions. Consider e.g., the example in figure 12, depicting two distributions with identical mean and standard deviation but whose tails ā which might be particulary important for safety-critical behaviors ā look very different. Distance Measures. While distance measures such as Wasserstein distance take full distributions into account, we can only estimate them from samples. Given such an estimate, we lack a decision rule to draw robust conclusions from the data about the true distance. Classical Hypothesis Testing. Unlike our method, classical hypothesis tests are not āanytime-valid" ā meaning that we have to decide on a sample size before conducting a test or otherwise risk inflating the alpha error when including additional data (Anscombe, 1954). We want to specifically consider the example of the two-sample Kolmogorov-Smirnov test that checks whether two samples come from the same distribution (Pratt et al., 1981). Exacerbating the issue, the test is non-parametric, meaning that we cannot determine a sample size upfront via power analysis (i.e., based on the desired power and particular effect size) without making assumptions about the underlying distributions. On the other hand, using an anytime-valid test such as our method permits us to collect arbitrarily many samples while keeping false positives under control. We conducted an experiment to study how repeated tests can lead to an inflated α error when using the Kolmogorov-Smirnov test versus our proposed method. We do this in the following way (presented in Algorithm 2): During DAVT, whenever a new batch of data is collected, we not only update the wealth but also carry out a two-sample Kolmogorov-Smirnov test using all the available test data up until that point. Results for the three baseline models are depicted in table 3. We find that repeated application of the Kolmogorov-Smirnov test leads to an inflated α for 2 out of the 3 models considered. Algorithm 2 Repeated Kolmogorov-Smirnov Test 1: Input: iā¢iā„1subscript1\x_i\iā„ 1 xitalic_i i ā„ 1 (stream of prompts), B (behavior function), MMM (baseline model API), Mā²M Mā² (current model API), α (type-I error limit under null), n (batch size) 2: Initialize empty lists: ā¬āā āā¬Bā ā ā , ā¬ā²āā āsuperscriptā¬ā²B ā ā² ā ā 3: while true do 4: Collect a batch of n prompts: t,ii=1nsuperscriptsubscriptsubscript1\x_t,i\_i=1^n xitalic_t , i i = 1n 5: Compute behavior scores for the batch: 6: for i=11i=1i = 1 to n do 7: bt,iāBā¢(t,i,Mā¢(ti))āsubscriptsubscriptsubscriptsubscriptb_t,iā B(x_t,i,M(x_t_i))bitalic_t , i ā B ( xitalic_t , i , M ( xitalic_t start_POSTSUBSCRIPT i end_POSTSUBSCRIPT ) ) 8: bt,iā²āBā¢(t,i,Mā²ā¢(t,i))āsubscriptsuperscriptā²subscriptsuperscriptā²subscriptb _t,iā B(x_t,i,M (x_t,i% ))bā²italic_t , i ā B ( xitalic_t , i , Mā² ( xitalic_t , i ) ) 9: end for 10: Append the batch scores to the lists: 11: ā¬āā¬āŖbt,ii=1nāā¬superscriptsubscriptsubscript1B āŖ\b_t,i\_i=1^nB ā B āŖ bitalic_t , i i = 1n 12: ā¬ā²āā¬ā²āŖbt,iā²i=1nāsuperscriptā¬ā²superscriptsubscriptsubscriptsuperscriptā²1B āŖ\b _t,i\_i=% 1^nBā² ā Bā² āŖ bā²italic_t , i i = 1n 13: Perform Kolmogorov-Smirnov Test on ā¬BB and ā¬ā²B Bā²: 14: Compute p-value ptāKSā¢(ā¬,ā¬ā²)āsubscriptKSā¬superscriptā¬ā²p_t (B,B )pitalic_t ā KS ( B , Bā² ) 15: if ptā¤Ī±subscriptp_t⤠_t ⤠α then 16: Break and reject null hypothesis 17: end if 18: end while Table 3: Comparison of False Positive Rates for our proposed anytime-valid method and Kolmogorov-Smirnov Test. Results show an increase in α-error in 2 out of 3 cases when using the Kolmogorov-Smirnov test repeatedly on a growing number of batches while ours keeps it below α=5%percent5α=5\%α = 5 %. Runs were repeated 24 times, with each test running on up to 4000 samples and a batch size of 25. Test Llama3-8B-Instruct Mistral-7B-Instruct Gemma-1.1-7b Our Proposed Test 4.2% 0% 0% Kolmogorov Smirnov Test 8.3% 0% 8.3% C.4 Effects of Randomness and Errors in the Behavior Scoring Function Effects of Randomness. The formulation of behavior shift auditing allows for the behavior scoring function to be a stochastic operator, as it is agnostic of the sources of variance in the distributions it compares, see Appendix B. In the limit of infinite samples, the test result itself is unaffected by this randomness as long as the outputs of the stochastic behavior scoring function B~~ Bover~ start_ARG B end_ARG still reflect true scores in expectation i.e., Bā¢(,)=ā¢[B~ā¢(,)] for every ā¢(,)delimited-[]~ for every B(x,y)=E[ B(x,y)] % for every (x,y)B ( x , y ) = blackboard_E [ over~ start_ARG B end_ARG ( x , y ) ] for every ( x , y ) where (,)āĆ(x,y) ĆY( x , y ) ā X Ć Y denotes a (prompt, continuation)-pair. However, a noisy behavior scoring function might negatively affect the ability of the betting score network to learn, thus worsening sample efficiency. To investigate this, we repeat experiments from section 5.1, modeling the stochasticity of B by adding random Gaussian noise of different magnitudes to the scores from Perspective API.888Final toxicity scores are then clipped to the interval [0,1]. Figure 13 shows the fine-tuning detection rates for Llama3-8B-Instruct when using ā¢(0,0.01)00.01N(0,0.01)N ( 0 , 0.01 ), ā¢(0,0.05)00.05N(0,0.05)N ( 0 , 0.05 ) and ā¢(0,0.1)00.1N(0,0.1)N ( 0 , 0.1 ) noise. Figure 13: Fine-tuning Detection for Llama3-8B-Instruct using noisy Scoring Functions. The detection frequency as a function of number of generated samples. Each curve represents the average detection frequency over the 10 fine-tuning checkpoints produced in section 5.1, but when using a scoring function with additional Gaussian noise. We find that sample efficiency decreases the more noise is added to toxicity scores. However, detection rates still eventually stabilize at the same rates as when using toxicity scores without additional noise. Effects of Systematic Errors. Our test is further robust against any bijective transformation in the behavior scoring function that could be recovered by the betting score network Ļitalic-ĻĻĻ, including scaling or consistent uniform under(over-)estimation. Weak Proxies. We call a scoring function BproxysubscriptproxyB_proxyBproxy āweak proxy" for behavior ā¬BB if it is correlated with the ground-truth scoring function B on the available test data. We claim that ā in the absence of a ground-truth ā even weak proxies can be useful for detecting change if used carefully. The underlying rationale is that discrepancies in the distributions of ground-truth scores are likely to induce corresponding discrepancies in the distributions of proxy scores, provided there is a correlation between them. However, caution is warranted because positive test results may arise from changes in behaviors that are uncorrelated with the ground-truth scoring function. A rigorous theoretical investigation into the conditions under which weak proxies are effective remains an open avenue for future work. C.5 Extension to Multiple Behaviors The auditing test can be extended to detect changes in multiple behaviors at once. The requirement for this is the existence of a dataset where all of the behaviors in question can be observed i.e., manifest with some non-zero probability. The exact test is an application of DAVT, which Pandeva et al. (2024) have successfully applied to multi-dimensional distributions. Assume we want to test for changes in d behaviors as measured by behavior scoring functions B1,ā¦,Bdsubscript1ā¦subscriptB_1,ā¦,B_dB1 , ⦠, Bitalic_d, producing the d-dimensional score (X,M(X)):=(B1(X,M(X)),ā¦,Bd(X,M(X)) B(X,M(X)):=(B_1(X,M(X)),ā¦,B_d(X,M(X))italic_B ( X , M ( X ) ) := ( B1 ( X , M ( X ) ) , ⦠, Bitalic_d ( X , M ( X ) ) In this case, the only modification necessary is the betting score network, with Ļitalic-ĻĻĻ now taking in scores from [0,1]dsuperscript01[0,1]^d[ 0 , 1 ]d. The generalization of the tolerance test to multiple behaviors is similarly straightforward if we decide to set a global tolerance threshold ϵ>0italic-ϵ0ε>0ϵ > 0 as the maximal allowed difference between multi-dimensional distributions. Note that the derivation of the two-sample test with tolerance in Appendix B does not depend on X,YX,YX , Y being real-valued; we can instead define :=(X1,ā¦,Xd),:=(Y1,ā¦,Yd):ā[0,1]d:formulae-sequenceassignsubscript1ā¦subscriptassignsubscript1ā¦subscriptāsuperscript01 X:=(X_1,ā¦,X_d), Y:=(Y_1,ā¦,Y_d):Xā% [0,1]^ditalic_X := ( X1 , ⦠, Xitalic_d ) , italic_Y := ( Y1 , ⦠, Yitalic_d ) : X ā [ 0 , 1 ]d. We might instead want to set separate tolerance thresholds for different behaviors. The current version of our test does not allow for this. As an ad-hoc solution, we propose carrying out multiple tests on the same data in parallel and correcting for an increase in Type I error (e.g., using Bonferroni correction).