In the rapidly evolving landscape of Large Language Models (LLMs), a new challenge has emerged alongside the impressive capabilities of tools like GPT-4 and Llama: provenance. How do we know if a text was written by a human or generated by a machine? This isn’t just a matter of academic curiosity; it has profound implications for plagiarism, misinformation, and copyright.
The leading solution to this problem is watermarking. Unlike a visible logo on an image, a text watermark is an invisible statistical pattern embedded in the word choices of an LLM. While existing methods have made great strides, they suffer from two major flaws: they are often brittle (easy to remove by simply rewriting the text) and they can degrade the quality of the writing, making the AI sound unnatural.
Today, we are diving deep into a fascinating research paper titled “Context-aware Watermark with Semantic Balanced Green-red Lists for Large Language Models.” The researchers propose a novel method that understands the meaning (semantics) of the text to create watermarks that are both harder to break and easier on the reader’s eyes.
The Core Problem: The Green-Red Dilemma
To understand the innovation, we first need to understand how current watermarking works. Most state-of-the-art methods rely on a “Green-Red List” mechanism.
Imagine an LLM is about to generate the next word in a sentence: “The cat sat on the…” Before the model chooses “mat,” the watermarking algorithm intervenes:
- It looks at the previous token (e.g., “the”).
- It uses a hash of that previous token to seed a random number generator.
- It splits the entire vocabulary into two lists: a Green List and a Red List.
- It forces (or strongly encourages) the model to pick a word from the Green List.
If the detector sees a text where a statistically improbable number of words come from these “Green Lists,” it knows the text is AI-generated.
The Vulnerabilities
While clever, this standard approach has cracks:
- Paraphrasing Attacks: If a user takes the AI text and asks another AI to “rewrite this,” the specific word sequence changes. Since the Green/Red split depends on the exact previous token, changing “The cat sat” to “The feline rested” completely changes the random seed. The detector loses the signal.
- Quality Degradation: Randomly splitting the vocabulary is risky. What if the context requires the word “happy,” but “happy,” “glad,” and “joyful” all ended up in the Red List by bad luck? The model is forced to choose a suboptimal Green word, making the text look weird.
The researchers behind this paper argue that the solution lies in semantics. Instead of treating words as random tokens, the watermark should respect the meaning of the context.
The Solution: A Semantic-Aware Framework
The proposed method introduces a sophisticated pipeline that balances text quality with robustness. The architecture is built on three main pillars:
- Context-aware Semantic-based Watermark Key Generator (using LSH).
- Semantic-based Green-Red Lists Split.
- Entropy-based Dynamic Bias Adaptation.
Let’s look at the high-level architecture before breaking down the math.

As shown in Figure 1 above, the process runs parallel to the standard generation. While the LLM thinks about the next word (“mats”), the watermarking system calculates a semantic key based on the context (“on”), splits the vocabulary intelligently, and adjusts the probability bias based on how confident the model is.
1. The Anchor: Context-Aware Key Generation via LSH
The first innovation addresses the Paraphrasing Attack. In standard methods, the “key” (random seed) comes from the raw text of the previous token. If you change the word, you lose the key.
This method instead derives the key from the semantic embedding of the context. It uses a technique called Locality Sensitive Hashing (LSH).
What is LSH? Standard hashing (like SHA-256) is designed to avoid collisions; changing one letter changes the whole hash. LSH is the opposite: it is designed so that similar inputs produce the same hash.
The researchers project the context embedding onto random hyperplanes in a vector space. If two contexts (like “The cat sat on…” and “The feline rested on…”) have similar meanings, their embeddings will fall on the same side of these hyperplanes, resulting in the same binary hash key.
The mathematical formulation for the hash value of a vector \(v\) on the \(i\)-th hyperplane is:

