---
title: Red-Green Sequence (RGS) Watermark Explained | Privacy, Provenance
url: https://www.emergentmind.com/topics/red-green-sequence-rgs-watermark
type: topic
---

# Red-Green Sequence (RGS) Watermark Explained | Privacy, Provenance

The **Red–Green Sequence (RGS) watermark** is a locally differentially private watermark for large language models designed to estimate the fraction of texts in a population that were generated through a watermarking process, rather than to determine with high confidence whether one particular text was machine-generated. RGS hashes each complete generated sequence with a secret keyed pseudorandom function, assigns the sequence a red or green label, and selectively increases the probability of green sequences subject to a likelihood-ratio constraint. Each text consequently contributes approximately one binary observation—green or red—to an aggregate prevalence estimator. The construction and its privacy–utility analysis are presented in “Reconciling Privacy with Provenance for Language Model Watermarks” [2611.06100].

## 1. Objective and distinction from token-level watermarking

Conventional red–green language-model watermarks assign tokens to keyed green and red sets, bias generation toward green tokens, and detect the watermark by accumulating green-token evidence across a completion. A sufficiently long completion can therefore provide strong evidence about its provenance. The RGS watermark adopts a different objective: estimating the fraction of texts in a population that were watermarked while limiting the evidence contributed by any individual text.

RGS colors an entire generated sequence rather than independently coloring every token. For a sequence \(y\), a secret key \(k\) determines a binary label

\[
h_k(y)\in\{G,R\}.
\]

The detector computes this label for each observed text and aggregates the resulting reports. A green report may correspond either to a watermarked text selected preferentially because it was green or to an unwatermarked text that happened to receive a green hash label. A red report likewise does not rule out watermarking.

This design sacrifices reliable individual-text classification in favor of population-level estimation. The resulting privacy distinction is structural: a conventional token-level watermark exposes a high-dimensional sequence of red–green outcomes, whereas RGS intentionally encodes essentially one private binary report per completion.

## 2. Local differential privacy formulation

Let \(p\) denote the base language-model distribution over complete sequences, and let \(\Gamma(k;p)\) denote the RGS generation mechanism using key \(k\). RGS is \(\varepsilon\)-locally differentially private with respect to \(p\) when, for every key \(k\) and sequence \(y\),

\[
e^{-\varepsilon}p(y)
\leq
\Pr[\Gamma(k;p)=y\mid k]
\leq
e^\varepsilon p(y).
\]

Equivalently, the likelihood ratio between the watermarked and unwatermarked sequence distributions satisfies

\[
e^{-\varepsilon}
\leq
\frac{\Pr[\Gamma(k;p)=y\mid k]}{p(y)}
\leq
e^\varepsilon.
\]

The parameter \(\varepsilon\) controls the privacy–signal trade-off. Smaller \(\varepsilon\) limits the evidence available from an individual completion and weakens the watermark signal; larger \(\varepsilon\) permits a larger deviation from the base distribution and improves aggregate estimation while making individual completions more informative.

The privacy condition also bounds posterior key inference. If \(p(k)\) is the prior distribution over keys and \(p(k\mid y)\) is the posterior after observing \(y\), then

\[
e^{-2\varepsilon}p(k)
\leq
p(k\mid y)
\leq
e^{2\varepsilon}p(k).
\]

The factor \(2\varepsilon\) arises because both the numerator and denominator in Bayes’ rule can change by factors of \(e^{\pm\varepsilon}\).

## 3. Keyed sequence coloring

RGS uses an injective encoding of the complete token sequence followed by keyed 128-bit BLAKE2b hashing. Let

\[
b_k(y)\in\{0,\ldots,2^{128}-1\}
\]

be the integer hash value. Given a desired null green fraction \(\pi_0\), define

\[
h_k(y)=G
\quad\Longleftrightarrow\quad
b_k(y)<T,
\qquad
T=\left\lfloor \pi_0 2^{128}\right\rfloor.
\]

Sequences whose hash values do not satisfy the threshold are labeled red. Under the ideal random-function model, distinct sequences receive independent colors with green probability

\[
\widetilde{\pi}_0=\frac{T}{2^{128}},
\qquad
0\leq \pi_0-\widetilde{\pi}_0<2^{-128}.
\]

The analysis treats the rounding difference as negligible and uses \(\pi_0\) as the green probability. The key is sampled once and reused across texts. Independent key randomization for every text would prevent the detector from recovering the red–green report consistently from the observed sequence.

The ideal-coloring assumption states that for every finite collection of distinct sequences fixed independently of the key, the corresponding green indicators behave as independent \(\operatorname{Bernoulli}(\pi_0)\) variables. This is a cryptographic idealization of pseudorandomness: a keyed pseudorandom function should be computationally indistinguishable from a random function.

