arXiv:2610.17655stat.MLOct 2026

Manuscript Offprint

arXiv:2610.17655

textGrain watermarking is harder to detect: can sum-tests still do it optimally?

Swapnaneel Bhattacharyya, Soham Bonnerjee

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 εn≍n−p\varepsilon_n \asymp n^{-p} of positions retain the watermark and token uncertainty decays as n−qn^{-q}. First, we show that entropy calibration comes at a cost: the minimax detection boundary of textGrain is p+q=1/2p + q = 1/2, so its detectable region is strictly smaller than that of Gumbel-max and maximal-coupling watermarks, whose boundary is 2p+q=12p + q = 1. 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 W\mathcal{W} be a finite vocabulary with V=∣W∣≥2V = |\mathcal{W}| \geq 2. For a probability vector P=(Pw)w∈WP = (P_w)_{w \in \mathcal{W}}, write H(P)=−∑wPwlog⁡PwH(P) = -\sum_w P_w \log P_w and Δ(P)=1−max⁡wPw\Delta(P) = 1 - \max_w P_w. Fix some B≥2B \geq 2. At each watermarked position, let g:W→[B]g : \mathcal{W} \to [B] is a partition, such that for each w∈Ww \in \mathcal{W}, g(w)g(w) belongs to one of the BB blocks. Further denote the block bb probability as Pbblk=∑w:g(w)=bPwP_b^{\text{blk}} = \sum_{w: g(w) = b} P_w, where we unburden the notation by suppressing the dependence on gg when it is clear from the context. For some m≥1m \geq 1, suppose

Π(Pblk,m−11):={A∈Rb×m:A1=(Pbblk)b∈[B],A⊤1=m−11},\Pi(P^{\mathrm{b l k}},m^{-1}\mathbf{1}):=\{A\in\mathbb{R}^{b\times m}:A\mathbf{1}=(P_{b}^{\mathrm{b l k}})_{b\in[B]},A^{\top}\mathbf{1}=m^{-1}\mathbf{1}\},

be the set of couplings over [B]×[m][B] \times [m] with marginals PblkP^{\text{blk}} and Unif([m])\text{Unif}([m]). Here 1=(1,…,1)⊤\mathbf{1} = (1, \ldots, 1)^\top. Consider Z=(Zbj)b∈[B],j∈[m]∼i.i.dΞ:=standard Gumbel variables\mathbf{Z} = (Z_{bj})_{b \in [B], j \in [m]} \stackrel{\text{i.i.d}}{\sim} \Xi := \text{standard Gumbel variables}. These are also called pseudorandom variables, since, given tokens w1…wt−1w_1 \ldots w_{t-1} and the NTP PtP_t, both the partition gg and the Gumbel random variables can be deterministically constructed via a Key and a hash function A\mathcal{A}. Nevertheless, we invoke the cryptographic properties of A\mathcal{A} (Barak, 2021; Schneier, 1996; Wu et al., 2024; Zhao et al., 2025) to treat Z\mathbf{Z} as random. The deterministic construction comes handy since a detector employs Key and A\mathcal{A} to make gg and (Zbj)b∈[B],j∈[m](Z_{bj})_{b \in [B], j \in [m]} available to it.

Write Gbj=(Zbj−γ)/(π/6)G_{bj} = (Z_{bj} - \gamma)/(\pi/\sqrt{6}), where γ=EZ11\gamma = \mathbb{E}Z_{11} is the mean of a standard Gumbel variable. For β∈[0,1]\beta \in [0,1], consider the entropic OT coupling

πP,β∈arg⁡max⁡DKL(π∥Pblk⊗m−11)≤βH(P)∑b=1B∑j=1mπ(b,j)Gbj.(1)\pi_{P,\beta}\in\underset{\mathrm{D}_{\mathrm{KL}}(\pi\|P^{\mathrm{blk}}\otimes m^{-1}\mathbf{1})\leq\beta H(P)}{\arg\max}\sum_{b=1}^{B}\sum_{j=1}^{m}\pi(b,j)G_{bj}. \tag{1}

Then, given J∼Unif([m])J \sim \text{Unif}([m]), textGrain samples a token W according to