Here, \(r^i\) is a random normal vector defining the hyperplane. If the dot product is positive, the bit is 1; otherwise, it’s 0. By combining multiple hyperplanes, they generate a robust key.
Why this matters: Even if a user paraphrases the text, as long as the meaning remains preserved, the watermark detector will likely derive the same key and successfully identify the Green List.
2. The Split: Semantic-Based Green-Red Lists
Standard methods split the vocabulary randomly. This paper proposes splitting based on semantic clusters.
The process works like this:
- Group: The algorithm uses LSH to group the entire vocabulary into “semantic sets.” Words with similar meanings (e.g., “happy”, “elated”, “joyous”) end up in the same set.
- Split: Inside each small semantic set, the algorithm performs the Green/Red split.
- Merge: All the mini-Green lists are combined into the master Green List.
The Benefit: This ensures Semantic Coverage. If the model wants to express a specific concept (like “happiness”), standard random splitting might accidentally ban all words related to happiness. By splitting within clusters, this method guarantees that at least some words related to “happiness” are always available in the Green List. This drastically reduces the performance drop usually associated with watermarking.
3. The Adjustment: Entropy-based Dynamic Bias
Not all predictions are created equal. Sometimes an LLM is 99% sure the next word is “Paris” (e.g., after “The capital of France is”). Other times, the next word could be anything.
- Low Entropy (High Certainty): If the model is sure, forcing a different word just to satisfy a Green List destroys text quality.
- High Entropy (High Uncertainty): If the model has many valid options, we can aggressively bias it toward Green words without hurting quality.
The researchers introduce a dynamic bias \(\delta'\) that scales based on the entropy of the probability distribution:
![]\n\\delta ^ { \\prime } ( s ) = \\delta \\cdot { \\frac { 1 } { e n t r o p y ( s ) + \\phi } }\n[](/en/paper/file-2892/images/003.jpg#center)
As shown in the equation, there is an inverse relationship. When entropy is high (uncertainty), the denominator grows, potentially lowering bias to prevent quality degradation in highly creative segments? Actually, looking closer at the logic in the paper:
Standard logic usually suggests:
- High Entropy: Many good choices. It’s safe to push for Green tokens.
- Low Entropy: Only one good choice. Pushing for Green tokens (if the best word is Red) breaks the sentence.
The paper notes that a fixed bias is the problem. They use the reciprocal of entropy.
- If entropy is low (model is sure), the term \(\frac{1}{entropy}\) becomes large. This increases the bias strength \(\delta'\) to ensure the Green token is picked (since the model effectively must pick the Green token to maintain the watermark, even if it’s hard). Wait, this seems counter-intuitive for quality, but essential for robustness.
- If entropy is high, the term becomes small, applying a gentler bias.
Note: The paper creates a balance factor \(\phi\) to control this scaling. This mechanism helps balance the trade-off between keeping the watermark detectable (robustness) and keeping the text readable.
Watermark Detection
Detecting the watermark follows a standard statistical approach (Z-score), but uses the semantic keys to reconstruct the lists. The detector counts how many tokens in the suspicious text fall into the calculated Green Lists.
![]\nz = { \\frac { T - \\gamma N } { \\gamma ( 1 - \\gamma ) N } }\n()](/en/paper/file-2892/images/004.jpg#center)
Here, \(T\) is the count of Green tokens found, \(N\) is the total tokens, and \(\gamma\) is the expected ratio (usually 0.5). A high Z-score allows us to reject the null hypothesis and conclude the text is AI-generated.
Experimental Results
The researchers tested their method against several baselines (including KGW, Unigram, and EWD) using the C4 RealNews dataset. They evaluated on two main fronts: Robustness (can it survive attacks?) and Quality (does the text still look good?).
Robustness Against Paraphrasing
The results are striking. The table below compares the methods under “No Attack,” “Pegasus Attack” (a summarization model), and “Dipper Attack” (a heavy paraphraser).

Look at the Dipper Attack columns (the hardest attack).
- Standard methods like KGW drop to a TPR (True Positive Rate) of 0.5380.
- EWD drops to 0.5060.
- The proposed method (Ours) maintains a TPR of 0.7880.
This confirms that using semantic keys (LSH) significantly helps the detector recognize the watermark even after the words have been shuffled by a paraphraser.
Text Quality (Perplexity)
Did this robustness come at the cost of readability? To measure this, the researchers used Perplexity (PPL)—a measure of how “surprised” a model is by the text. Lower perplexity is better (more natural).

Figure 2 shows the distribution of perplexity scores. The dashed line represents the unwatermarked baseline.
- KGW-Large and EXP-Edit show “fatter” distributions higher up on the Y-axis, indicating worse text quality.
- Ours (the far right violin) has a distribution shape and position very similar to the unwatermarked text.
This validates the hypothesis: by ensuring Semantic Balanced Lists, the algorithm always finds a “Green” word that fits the context, preventing the awkward phrasing common in other watermarks.
Verifying Semantic Coverage
To double-check why the quality is better, the researchers analyzed the semantic similarity of the chosen Green tokens.

Table 4 shows that for any given word, the Semantic-based Green List (Ours) contains synonyms with higher similarity scores than a standard randomized list (KGW). This mathematically proves that the method provides better vocabulary options during generation.
Furthermore, Table 5 shows the standard deviation of the distribution of green tokens.

A lower standard deviation means a more uniform distribution. This implies that the semantic-based lists cover the “meaning space” more evenly, avoiding “holes” where no good words are available.
Efficiency
One might worry that calculating LSH and semantic clusters is slow. However, the researchers compared generation and detection times.

As seen in Table 8, the proposed method (“Ours”) has a generation time (4.37s) and detection time (0.04s) comparable to the fastest baselines. It is significantly faster than methods like EXP-Edit during detection. The overhead of hashing semantic vectors is negligible compared to the inference time of the LLM itself.
Conclusion and Implications
The paper “Context-aware Watermark with Semantic Balanced Green-red Lists” represents a significant step forward in responsible AI. By moving away from random token manipulation and moving toward semantic understanding, the researchers achieved a difficult dual victory:
- High Robustness: The watermark survives when users try to hide it by rewriting text.
- High Quality: The watermark remains invisible to the reader, maintaining the natural flow of language.
This approach suggests that the future of AI safety lies in understanding the content of what is being generated, not just the raw statistics. As LLMs become more integrated into society, robust and high-quality watermarking will be the key to maintaining trust in digital media.
For students and researchers in NLP, this paper is a perfect example of how combining classical algorithms (like LSH) with modern generative models can solve structural weaknesses in AI systems. The shift from “token-level” to “semantic-level” operations is a trend we are likely to see across many areas of LLM development.
](https://deep-paper.org/en/paper/file-2892/images/cover.png)