RGS therefore differs from context-dependent token watermarks in which a preceding token or context determines the green list for the next token. In the RGS construction, the complete sequence itself is the object being colored. The related token-level mechanism can be written as a green-token logit reweighting, but RGS applies its privacy-constrained reweighting at the sequence level.

## 4. Generation mechanisms

### Parallel candidate sampler

Given a prompt \(x\), candidate budget \(M\), secret key \(k\), and privacy parameter \(\varepsilon\), the parallel sampler operates as follows:

1. Draw \(M\) independent candidates
   \[
   \widetilde Y_1,\ldots,\widetilde Y_M
   \overset{\mathrm{iid}}{\sim} LM(\cdot\mid x).
   \]

2. Deduplicate the candidates. If the distinct candidates are \(Y_1,\ldots,Y_m\), with counts \(c_j\), define
   \[
   p_j=\frac{c_j}{M}.
   \]

3. Partition the candidates using the keyed sequence hash:
   \[
   \mathcal G=\{j:h_k(Y_j)=G\},
   \qquad
   P_G=\sum_{j\in\mathcal G}p_j.
   \]

4. Set the target green mass to
   \[
   Q_G=
   \min\left\{
   e^\varepsilon P_G,\,
   1-e^{-\varepsilon}(1-P_G)
   \right\}.
   \]

5. Reweight each candidate:
   \[
   q_j=
   \begin{cases}
   p_j Q_G/P_G,&j\in\mathcal G,\\[2pt]
   p_j(1-Q_G)/(1-P_G),&j\notin\mathcal G.
   \end{cases}
   \]

6. Sample \(Y_{j^*}\) from the categorical distribution defined by the \(q_j\).

If \(P_G\in\{0,1\}\), the candidate probabilities remain unchanged. The reweighting satisfies

\[
e^{-\varepsilon}p_j\leq q_j\leq e^\varepsilon p_j.
\]

The feasible interval for total green mass is

\[
L_\varepsilon(P_G)
=
\max\left\{
e^{-\varepsilon}P_G,\,
1-e^\varepsilon(1-P_G)
\right\},
\]

\[
U_\varepsilon(P_G)
=
\min\left\{
e^\varepsilon P_G,\,
1-e^{-\varepsilon}(1-P_G)
\right\}.
\]

RGS uses the upper endpoint \(Q_G=U_\varepsilon(P_G)\), corresponding to the largest permissible increase in green mass under the privacy constraint.

### Rejection sampler

The paper primarily uses a computationally more efficient rejection implementation. It repeatedly samples \(Y\sim p\) and accepts it with probability

\[
\Pr[\text{accept}\mid h_k(Y)=G]=1,
\]

\[
\Pr[\text{accept}\mid h_k(Y)=R]=e^{-\varepsilon}.
\]

The process stops after acceptance or after at most \(M\) attempts, returning the final candidate if the cap is reached. If

\[
g=\Pr[h_k(Y)=G\mid k],
\]

the probability of acceptance on any non-final attempt is

\[
a=g+e^{-\varepsilon}(1-g).
\]

The expected number of samples examined is at most

\[
\frac{1}
{\Pr[h_k(Y)=G\mid k]+e^{-\varepsilon}\Pr[h_k(Y)=R\mid k]}.
\]

With an unlimited candidate budget, the rejection sampler has green probability

\[
\pi_1
=
\frac{e^\varepsilon\pi_0}
{e^\varepsilon\pi_0+1-\pi_0}.
\]

For the parallel sampler, the limiting green probability is

\[
\pi_1
=
\min\left\{
e^\varepsilon\pi_0,\,
1-e^{-\varepsilon}(1-\pi_0)
\right\}.
\]

The parallel sampler can reach a larger green probability, whereas rejection sampling has lower computational cost.

## 5. Aggregate prevalence estimation

Suppose \(Y_1,\ldots,Y_n\) are observed texts, and let

\[
W_i\in\{0,1\}
\]

indicate whether text \(i\) was generated through RGS. The population prevalence is

\[
\lambda=\frac{1}{n}\sum_{i=1}^{n}W_i.
\]

The detector computes

\[
H_i=\mathbf 1\{h_k(Y_i)=G\},
\qquad
\bar H=\frac{1}{n}\sum_{i=1}^{n}H_i.
\]

For unwatermarked texts, the expected green probability is approximately \(\pi_0\); for watermarked texts, it is approximately \(\pi_1\). In the ideal high-entropy regime,

\[
\mathbb E[\bar H]
\approx
\lambda\pi_1+(1-\lambda)\pi_0.
\]

The corresponding unclipped estimator is

\[
\widetilde\lambda
=
\frac{\bar H-\pi_0}{\pi_1-\pi_0}.
\]

The implemented estimator projects the result onto the valid prevalence interval:

\[
\widehat\lambda
=
\operatorname{proj}_{[0,1]}
\left(
\frac{\bar H-\pi_0}{\pi_1-\pi_0}
\right).
\]