Q(w∣J=j,g,G)=mπP,β(g(w),j)PwPg(w)blk,Pw>0.Q(w\mid J=j,g,G)=m\pi_{P,\beta}(g(w),j)\frac{P_{w}}{P_{g(w)}^{\mathrm{b l k}}},P_{w}>0.

As for detection, Li et al. (2026b) proposes the test statistic

TntextGrain:=−∑t=1nlog⁡(1−Yt),where,Yt:=FG(Zt,g(Wt),Jt).(2)T_{n}^{\mathrm{t e x t G r a i n}}:=-\sum_{t=1}^{n}\log(1-Y_{t}),\mathrm{w h e r e},Y_{t}:=F_{G}(Z_{t,g(W_{t}),J_{t}}). \tag{2}

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 β>0\beta > 0 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 TntextGrainT_n^{textGrain} 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- α\alpha detector can decay when a fixed fraction of the text remains watermarked, and whether TntextGrainT_n^{textGrain} 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 P,β,gP, \beta, g, let f1,P,β,gf_{1,P, \beta, g} denote the density of YY, and define the corresponding time-indexed version f1,t=E[f1,Pt,βt,gt∣Ft−1]f_{1,t} = \mathbb{E}[f_{1,P_t, \beta_t, g_t} \mid \mathcal{F}_{t-1}]. Following Li et al. (2026a, 2025a), we answer the aforementioned questions by formulating the watermark detection as a hypothesis testing problem:

H0:Yt∣Ft−1∼Unif(0,1),1≤t≤n,H1textGrain:Yt∣Ft−1hasdensity(1−εn)+εnf1,t, 1≤t≤n.\begin{align*}H_{0}:Y_{t}\mid\mathcal{F}_{t-1}\sim\mathrm{Unif}(0,1),\quad1\leq t\leq n,\\H_{1}^{\mathrm{textGrain}}:Y_{t}\mid\mathcal{F}_{t-1}\mathrm{has density}(1-\varepsilon_{n})+\varepsilon_{n}f_{1,t},\ 1\leq t\leq n.\end{align*}

