Manuscript Offprint
arXiv:2610.17655textGrain watermarking is harder to detect: can sum-tests still do it optimally?
Abstract
Watermarking embeds a signal in text generated by large language models that is imperceptible to readers but statistically detectable with a secret key. The recently proposed textGrain watermark calibrates this signal against the model's sampling entropy through an explicit entropy budget, combining the stochasticity of Red-Green watermarks with the unbiasedness of Gumbel-max watermarks. The accompanying report Li et al. (2026b) proposes a detector that sums pivotal statistics. We study when, and how efficiently, textGrain can be detected after human edits, which we model as a sparse mixture in which a fraction of positions retain the watermark and token uncertainty decays as . First, we show that entropy calibration comes at a cost: the minimax detection boundary of textGrain is , so its detectable region is strictly smaller than that of Gumbel-max and maximal-coupling watermarks, whose boundary is . This cost stems from the construction of textGrain via finitely many columns rather than from entropy calibration itself: we exhibit an unbiased scheme with the same entropy loss that remains detectable where textGrain is not. Second, and perhaps surprisingly, this loss makes the simple sum detector optimal at the boundary when the number of transport columns is fixed, unlike for Gumbel-max. When the number of columns grows and the entropy budget does not vanish, detection becomes easier, and the detectable region expands while that of the sum detector does not. Third, for a fixed edit fraction, we characterize the optimal exponential rate at which the type II error can decay, and show that the sum detector falls strictly short of it at every fixed alternative. Finally, we propose a weighted multiscale binomial scan that is valid in finite samples and requires no knowledge of the next-token distributions, the entropy budget, or the edit fraction; it attains every detection boundary above, as well as the optimal exponent.
1 Introduction
To preserve content authenticity and curb misuse of AI, an LLM-generated text is often watermarked, which imbues it with a signal that is statistically verifiable, thus aiding detection, but otherwise remains imperceptible. textGrain (Li et al., 2026b) represents the latest in a series of developments (Kirchenbauer et al., 2023; Aaronson, 2023; Christ et al., 2024; Kuditipudi et al., 2024; Hu et al., 2024; Wu et al., 2024; Dathathri et al., 2024; Zhao et al., 2025) to enhance the quality of such watermarked texts while allowing for statistical detection via a suitable test statistic. Introduced in compliance with the EU content provenance rules (European Parliament and Council of the European Union, 2024; European Commission, 2026), textGrain marries the stochasticity of the Red-Green watermark (Kirchenbauer et al., 2023) with the unbiasedness of the Gumbel-max watermark (Aaronson, 2023) to conjure watermarks that respect the NTP inherent to the large language model, while reducing repetitive generation. Thematically, the textGrain mechanism speaks to several recent threads in the literature. For example, the tendency of the Gumbel-max watermark to yield identical outputs for identical prompts has motivated diversity-preserving variants (Fu et al., 2024); the observation that low-entropy tokens carry little watermark signal has led to entropy-thresholded watermarking (Lee et al., 2024) and entropy-weighted detection (Lu et al., 2024). The apparent trade-off between detection ability and model distortion has been analyzed as a constrained optimization problem by Cai et al. (2026). textGrain mollifies each of these concerns by calibrating the trade-off between watermark signal and sampling entropy through an explicit entropy budget. The technical report Li et al. (2026b) builds on prior work on optimal-transport based watermarks for low entropy distributions Tsur et al. (2026), as well as debiasing Red-Green watermarking via maximal coupling (Xie et al., 2025), and discusses the detailed mechanism behind textGrain. Along the way, it also touches upon a detection strategy based on sums of pivot statistics; however, the optimality of such detection strategies under human edits is yet unaddressed. We complement Li et al. (2026b) on this front by providing a characterization of optimal detection for textGrain-generated texts. Our work builds on recent research on optimal watermark detection (Li et al., 2025a, 2026a; Cai et al., 2025; Blanchet et al., 2026), and unearths the following simple insights:
• textGrain makes watermark detection harder.
- The sum test, proposed as textGrain detector in Li et al. (2026b), is optimal if number of columns in the cost matrix is fixed.
• The sum test is not optimal if number of columns in the cost matrix grow.
Before proceeding further, it is prudent to briefly introduce the set-up and mechanism of textGrain. Let be a finite vocabulary with . For a probability vector , write and . Fix some . At each watermarked position, let is a partition, such that for each , belongs to one of the blocks. Further denote the block probability as , where we unburden the notation by suppressing the dependence on when it is clear from the context. For some , suppose
be the set of couplings over with marginals and . Here . Consider . These are also called pseudorandom variables, since, given tokens and the NTP , both the partition and the Gumbel random variables can be deterministically constructed via a Key and a hash function . Nevertheless, we invoke the cryptographic properties of (Barak, 2021; Schneier, 1996; Wu et al., 2024; Zhao et al., 2025) to treat as random. The deterministic construction comes handy since a detector employs Key and to make and available to it.
Write , where is the mean of a standard Gumbel variable. For , consider the entropic OT coupling
Then, given , textGrain samples a token W according to
As for detection, Li et al. (2026b) proposes the test statistic
This leads to the following natural questions:
-
Does the entropy-calibration of textGrain make watermark detection harder compared to a Gumbel-max or the maximal coupling based debiased Red-Green watermarking schemes(Xie et al., 2025)? In particular, the Gumbel-max lets the keyed randomness completely determine the next token, whereas textGrain preserves additional sampling randomness even after the key is fixed by allowing for in (1). Since watermark detection looks for dependence between tokens and keyed randomness, limiting the key's influence may weaken statistical evidence, thereby making detection harder.
-
The second question is more straightforward: is able to detect textGrain-watermarked text whenever such a detection is possible?
-
Finally, detecting a watermark eventually is not the same as detecting it efficiently. Following Li et al. (2026a), we ask how fast the type II error of a level- detector can decay when a fixed fraction of the text remains watermarked, and whether attains this optimal exponential rate. Where it does not, either at the detection boundary or in efficiency, can a single detector that requires no knowledge of the NTPs, the entropy budget, or the edit fraction attain both optimality criteria?
To properly address these questions, we quickly get some notational niceties out of the way. For a fixed , let denote the density of , and define the corresponding time-indexed version . Following Li et al. (2026a, 2025a), we answer the aforementioned questions by formulating the watermark detection as a hypothesis testing problem:
(3)
Human edits, paraphrasing, or mixing with human-written text replace an unknown fraction of watermarked tokens with tokens that are independent of the key. Each scored position is therefore watermarked with probability and otherwise carries a uniform pivot, which yields the mixture density in . Here measures surviving text-key dependence, and models heavily edited text. This is known as the sparse watermark regime (Li et al., 2025b; Xie et al., 2025; Li et al., 2026a), and is motivated strongly by the sparse detection problem (Donoho and Jin, 2004, 2015). More concretely, we consider sparse watermark signal and with . In this setting, we have the following sharp characterization for the detection of textGrainwatermarking.
Informal Theorem 1.1. (i) Without sufficient watermark signals, i.e. when , no test can asymptotically separate and with non-trivial power.
(ii) When , i.e. watermark signal is sufficient, and separate asymptotically. Moreover, can be detected using .
Theorem 1.1, stated for a fixed number of columns and an entropy fraction bounded away from zero, already answers our first two questions in this basic setting. Since both Gumbel-max (Li et al.,

Figure 1: Phase diagram for textGrain with a fixed number of columns m, where and . The navy line is the minimax boundary of textGrain for , that is, (Corollary 2.5); it coincides with the boundary of (gold, dotted; Theorem 3.1). The red dashed line is the boundary of Gumbel-max (Li et al., 2026a) and maximal coupling (Xie et al., 2025). Below the navy line, the shading from light green to dark blue shows , the fastest decay of that still permits detection. The thin contour lines are the textGrain boundaries for the labeled values of ; attains each of them, and each is itself detectable when . The yellow region is detectable for Gumbel-max and maximal coupling but not for textGrain, for any . The grey hatched region is undetectable for all three schemes.

Figure 2: Phase diagram for textGrain with columns and . In the green region below the gold line , both and Algorithm 1 are consistent. Between the gold line and the red dashed line , the shading from lavender to dark purple shows . Consistent tests exist if and only if (Theorem 2.8), Algorithm 1 attains them (Theorem 4.8), and is powerless there (Proposition 3.4). Each contour line, continued along the red line below , is the textGrain boundary for its labeled value of . The navy line draws one such boundary in full, for the illustrative value , with the circle marking its kink at . The grey hatched region is undetectable for every . Under a weak entropy budget (Theorem 2.10), the boundary does not depend on , Figure 1 applies, and remains optimal (Theorem 3.3).
2026a, Theorem 2) and maximal-coupling watermarks (Xie et al., 2025, Theorem 3.5) are detectable throughout , the detectable region of textGrain is strictly smaller whenever , so textGrain is indeed harder to detect. This shrinkage has a perhaps unexpected consequence: the textGrain boundary coincides with the boundary of sum tests for those schemes (Li et al., 2026a; Xie et al., 2025), which is why the report's suffices here. Our contributions below examine how far these conclusions extend beyond this setting, and address the third question.
Our Contributions. Our contributions are summarized as follows.
- textGrain makes detection harder: We establish that, with a fixed number of columns and entropy fractions , the minimax detection boundary of textGrain is , which reduces to when the entropy fraction is bounded away from zero (Theorem 2.4 and Corollary 2.5). The detection boundary for both the Gumbel-max watermarking (Li et al., 2026a, Theorem 2) and the maximal coupling watermarking (Xie et al., 2025, Theorem 3.5) is given by . Therefore, the detectable region for the minimax optimal detector of
the textGrain watermark is strictly contained inside the detectable region of Gumbel-max or maximal coupling-based watermarks; hence, textGrain watermarks are strictly harder to detect. A richer phase transition beyond merely Theorem 1.1, with , is presented in Figure 1 or Table 1, as well as in Theorem 2.4.
-
Sum test is consistent throughout the detectable regime when the number of columns is fixed. We show that, when the number of columns is fixed, the report's statistic attains this minimax boundary for the testing problem (3), and is therefore consistent whenever detection is possible. This is mostly an artifact of textGrain making watermark detection harder: for the maximal-coupling watermark, the sum test of Xie et al. (2025) also has boundary , which there renders it suboptimal. This optimality, however, does not extend to a growing number of columns, where can miss detectable alternatives. A detailed exposition can be found in §3.1.
-
Sum test is suboptimal when number of columns grows. In Proposition 3.4, we show that when we allow a large entropy budget as well as growing , fails to achieve the optimal detection boundary; see Figure 2 for the corresponding phase-diagram with , , and . Moreover, even where attains the detection boundary, it is never exponentially efficient. Following the efficiency criterion of Li et al. (2026a), we identify the optimal exponential rate at which the type II error of any level- detector can decay under textGrain (Theorem 4.2). We then show that, at every fixed textGrain alternative, the type II error of decays at a strictly slower rate (Proposition 4.4).
-
An adaptive test that is optimal in both senses. To remedy these shortcomings, we propose a weighted multiscale binomial test (Algorithm 1) that uses the same token scores as and requires no knowledge of the NTPs, the entropy budget, or the edit fraction. It attains every detection boundary established in this paper, including those missed by (Theorems 4.6 and 4.8), as well as the optimal exponential rate (Theorem 4.9).
Table 1: Detection boundaries in the plane, where , and, for growing , . Both textGrain rows assume entropy fractions ; no test separates the hypotheses above the boundary, and consistent tests exist below it.
| Watermark | Detection boundary |
|---|---|
| textGrain, fixed m | |
| textGrain, growing m | |
| Gumbel-max | |
| Maximal coupling |
Xie et al. (2025) define rather than ; see Remark 2.6.
We end this section with an interesting observation. In contrast to our intuition, the shrinking detection boundary in Theorem 1.1 seems to be not merely an artifact of retaining randomness- in fact, maintaining entropy-calibration in an watermark scheme need not lead to harder watermark detection. In particular, in Example 1, we construct a toy unbiased and entropy-preserving watermarking scheme RG such that and the corresponding alternative separates in a regime where and asymptotically merges into one another. Consider the following example.
Example 1. In this example, we construct a toy watermarking scheme RG (Randomized Gumbel-max) which itself is unbiased and entropy-calibrated, and show that there exists a regime where the hypotheses corresponding to RG asymptotically separates, whereas those corresponding to textGrain do not. Set . For , put and , . Consider a fixed partition and for . Thus has full token support and . Fix and set . Define
For each , let select block with probability . Let and, let satisfy
Define the randomized Gumbel-max conditional token distribution by
It is easy to verify that for all sufficiently small , (4) defines an unbiased watermark scheme satisfying . Consider as the hypothesis corresponding to in (3). Then, taking and leads to a detectable separation between and :
In contrast, for textGrain watermarking, it is impossible to separate and asymptotically under the same setting.
See Proposition B.1 for a detailed statement and the proof. This example shows that the stricter detectable regime is not an immediate consequence of fusing entropy-calibration into unbiased watermarking; the detection boundary arises purely out of construction of textGrain.
denote the entropy of the two-point probability vector , with the convention . For non-negative sequences and , we write if for all and some constant , and if for all and some constants . We also write to mean , and if . For densities on , let and denote the chi-squared and Kullback–Leibler divergences, respectively, defined as
with the convention , and with both divergences set equal to if on a set of positive Lebesgue measure. The maximum of an empty set is .
2 Detection boundary for textGrain
This section devotes itself to a thorough treatment of the optimal detection boundary for any potential textGrain-detector. In particular, §2.1 introduces the key assumptions that enables a systematic treatment of the alternative hypothesis , following which, we address the questions of detection boundary, and the optimality of the sum-test , in the subsequent sections.
2.1 Preliminaries: assumptions on textGrain and watermark detection
At any position, the textGrain watermark has five key components: NTP , the partitions , the pseudo-random variables , the random draw , and the entropy regularizer (Li et al., 2026b). Assumption 1 rules out pathological schemes by explicitly specifying the inter-dependence of all these components. Precisely, if is the filtration containing the generation and key history through position , then we presume the following.
Assumption 1. At position , and are -measurable. The partition , column and pseudo-random variables are drawn independently at every step .
Assumption 1 retains the conditional mixture structure of Li et al. (2026a, Assumption 1). In particular, under the null of no watermarking, the random draws used for the partition , pseudo-randomness , and selected column , are independent at a fixed context. This, in turn, makes the NTP and the pivot statistics independent. In contrast, under watermarking, they are obviously not independent; the parameter dictates the strength of textGrain watermarking, i.e. how far the joint distribution can venture out to from .
Note that in textGrain’s official implementation Li et al. (2026b), only the first occurrence of each context window is scored. A fixed Key and a fixed finite window allow only finitely many distinct contexts, which doesn’t facilitate asymptotic analysis. There are a few ways to circumvent this: for example, Cai et al. (2025); Blanchet et al. (2026) considers a growing vocabulary size; on the other hand, one may also consider a growing context space or a fresh Key to ensure randomness. As a convention, we presume the latter: each scored position uses a fresh keyed randomness conditional on the past. Accordingly, all asymptotics are taken as , where n is a deterministic number of fresh scored positions.
We also need to take care of the stochasticity arising out of the partition g. Assumption 2 specifies when token uncertainty remains visible after partitioning.
Assumption 2. There is a constant such that, at every position and for every pair of distinct tokens , almost surely.
In particular, independent uniform assignments to B blocks satisfy Assumption 2 with . Nevertheless, we emphasize that Assumption 2 allows for more general choices of partitions. Before moving on to the detection boundary, we round off this discussion by specifying what we mean as a watermark detector.
How would a generic textGrain detector work? A textGrain detector would primarily consist of a score test , which may employ the scored tokens , partitions , the corresponding variables , and selected columns . In general, the pivot distributions is not available to the detector. For the analysis of an arbitrary detector (we also use the phrase "score test" interchangeably), we characterize the general class of alternatives for the test (3).
Definition 2.1 (Token alternative class and minimax total error). Let be the nonempty class of alternative laws satisfying Assumptions 1 and 2. In particular, the distributions in satisfies
Define the corresponding minimax risk on this class over the score tests as,
In the following section, we proceed towards identifying the optimal detection boundary for textGrain via a minimax analysis of .
2.2 Theoretical guarantees: detectability
Before embarking on an analysis of the detector, we formalize the intuition that textGrain works by providing a signal analysis. To that end, recall ; let denote the corresponding alternative law, so that . Note that
Theorem 2.2 characterizes the signal strength for any natural score function , applied on the pivot statistics from (2).
Theorem 2.2 (Token-level signal strength). Grant Assumption 1. Let , and let satisfy Assumption 2. Set , and let denote expectations under . Then . In particular, for every fixed nondecreasing with ,
Consequently, this holds almost surely conditional on .
Note that Li et al. (2026b) suggests ; the same conclusion holds for this choice as well.
Remark 2.3. Theorem 2.2 hints at an interesting interplay between hardness of a detection problem, and the entropy calibrated by textGrain. Moreover, observing that
it follows that if , as . Thus, from Theorem 2.2,
for all sufficiently small . For comparison, consider the Gumbel-max watermark and write for expectation under its watermarked pivot distribution. For the same score , Li et al. (2026a, Proposition A.1 in the supplementary material) show that . Combining these bounds with Theorem 2.2 gives
For a fixed vocabulary, . Hence, relative to Gumbel-max, textGrain loses a logarithmic factor in the signal strength of the corresponding detectors.
Under in (3), the score at position has conditional density given , whose -divergence from equals . By Theorem 2.2, each position therefore contributes information of order , and summing over the positions suggests that in light of , detection is governed by
Theorem 2.4 formalizes the above intuition.
Theorem 2.4 (Detection boundary). Recall from Definition 2.1. Let be fixed, and suppose Assumptions 1 and 2 hold.
• If , then .
• If , then and .
• Finally if and only if .
The polynomial specialization gives an explicit boundary in the sparsity, token uncertainty, and entropy-fraction exponents.
Corollary 2.5 (Phase diagram). Grant the conditions and notations of Theorem 2.4. Suppose , , and for fixed .
• If , or if with , then
• If , then and .
• If and , then . In particular, if , then the detection boundary is given by , and on it.
Remark 2.6 (Comparison of the finite-column boundaries). If , Corollary 2.5 gives the textGrain boundary . In contrast, the Gumbel-max boundary in Li et al. (2026a, Theorems 2–3) and the weak-signal maximal-coupling boundary in Xie et al. (2025, Theorems 3.5 and 3.7) are . For comparison, we must note that for Xie et al. (2025), is defined as instead of for Gumbel-max or textGrain. Finally, the dependence on a vanishing in Corollary 2.5 also reflects textGrain's fractional conditional-entropy constraint, which is absent from those two weak-signal parametrizations.
As mentioned before, the optimal detection boundary for textGrain thus coincides numerically with the sum-test boundary in Li et al. (2026a) or Xie et al. (2025). We will formally establish the analogous result for in §3. Moving forward, we investigate the detection boundaries when the number of columns m, is allowed to diverge.
2.3 Detection boundary with growing columns
This section devotes itself to optimal boundary detection when the number of columns, m, is allowed to diverge with n. Analogous to Definition 2.1, we consider the following class of alternatives.
Definition 2.7. Let be the nonempty class of alternatives, such that at every position
. The corresponding minimax risk is given by
When the absolute entropy budget is large compared with the rare-block mass, the next theorem preserves the nonbinding detection exponent. It does not assert a constant-factor equivalence of the information in the two budget regimes.
Theorem 2.8 (strong entropy budget). Suppose Assumptions 1 and 2 hold, and assume that and with . Let .
(a) Uniformly over and , it follows that .
(b) Suppose with , and consider the minimax risk from Definition 2.7.
• If , .
• If , then .
• Finally, if , then every score test satisfies
Theorem 2.8 highlights a computation-accuracy trade-off. With a strong entropy budget, the per-position information grows like , so additional columns improve detectability only until . On the other hand, generating a textGrain token requires sampling a Gumbel table and solving (1) over it, at a cost of at least .
Remark 2.9 (The role of the entropy budget). The entropy fraction interpolates between un-watermarked and fully key-dependent generation. When , the constraint in (1) forces , so that the token is drawn from independently of the key, i.e. under the null. As the budget increases, the key exerts more influence on the token and the detectable region expands. This gain, however, saturates. Once the absolute budget dominates the rare-block mass, Theorem 2.8 shows that the boundary no longer depends on the budget and coincides with that of the maximal fraction . Beyond this point, detectability is limited by the token uncertainty and the number of columns rather than by . In terms of our first question, the entropy budget therefore trades preserved sampling randomness for detectability only up to the scale of the rare-block mass.
The next theorem treats entropy budgets that are small relative to block uncertainty. Fix , and let . Let be the nonempty class of alternative laws satisfying Assumptions 1 and 2, such that, at every position , almost surely,
The corresponding minimax risk is defined by
Theorem 2.10 (Growing columns with a weak entropy budget). Consider the class defined above, and suppose and .
(a) It follows that .
(b) For every fixed nondecreasing with ,
(c) if and only if . Moreover, if , then every measurable score test satisfies
Remark 2.11 (What the entropy-budget results determine). Theorem 2.8 treats fixed positive entropy fractions and gives the strict growing-column boundary . In contrast, under the block-uncertainty conditions of Theorem 2.10, a weak entropy budget gives information of order and a mean shift of order for every fixed nonconstant nondecreasing square-integrable score. Interestingly, this does not depend on the column growth rate, subject to .
3 Optimality of test based on sum statistic
Having characterized when detection of textGrain is possible at all, we now turn to the second question raised in Section 1: does the sum statistic proposed by Li et al. (2026b) detect the watermark whenever the information-theoretic limits of Section 2 permit? We answer this question in two stages, first for a fixed number of columns , where the answer is affirmative, and then for a growing number of columns, where the can miss alternatives that nevertheless remain detectable.
3.1 Fixed-column sum statistics
We begin with the fixed-column regime of Section 2.2, which corresponds to the default configuration of textGrain. In this regime, Theorem 2.2 already suggests that is consistent. To elaborate, every fixed nondecreasing score shifts its mean by an amount of order , which we refer to as information, since this is precisely the square root of the per-token information driving the lower bound in Theorem 2.4. Summing such scores, of which a fraction carry the signal, should therefore separate the two hypotheses as soon as diverges. The following theorem makes this heuristic rigorous in two forms: first for a generic monotone score with a Chebyshev-type threshold, and then for the report's statistic calibrated by its exact Gamma( ) null distribution.
Theorem 3.1. (a) Let be fixed and nondecreasing, with ,
and be the class in Definition 2.1. Following (5), if ,
and , then under Assumptions 1, and, 2, the test
has total error satisfying
(b) For in (2), let denote the -quantile of the Gamma law. Fix and let . If , then
Remark 3.2 (Fisher’s statistic and the meaning of sum-test optimality). Since , the Li et al. (2026b)’s detector is Fisher’s combination statistic. Fisher’s method is known to fail in very sparse Gaussian mixtures (Donoho and Jin, 2004, Theorem 1.5), where the signal sits in an extreme tail that a sum dilutes. Interestingly, Theorem 3.1 shows that this failure does not occur for textGrain with a fixed number of columns, since, Theorem 2.2 instructs that the mean shift of every monotone score is already of the order of the square root of the information. When the number of columns grows, the signal can concentrate in a small upper tail, and Proposition 3.4 shows that the then loses detectable alternatives.
We pause to ponder over the implications of Theorem 3.1.
-
(a) shows that a sum test built from any fixed monotone score is consistent under exactly the condition , which Theorem 2.4 identifies as necessary for every score test.
-
(b) shows that the report’s , with its exact Gamma calibration and a slowly vanishing level, inherits this guarantee at the cost of only an additional factor, and therefore attains every consistency region of Corollary 2.5.
To summarize, Theorem 3.1 thus answers our second question in the affirmative whenever the number of columns is fixed. This stands in sharp contrast with Gumbel-max, for which sum tests are strictly suboptimal (Li et al., 2026a, Theorem 4). The contrast is a direct consequence of our first finding: by making detection harder, textGrain shrinks its minimax boundary from down to the sum-test boundary , leaving no room for a more sophisticated detector to improve on the statistic from Li et al. (2026b).
3.2 A detection-boundary loss for
We next ask whether the optimality of the survives once the number of columns grows. A weak entropy budget, with , is the natural first case. Recall that the weak entropy result in §2, Theorem 2.10(b), shows that the mean shift of every monotone score retains the order of the square root of the information. The budget therefore keeps the signal from concentrating in a small tail, and attains the weak-budget boundary under the column-growth condition of Theorem 2.10. We formalize this in Theorem 3.3.
Theorem 3.3. Consider the setup of Theorem 2.10. Fix and put . Let be the quantile of Gamma . If , then
In the above result, the condition matches the minimax characterization of Theorem 2.10(c) up to a factor, and it does not depend on how fast grows. Thus, with respect to our second question, a growing number of columns does not by itself make the suboptimal. As we show next, the loss arises only when the entropy budget is large enough to let the signal concentrate in a small upper tail.
When the entropy budget is large compared with the rare-block mass, Theorem 2.8 shows that a growing number of columns enlarges the detectable region to . The next proposition shows that the cannot exploit this gain: its sensitivity is governed by regardless of the number of columns, so every threshold fails once .
Proposition 3.4 (Suboptimality of thresholds for the ). Suppose Assumption 1 holds, and . Consider (3), with independent under each alternative law. Suppose that, at every position , , where .
• If , then every deterministic sequence satisfies
- Suppose that , , and , with , , , and . Then the preceding conclusion holds uniformly over the nonempty subclass of with deterministic parameter sequences and prescribed partition laws, for which the pivots are independent. In contrast, Theorem 2.8 implies that the minimax total error over this subclass tends to zero.
Proposition 3.4 dictates that is asymptotically powerless for every choice of threshold whenever , although Theorem 2.8 guarantees consistent tests throughout . With growing columns and a large entropy budget, the answer to our second question is therefore negative: the region , which is nonempty whenever , is detectable but missed by . Together with Theorems 3.1 and 3.3, this completely delineates when the report's statistic is optimal and when it's not. Additionally, it motivates the requirement of an adaptive test which attains the full detectable region. We construct such a test in Section 4.2.
4 Optimal exponential efficiency and efficient adaptive tests
The detection boundary describes when the errors of a test vanish, but not how fast. We now address our third question: following the efficiency criterion of Li et al. (2026a), we identify the optimal exponential rate at which the type II error of a level- test can decay under textGrain, ask whether the attains it, and construct an adaptive test that does.
4.1 A class-dependent result for nonstationary alternatives
Since the generation parameters may vary arbitrarily across positions, the relevant rate is determined by the worst case over a class of edited score densities. We begin by specifying this class.
Definition 4.1 (Convex family for the efficiency comparison). Fix a finite vocabulary , positive integers , a prescribed partition law, and . For a nonempty collection of pairs with , define
The densities are averaged over the prescribed partition law. The bar denotes the closure in of all finite convex combinations of the displayed densities.
The closed convex hull is needed because the parameters may change from position to position in ways the detector cannot observe. Averaging over such variation produces mixtures of the individual score densities, and the least-favourable alternative may be one of these mixtures rather than a density generated by a single pair . The following assumption formalizes this setting: it plays the role of Definition 2.1 for the efficiency analysis, allowing to be chosen adaptively from at every position.
Assumption 3 (Parameter class for exponential efficiency). Assumptions 1 hold with a fixed , a fixed finite vocabulary , fixed , and the same prescribed partition law at every fresh position. For every , the -measurable pair belongs to the nonempty class in Definition 4.1. Write for the class of all resulting alternative laws. This class includes every deterministic sequence of pairs in .
Unlike the sparse regime of Sections 2 and 3, the edit fraction is now held fixed, so that the errors of a good test decay exponentially in . Following Li et al. (2026a, Definition 1 and Theorem 5), we measure efficiency by the exponential rate of the worst-case type II error at a prescribed significance level. The next theorem identifies the optimal rate over and shows that it is attainable.
Theorem 4.2 (Optimal class-dependent exponential efficiency). Under Assumption 3, every sequence of score tests satisfying obeys
Under Assumption 2, the infimum is strictly positive if , and if there exist such that and for every . Finally, under these additional conditions, if with , then there exists level- valid tests such that the equality in (a) holds. Furthermore, these tests above satisfy
Remark 4.3 (Proof strategy, and comparison with the literature). We include a brief window into our proof strategy; detailed proofs would be included in a forthcoming extended draft. Li et al. (2025a, Theorem 3.2) identify an optimal Gumbel-max score and least-favourable NTP vector through a scheme-specific convexity argument. On the other hand, Li et al. (2026a, Theorem 5) prove that Tr-GoF attains the corresponding mixture exponent without knowing the edit fraction or regularity. That theorem uses a divergence index in and no stability truncation. In contrast, for textGrain, Theorem 4.2 takes the least-favourable comparison over the closed convex family of exact edited score laws in Definition 4.1; it does not assume that one NTP distribution generates the minimizing density.
In Theorem 4.2, the optimal exponent is the Chernoff–Stein exponent against the least-favourable edited score law, and the converse shows that no score test, whatever its construction, can exceed it. The positivity statement ensures that, under nondegenerate token uncertainty and entropy fractions, remains exponentially detectable at every fixed edit fraction. With respect to our third question, Theorem 4.2 supplies the benchmark against which any detector should be judged. We next show that the falls strictly short of it.
Proposition 4.4 (Strict efficiency loss of the exponential-score sum). Let be a probability density on with a nondecreasing version, such that almost everywhere for constants and on a set of positive Lebesgue measure. Let be as in Theorem 2.4, and let be the law under which are iid with density . Fix , let be the -quantile of Gamma, and let be as in (2), so that .
(a) (Exponent of the sum test.) The type II error of satisfies
and
(b) (Optimal exponent.) There exist score tests with for every such that
Conversely, every sequence of possibly randomized score tests with satisfies
In the above result, part (a) gives the exact exponent of the report's level- test, and part (b), which specializes Theorem 4.2 to a single alternative, shows that this exponent is strictly smaller than the optimal one at every non-uniform alternative. Since each is nondecreasing and bounded by , the proposition applies to every textGrain mixture with and , with and . Thus, with respect to our third question, the report's statistic, although optimal at the detection boundary when m is fixed (Theorem 3.1), is never exponentially efficient: at every fixed alternative, its type II error decays strictly more slowly than is attainable. This gap is invisible at the level of detection boundaries, and it motivates the adaptive test of Section 4.2, which attains the optimal exponent.
4.2 A weighted multiscale binomial test
Propositions 3.4 and 4.4 expose two distinct shortcomings of the : it misses detectable alternatives whose signal concentrates in a small upper tail, and it loses the optimal exponential rate even when the signal is spread out. Both stem from committing to a single fixed score. We therefore propose a test that instead compares the empirical tail probabilities of the p-values with their null values over a grid of levels: the small dyadic levels capture concentrated signals, while a progressively finer mesh allows the test to approximate the optimal exponent without knowing the alternative.
For , let and define the grid
The dyadic levels reach down to tail probabilities of order , while the ordinary mesh becomes dense in as n grows. We attach to these levels the weights
(9) which sum to one and reserve half of the total mass for the median, where spread-out signals are most visible. Let , for and , denote the Bernoulli Kullback–Leibler divergence. With as in (2), let and define
Each term in (10) is the log-likelihood ratio statistic for an excess of small p-values at level u, penalized by its weight. The restriction to reflects the fact that watermarking can only inflate the lower tail of the p-values. The resulting statistic is a weighted, one-sided version of the Berk–Jones statistic (Jager and Wellner, 2007, Section 2), and its scan over several tail levels follows the higher-criticism principle of Donoho and Jin (2004).
With these ingredients in place, we can now describe the complete detection procedure, summarized in Algorithm 1. Given a text and the secret key, the detector first reconstructs, at each retained position, the partition, the Gumbel table, and the selected column, exactly as is required for . From these, it computes the pivots and the p-values . It then evaluates the empirical tail proportions on the grid , forms as in (10), and declares the text watermarked when exceeds . The procedure therefore uses the same inputs as the report's detector, and in particular requires no knowledge of the NTPs , the entropy fractions , the edit fraction , or the transport coupling.
Algorithm 1: Adaptive detection of textGrain by a weighted binomial scan
Input: Text, tokenizer, secret key, shared partition and column configuration, context rule, and significance level .
Output: Detection or no detection.
1 Tokenize the text and retain the first scored occurrence of each context window prescribed by the shared context rule;
2 Let n be the number of retained positions;
3 if n = 0 then
4 return no detection;
5 for do
6 Reconstruct the partition , cost table , and column from the key and observed context;
7 Set and as in (2);
8 Construct and from (8)–(9);
9 Sort and compute for each ;
10 Compute from (10);
11 if then
12 return detection;
13 else
14 return no detection;
After score reconstruction, the procedure requires only a sort of the p-values, and hence operations. The next theorem establishes its finite-sample validity and a general sufficient condition for power.
Theorem 4.5 (Size and conditional power). Let be a deterministic integer, and suppose that the conditional score laws satisfy (3), with a deterministic , with respect to a filtration to which the scores are adapted. For every , the test in Algorithm 1, defined by (8), (9), and (10), satisfies . For the power statement, suppose the conditional signal densities satisfy almost surely, where is deterministic and may depend on . Suppose also that there are deterministic and such that almost surely for every . If
then its type II error satisfies
with both bounds being uniform over all conditional laws satisfying the stated assumptions.
In Theorem 4.5, the size guarantee is exact at every sample size and holds under arbitrary dependence across positions, since the weights act as a weighted Bonferroni correction over the grid. Power reduces to finding a single level at which the signal places excess tail mass . The factor in the condition favours signals concentrated in small tails, which are exactly those that dilutes, and the price of not knowing is only . The remaining results verify this condition in each regime, showing that the test recovers every detection boundary of Section 2,
We begin with the fixed-column regime of Theorem 2.4, where the report’s sum is already optimal. Applying Theorem 2.2 to the nondecreasing score shows that the signal places excess mass of the order of the square root of the information above the median. The weight reserved for in (9) therefore suffices, and the following theorem shows that the proposed test attains the boundary of Theorem 2.4 without knowledge of , , or .
Theorem 4.6 (Adaptive optimality at the detection boundary). Consider the token-class setup of Theorem 2.4. For every fixed , Algorithm 1 satisfies for every and
whenever . Fix and let . If
then its sum of type I and worst-case type II errors satisfies
Theorem 4.6 shows that adaptivity comes for free at the fixed-column boundary: the fixed-level test is consistent under exactly the necessary and sufficient condition of Theorem 2.4, because the median weight keeps the penalty bounded. Driving the type I error to zero as well costs only a factor, as for the report's sum in Theorem 3.1. Hence, adopting the proposed test in place of entails no loss in the regime where the report's statistic is optimal. Specializing to the polynomial scalings of Corollary 2.5, a single vanishing-level test attains the entire consistency region of the phase diagram.
Corollary 4.7 (Adaptive attainment of the phase diagram). Under the token-class assumptions of Corollary 2.5, fix and let . If , or if with and , then Algorithm 1 has vanishing sum of type I and worst-case type II errors:
The region in Corollary 4.7 coincides with that of Corollary 2.5. It includes the part of the boundary surface with , where the information diverges only logarithmically, and on the rest of that surface no test is consistent. We now turn to the growing-column regimes, where the report's sum is no longer optimal. When the number of columns grows, the entropy budget determines where the signal lies. A large budget allows it to concentrate in a small upper tail, while a weak budget keeps it visible at the median. Since the grid contains both the dyadic levels and the median, a single test covers both cases.
Theorem 4.8 (Adaptive attainment with growing columns). For a fixed and , the test of Algorithm 1 satisfies
in each of the following cases.
(a) (Large budget.) , under the setup of Theorem 2.8 with , , and .
(b) (Weak budget.) , under the setup of Theorem 2.10 with .
Theorem 4.8 completes the answer to our second question. Part (a) attains the full detectable region of Theorem 2.8, including the region where, by Proposition 3.4, every threshold for fails. Part (b) matches the weak-budget boundary of Theorem 2.10, as the report's sum does by Theorem 3.3. The proposed test therefore remains optimal in every regime considered, including those where is not.
The tests in Theorem 4.2 are built from the least-favourable density in , and therefore require knowledge of , which is unavailable in practice. The proposed test avoids this requirement. Since the edited score laws are nondecreasing, their tail probabilities on the increasingly fine mesh in (8) determine them asymptotically, and the next theorem shows that this suffices to attain the optimal exponent.
Theorem 4.9 (Adaptive attainment of the optimal exponential efficiency). Under the setup of Theorem 4.2, for every satisfying and , the test of Algorithm 1 satisfies
Consequently, under the positivity conditions of Theorem 4.2 and , .
Theorem 4.9 settles our third question: the proposed test attains the optimal exponent of Theorem 4.2 uniformly over , without knowledge of or of the least-favourable density. In particular, at every fixed textGrain alternative of Proposition 4.4, it attains the exponent that the report's sum misses. Combined with Theorems 4.6 and 4.8, a single parameter-free test is therefore optimal both at the detection boundary and in exponential efficiency, in every regime considered.
5 Discussion
This paper set out to understand what the entropy calibration of textGrain costs at detection time, and whether the sum statistic proposed by Li et al. (2026b) remains an adequate detector once the text has been edited. We found that textGrain is strictly harder to detect than Gumbel-max and maximal-coupling watermarks (Corollary 2.5), a cost that stems from its construction rather than from preserving entropy itself (Example 1), and that this very loss makes the sum statistic optimal at the detection boundary when the number of columns is fixed (Theorem 3.1). However, this optimality is not the whole picture. Indeed, the sum statistic misses detectable alternatives when the number of columns grows under a large entropy budget (Proposition 3.4), and it is never exponentially efficient at a fixed edit fraction (Proposition 4.4). The weighted multiscale binomial scan of Algorithm 1 closes both gaps, attaining every detection boundary and the optimal exponential rate without knowledge of the next-token distributions, the entropy budget, or the edit fraction (Theorems 4.6, 4.8 and 4.9), although extending these guarantees to the repeated contexts of the official implementation in Li et al. (2026b) remains open.
AI usage statement
The authors conceived the ideas and the research questions, and formulated the results. They acknowledge the use of ChatGPT-Pro 6.1 Astra and Claude Opus 5.5 for sharpening theorem statements and general exposition. The authors retain full responsibility for the veracity of the content.
References
Scott Aaronson. Watermarking of large language models. Talk at the Simons Institute for the Theory of Computing. https://simons.berkeley.edu/talks/scott-aaronson-ut-austin-openai-2023-08-17, August 2023.
Boaz Barak. An intensive introduction to cryptography. Lecture notes for Harvard CS 127. https://intensecrypto.org/public/index.html, 2021. Fall 2021.
Jose H Blanchet, T Tony Cai, Xiang Li, Hao Liu, Qi Long, and Weijie J Su. Optimal watermark localization in mixed-source large language model texts. arXiv preprint arXiv:2608.14906, 2026.
T Tony Cai, Xiang Li, Qi Long, Weijie J Su, and Garrett G Wen. Optimal detection for language watermarks with pseudorandom collision. arXiv preprint arXiv:2510.22007, 2025.
Zhongze Cai, Shang Liu, Hanzhao Wang, Huaiyang Zhong, and Xiaocheng Li. Towards better statistical understanding of watermarking LLMs. Journal of the American Statistical Association, 121(553):247–258, 2026. doi: 10.1080/01621459.2026.2618290.
Miranda Christ, Sam Gunn, and Or Zamir. Undetectable watermarks for language models. In Proceedings of the Thirty Seventh Conference on Learning Theory, volume 247 of Proceedings of Machine Learning Research, pages 1125–1139. PMLR, 2024.
Sumanth Dathathri, Abigail See, Sumedh Ghaisas, Po-Sen Huang, Rob McAdam, Johannes Welbl, et al. Scalable watermarking for identifying large language model outputs. Nature, 634(8035):818–823, 2024. doi:10.1038/s41586-024-08025-4.
Marc Ditzhaus. Signal detection via Phi-divergences for general mixtures. Bernoulli, 25(4A):3041 – 3068, 2019. doi: 10.3150/18-BEJ1079. URL https://doi.org/10.3150/18-BEJ1079.
David Donoho and Jiashun Jin. Higher criticism for detecting sparse heterogeneous mixtures. The Annals of Statistics, 32(3):962–994, 2004. ISSN 00905364. URL http://www.jstor.org/stable/3448581.
David Donoho and Jiashun Jin. Special invited paper: Higher criticism for large-scale inference, especially for rare and weak effects. Statistical science, pages 1–25, 2015.
European Commission. Code of Practice on Transparency of AI-Generated Content. https://digital-strategy.ec.europa.eu/en/policies/code-practice-ai-generated-content, June 2026. Final version published 10 June 2026.
European Parliament and Council of the European Union. Regulation (EU) 2024/1689 of 13 June 2024 laying down harmonised rules on artificial intelligence (Artificial Intelligence Act). Official Journal of the European Union, L series, 12 July 2024. http://data.europa.eu/eli/reg/2024/1689/oj, 2024. See Article 50 (transparency obligations).
Jiayi Fu, Xuandong Zhao, Ruihan Yang, Yuansen Zhang, Jiangjie Chen, and Yanghua Xiao. GumbelSoft: Diversified language model watermarking via the GumbelMax-trick. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 5791–5808, Bangkok, Thailand, 2024. Association for Computational Linguistics. doi: 10.18653/v1/2024.acl-long.315.
Zhengmian Hu, Lichang Chen, Xidong Wu, Yihan Wu, Hongyang Zhang, and Heng Huang. Unbiased watermark for large language models. In The Twelfth International Conference on Learning Representations, 2024.
Leah Jager and Jon A. Wellner. Goodness-of-fit tests via phi-divergences. The Annals of Statistics, 35(5):2018–2053, 2007. doi: 10.1214/0009053607000000244. URL https://doi.org/10.1214/0009053607000000244.
John Kirchenbauer, Jonas Geiping, Yuxin Wen, Jonathan Katz, Ian Miers, and Tom Goldstein. A watermark for large language models. In Proceedings of the 40th International Conference on Machine Learning, volume 202 of Proceedings of Machine Learning Research, pages 17061–17084. PMLR, 2023.
Rohith Kuditipudi, John Thickstun, Tatsunori Hashimoto, and Percy Liang. Robust distortion-free watermarks for language models. Transactions on Machine Learning Research, 2024.
Martin Larsson, Aaditya Ramdas, and Johannes Ruf. The numeraire e-variable and reverse information projection. The Annals of Statistics, 53(3):1015–1043, 2025.
Taehyun Lee, Seokhee Hong, Jaewoo Ahn, Ilgee Hong, Hwaran Lee, Sangdoo Yun, Jamin Shin, and Gunhee Kim. Who wrote this code? Watermarking for code generation. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 4890–4911, Bangkok, Thailand, 2024. Association for Computational Linguistics. doi: 10.18653/v1/2024.acl-long.268.
Xiang Li, Feng Ruan, Huiyuan Wang, Qi Long, and Weijie J Su. A statistical framework of watermarks for large language models: Pivot, detection efficiency and optimal rules. Annals of statistics, 53(1):322, 2025a.
Xiang Li, Garrett Wen, Weiqing He, Jiayuan Wu, Qi Long, and Weijie J Su. Optimal estimation of watermark proportions in hybrid ai-human texts. arXiv preprint arXiv:2506.22343, 2025b.
Xiang Li, Feng Ruan, Huiyuan Wang, Qi Long, and Weijie J Su. Robust detection of watermarks for large language models under human edits. Journal of the Royal Statistical Society Series B: Statistical Methodology, 88(2):491–515, 2026a.
Xiang Li, Garrett Wen, Xiaohong Chen, Qi Long, Arzav Jain, Florent Joly, Mike Lam, Qingquan Song, and Weijie Su. textgrain: Entropy-calibrated watermarking for language model text. Technical report, 2026b.
Yijian Lu, Aiwei Liu, Dianzhi Yu, Jingjing Li, and Irwin King. An entropy-based text watermarking detection method. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 11724–11735, Bangkok, Thailand, 2024. Association for Computational Linguistics. doi: 10.18653/v1/2024.acl-long.630.
Bruce Schneier. Applied Cryptography: Protocols, Algorithms, and Source Code in C. John Wiley & Sons, New York, 2nd edition, 1996.
Dor Tsur, Carol Long, Claudio Mayrink Verdun, Sajani Vithana, Hsiang Hsu, Richard Chen, Flavio Calmon, et al. Heavywater and simplexwater: Distortion-free llm watermarks for low-entropy distributions. Advances in Neural Information Processing Systems, 38:107204–107256, 2026.
Yihan Wu, Zhengmian Hu, Junfeng Guo, Hongyang Zhang, and Heng Huang. A resilient and accessible distribution-preserving watermark for large language models. In Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research. PMLR, 2024.
Yangxinyu Xie, Xiang Li, Tanwi Mallick, Weijie Su, and Ruixun Zhang. Debiasing watermarks for large language models via maximal coupling. Journal of the American Statistical Association, 120(551):1424–1436, 2025.
Xuandong Zhao, Lei Li, and Yu-Xiang Wang. Permute-and-flip: An optimally stable and watermarkable decoder for LLMs. In The Thirteenth International Conference on Learning Representations, 2025.
Lei Zhou, Min Gao, Zongwei Wang, Yibing Bai, and Wentao Li. Green-red watermarking for recommender systems. arXiv preprint arXiv:2604.23568, 2026.
Appendix
This appendix contains a broad overview of literature related to our works, along with an auxiliary result validating Example 1. Detailed proofs of our results are available upon request, and will be included in the forthcoming extended version.
A Related Literature
Our work sits at the confluence of two strands of research: the design of watermarking schemes for LLMs, and the statistical theory of their detection.
On the design front, there are two desiderata: fidelity to the language model, and stochasticity of generation. . For example, Red-Green watermarking (Kirchenbauer et al., 2023), since adapted well beyond text (e.g., Zhou et al., 2026), injects additional stochasticity onto the sampled tokens under watermarking, which reduces repetition. While effective, implementing this method distorts the next token probability distribution (NTP), from which the tokens are sampled; in other words, Red-Green watermark is biased. On the other hand, Gumbel-max watermarking (Aaronson, 2023) is unbiased (i.e. a watermarked token has, marginally, the same NTP as an unwatermarked one), but remains deterministic given the pseudorandom variable implementing the watermark. Subsequent schemes preserve unbiasedness through a variety of constructions, including inverse-transform sampling (Kuditipudi et al., 2024), distribution-preserving reweighting (Hu et al., 2024; Wu et al., 2024), tournament sampling (Dathathri et al., 2024), cryptographically undetectable sampling (Christ et al., 2024), and permute-and-flip decoding (Zhao et al., 2025). Closest to textGrain is the scheme of Xie et al. (2025), which removes the bias of Red-Green watermarking through a maximal coupling while retaining its block structure. textGrain (Li et al., 2026b) replaces this coupling by the entropic OT coupling (1), in which the budget caps the dependence between the keyed table and the sampled block, measured by , as a fraction of .
On the detection front, Li et al. (2025a) cast watermark detection as a hypothesis test on pivotal statistics, and introduced a class-dependent efficiency criterion that yields optimal score functions for Gumbel-max. Li et al. (2026a) model human edits through the mixture alternative underlying (3), identify the Gumbel-max detection boundary , show that sum-based tests are strictly suboptimal on it, and propose an adaptive truncated goodness-of-fit test that attains it. Xie et al. (2025) carry out the analogous program for maximal coupling, where the boundary is again , whereas the sum test only reaches . Related work addresses pseudorandom collisions under repeated contexts (Cai et al., 2025), localization of watermarked segments in mixed-source text (Blanchet et al., 2026), estimation of the watermarked proportion (Li et al., 2025b), and the detection-distortion trade-off (Cai et al., 2026). We follow the template of Li et al. (2025a, 2026a); however, the textGrain alternative carries two parameters absent from these works, namely the entropy budget and the number of columns m. Both reshape the boundary itself (Corollary 2.5 and Theorem 2.8), and with m fixed they reverse the verdict on the sum test (Theorem 3.1) compared to previous literature.
Finally, the sparse regime ties our problem to the detection of sparse heterogeneous mixtures (Donoho and Jin, 2004, 2015). There, Fisher's combination test, of which is an instance, fails in the very sparse regime, while higher criticism and -divergence statistics attain the boundary adaptively (Jager and Wellner, 2007; Ditzhaus, 2019). The multiscale test of §4.2 is a weighted, one-sided Berk–Jones statistic in this tradition. For a fixed edit fraction, the efficiency analysis of §4 becomes a Chernoff–Stein problem against a convexified composite alternative, in the spirit of the reverse information projection of Larsson et al. (2025).
B Preserving entropy need not lead to harder detection
The following proposition gives the precise comparison used in Example 1.
Proposition B.1. Consider Example 1. Recall that satisfies
Write for the textGrain watermarking employing the same NTP, regularization and partition, . For and , let under decoder , and . Then