This is analogous to generalized randomized response, except that RGS modifies only the watermarked group. Unwatermarked texts are generated by processes outside the watermark provider’s control and are not transformed into randomized reports.

The estimator’s error separates into sampling variance and distribution-dependent bias. With

\[
d=\pi_1-\pi_0,
\]

the conditional mean-squared-error bound is

\[
\mathbb E[(\widehat\lambda-\lambda)^2\mid k]
\leq
\frac{1}{d^2}
\left[
\frac{1}{4n}
+
\bigl(\lambda B(k)+(1-\lambda)U(k)\bigr)^2
\right].
\]

The first term decreases as \(O(1/n)\). The second term represents key- and distribution-dependent bias, which may persist even as the number of texts increases.

## 6. Entropy, diversity, and parameter trade-offs

For a text distribution \(p_i\), define its collision probability by

\[
\|p_i\|_2^2=\sum_y p_i(y)^2.
\]

Under ideal coloring, the key-dependent variance of the unwatermarked green probability is

\[
\operatorname{Var}_k[g_i(k)]
=
\pi_0(1-\pi_0)\|p_i\|_2^2.
\]

High-entropy distributions have smaller collision probabilities, making their green probabilities closer to \(\pi_0\). Low-entropy distributions may cause a particular prompt’s likely completions to receive nearly deterministic colors. Prompt diversity can nevertheless make population averages well behaved, because distinct prompts produce less-overlapping sequence distributions.

For the watermarked group, the green-probability transformation is concave. Consequently,

\[
\mathbb E_k[q_i(k)]
\leq
\mathbb E_k[f(g_i(k))]
\leq
f(\mathbb E_k[g_i(k)])
=
f(\pi_0)
=
\pi_1,
\]

and therefore the key-averaged watermarked bias is nonpositive. In high-entropy and high-diversity regimes, the average distributions become sufficiently diffuse that the estimator is approximately unbiased.

The nominal separation

\[
d=\pi_1-\pi_0
\]

controls statistical efficiency. A larger separation reduces sampling variance but increases individual informativeness and can amplify finite-entropy bias. For ideal binary randomized response, the privacy-optimal probabilities are

\[
\pi_0^*=\frac{1}{1+e^\varepsilon},
\qquad
\pi_1^*=\frac{e^\varepsilon}{1+e^\varepsilon}.
\]

For the parallel sampler, separation is maximized at

\[
\pi_0=\frac{1}{1+e^\varepsilon}.
\]

For rejection sampling, separation is maximized at

\[
\pi_0=\frac{1}{1+e^{\varepsilon/2}}.
\]

At large sample sizes, a larger \(\pi_0\) can nevertheless be preferable because it reduces persistent bias at the cost of increased sampling variance.

## 7. Empirical results, limitations, and scope

The experiments use Qwen3-1.7B, Qwen3-4B, Qwen3-8B, and Llama-3.1-8B-Instruct. Unless otherwise stated, they use rejection sampling, candidate cap \(M=20\), \(\pi_0=0.5\), keyed 128-bit BLAKE2b, 20 random keys, and 50 Monte Carlo mixture repetitions per key.

On the C4 language-modeling task, the study uses 500 prompts, temperature \(1\), top-\(p=1\), 2,000-text mixtures, and privacy budgets \(\varepsilon\in\{1,2,3\}\). At \(\varepsilon=1\), the reported mean absolute bias is \(0.0038\), with MSE \(0.0019\). The corresponding average half-width of the fifth-to-95th-percentile bands is approximately \(0.072\). Increasing \(\varepsilon\), increasing the number of texts, increasing temperature, increasing prefix length, and increasing the candidate budget up to approximately \(M=20\) generally reduce estimation error.

In the essay-writing experiment, which uses 100 texts at \(\varepsilon=2\), the reported MSE is approximately \(0.0113\), with mean absolute bias around \(0.004\). The coding task exhibits more bias and variance because of lower entropy and greater prompt homogeneity, although it still produces useful aggregate estimates with 100 total samples.

RGS has several explicit limitations. It is intentionally weak for individual-text detection, is sensitive to paraphrasing and minor edits because the complete sequence is hashed, and depends on pseudorandom coloring assumptions. Low-entropy or highly homogeneous prompts can create persistent key-dependent bias that does not vanish merely by increasing the number of texts. Reusing a key is necessary for detection but can induce cross-text dependence when identical or overlapping sequences recur. The stated local-DP guarantee also does not provide protection against unlimited repeated inference by the same user.

RGS is therefore not a replacement for high-confidence provenance classification of individual documents. Its intended operating point is aggregate measurement: a weak per-text signal, bounded by a local privacy parameter, combined across a population to estimate watermark prevalence.

Source: https://www.emergentmind.com/topics/red-green-sequence-rgs-watermark