(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 εn\varepsilon_n and otherwise carries a uniform pivot, which yields the mixture density in H1textGrainH_1^{textGrain}. Here εn\varepsilon_n measures surviving text-key dependence, and εn→0\varepsilon_n \to 0 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 εn≍n−p\varepsilon_n \asymp n^{-p} and min⁡t∈[n]Δ(Pt)≍max⁡t∈[n]Δ(Pt)≍n−q\min_{t \in [n]} \Delta(P_t) \asymp \max_{t \in [n]} \Delta(P_t) \asymp n^{-q} with Δ(P):=1−max⁡wPw\Delta(P) := 1 - \max_w P_w. 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 p+q>1/2p + q > 1/2, no test can asymptotically separate H0H_0 and H1textGrainH_1^{textGrain} with non-trivial power.

(ii) When p+q<1/2p+q < 1/2, i.e. watermark signal is sufficient, H0H_0 and H1textGrainH_1^{textGrain} separate asymptotically. Moreover, H1textGrainH_1^{textGrain} can be detected using TntextGrainT_n^{textGrain}.

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

Figure 1: Phase diagram for textGrain with a fixed number of columns m, where εn≍n−p\varepsilon_n \asymp n^{-p} and Δn≍n−q\Delta_n \asymp n^{-q}. The navy line p+q=1/2p+q = 1/2 is the minimax boundary of textGrain for βn≍1\beta_n \asymp 1, that is, r=0r = 0 (Corollary 2.5); it coincides with the boundary of TntextGrainT_n^{textGrain} (gold, dotted; Theorem 3.1). The red dashed line 2p+q=12p + q = 1 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 r∗=1−2p−2qr^* = 1 - 2p - 2q, the fastest decay of βn≍n−r\beta_n \asymp n^{-r} that still permits detection. The thin contour lines are the textGrain boundaries 2p+2q+r=12p + 2q + r = 1 for the labeled values of r>0r > 0; TntextGrainT_n^{textGrain} attains each of them, and each is itself detectable when q,r>0q, r > 0. The yellow region is detectable for Gumbel-max and maximal coupling but not for textGrain, for any r≥0r \geq 0. The grey hatched region is undetectable for all three schemes.

Figure

Figure 2: Phase diagram for textGrain with mn≍nsm_n \asymp n^s columns and βt≥β0\beta_t \geq \beta_0. In the green region below the gold line p+q=1/2p + q = 1/2, both TntextGrainT_n^{textGrain} and Algorithm 1 are consistent. Between the gold line and the red dashed line 2p+q=12p + q = 1, the shading from lavender to dark purple shows s∗=2p+2q−1s^* = 2p + 2q - 1. Consistent tests exist if and only if s>s∗s > s^* (Theorem 2.8), Algorithm 1 attains them (Theorem 4.8), and TntextGrainT_n^{textGrain} is powerless there (Proposition 3.4). Each contour line, continued along the red line below q=sq = s, is the textGrain boundary 2p+2q−min⁡(s,q)=12p + 2q - \min(s, q) = 1 for its labeled value of ss. The navy line draws one such boundary in full, for the illustrative value s=0.4s = 0.4, with the circle marking its kink at q=sq = s. The grey hatched region is undetectable for every ss. Under a weak entropy budget (Theorem 2.10), the boundary does not depend on ss, Figure 1 applies, and TntextGrainT_n^{textGrain} remains optimal (Theorem 3.3).

2026a, Theorem 2) and maximal-coupling watermarks (Xie et al., 2025, Theorem 3.5) are detectable throughout 2p+q<12p + q < 1, the detectable region of textGrain is strictly smaller whenever q>0q > 0, so textGrain is indeed harder to detect. This shrinkage has a perhaps unexpected consequence: the textGrain boundary p+q=1/2p + q = 1/2 coincides with the boundary of sum tests for those schemes (Li et al., 2026a; Xie et al., 2025), which is why the report's TntextGrainT_n^{textGrain} 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 βn≍n−r\beta_n \asymp n^{-r}, the minimax detection boundary of textGrain is 2p+2q+r=12p + 2q + r = 1, which reduces to p+q=1/2p + q = 1/2 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 2p+q=12p + q = 1. 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 βn≍n−r\beta_n \asymp n^{-r}, 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 TntextGrainT_{n}^{\mathrm{textGrain}} 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 p+q=1/2p + q = 1/2, which there renders it suboptimal. This optimality, however, does not extend to a growing number of columns, where TntextGrainT_{n}^{\mathrm{textGrain}} 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 mnm_n, TntextGrainT_n^{\mathrm{textGrain}} fails to achieve the optimal detection boundary; see Figure 2 for the corresponding phase-diagram with mn≍nsm_n \asymp n^s, εn≍n−p\varepsilon_n \asymp n^{-p}, and Δn≍n−q\Delta_n \asymp n^{-q}. Moreover, even where TntextGrainT_n^{\mathrm{textGrain}} 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-α\alpha detector can decay under textGrain (Theorem 4.2). We then show that, at every fixed textGrain alternative, the type II error of TntextGrainT_n^{\mathrm{textGrain}} 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 TntextGrainT_{n}^{\mathrm{textGrain}} 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 TntextGrainT_{n}^{\mathrm{textGrain}} (Theorems 4.6 and 4.8), as well as the optimal exponential rate (Theorem 4.9).

Table 1: Detection boundaries in the (p,q)(p,q) plane, where εn≍n−p\varepsilon_n \asymp n^{-p}, Δn≍n−q\Delta_n \asymp n^{-q} and, for growing mm, mn≍nsm_n \asymp n^s. Both textGrain rows assume entropy fractions βn≳1\beta_n \gtrsim 1; no test separates the hypotheses above the boundary, and consistent tests exist below it.

WatermarkDetection boundary
textGrain, fixed m2p+2q=12p + 2q = 1
textGrain, growing m2p+2q−min⁡(s,q)=12p + 2q - \min(s,q) = 1
Gumbel-max2p+q=12p + q = 1
Maximal coupling†^{\dagger}2p+q=12p + q = 1

†^{\dagger} Xie et al. (2025) define Δ(Pt)=1−Pt,Gt\Delta(P_t) = 1 - P_{t,G_t} rather than 1−max⁡wPt,w1 - \max_w P_{t,w}; 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 H0H_0 and the corresponding alternative H1RGH_1^{\mathrm{RG}} separates in a regime where H0H_0 and H1textGrainH_1^{\mathrm{textGrain}} 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 B=m=2B = m = 2. For 0<δ<1/40 < \delta < 1/4, put Pδ,w0=1−δP_{\delta,w_0} = 1 - \delta and Pδ,wi=δ/∣W−1∣P_{\delta,w_i} = \delta/|\mathcal{W} - 1|, i≥1i \geq 1. Consider a fixed partition g(w0)=1g(w_0) = 1 and g(wi)=2g(w_i) = 2 for i≥1i \geq 1. Thus PδP_\delta has full token support and Pδblk=(1−δ,δ)P_\delta^{\mathrm{blk}} = (1 - \delta, \delta). Fix c∈(0,log⁡2)c \in (0, \log 2) and set βδ=cδ/H(Pδ)\beta_\delta = c\delta/H(P_\delta). Define

b∗(Z,J)=argmax⁡b∈[2]{log⁡Pδ,bblk+ZbJ}.b^{*}(Z,J)=\underset{b\in[2]}{\operatorname{argmax}}\{\log P_{\delta,b}^{\mathrm{blk}}+Z_{bJ}\}.

For each u∈(0,1)u \in (0,1), let Pu\mathbb{P}_u select block b=2b = 2 with probability uu. Let H(u)=H(Pu)\mathbb{H}(u) = H(\mathbb{P}_u) and, let aδ∈(0,1)a_\delta \in (0,1) satisfy

cδ=H(δ)−(1−δ)H((1−a)δ)−δH(a+(1−a)δ).c\delta=\mathbb{H}(\delta)-(1-\delta)\mathbb{H}((1-a)\delta)-\delta\mathbb{H}(a+(1-a)\delta).

Define the randomized Gumbel-max conditional token distribution by

QδRG(w∣Z,J)=[(1−aδ)Pδ,g(w)blk+aδ1{b∗(Z,J)=g(w)}]Pδ,wPδ,g(w)blk.(4)Q_{\delta}^{\mathrm{R G}}(w\mid Z,J)=\left[(1-a_{\delta})P_{\delta,g(w)}^{\mathrm{b l k}}+a_{\delta}\mathbf{1}\{b^{*}(Z,J)=g(w)\}\right]\frac{P_{\delta,w}}{P_{\delta,g(w)}^{\mathrm{b l k}}}. \tag{4}

It is easy to verify that for all sufficiently small δ>0\delta > 0, (4) defines an unbiased watermark scheme satisfying H(Pδ)−EZ,JH{Qδk(⋅∣Z,J)}=cδH(P_\delta) - \mathbb{E}_{Z,J} H\{Q_\delta^k(\cdot \mid Z, J)\} = c\delta. Consider as H1RGH_1^{\mathrm{RG}} the hypothesis corresponding to H1textGrainH_1^{\mathrm{textGrain}} in (3). Then, taking Δn=n−2/3\Delta_n = n^{-2/3} and εn=1\varepsilon_n = 1 leads to a detectable separation between H0H_0 and H1RGH_1^{\mathrm{RG}}:

inf⁡ϕn{E0ϕn+ERG,n(1−ϕn)}→0,\inf_{\phi_{n}}\{\mathbb{E}_{0}\phi_{n}+\mathbb{E}_{\mathrm{R G},n}(1-\phi_{n})\}\rightarrow0,

In contrast, for textGrain watermarking, it is impossible to separate H0H_{0} and H1textGrainH_{1}^{textGrain} asymptotically under the same setting.

inf⁡ϕn{E0ϕn+EtextGrain,n(1−ϕn)}→1.\inf_{\phi_{n}}\{\mathbb{E}_{0}\phi_{n}+\mathbb{E}_{\mathrm{textGrain},n}(1-\phi_{n})\}\rightarrow1.

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.

References (26)