Introduction
The proliferation of Large Language Models (LLMs) has necessitated robust methods for identifying machine-generated content to mitigate risks such as academic dishonesty and misinformation. Traditional watermarking techniques typically rely on hashing sequences of tokens to partition the vocabulary into "green" and "red" lists. While effective for verbatim text, these methods are highly susceptible to paraphrasing attacks. Even minor alterations in wording or sentence structure change the token hashes, thereby "washing away" the watermark. To address this, researchers have developed SemaMark, a framework that anchors watermarks in semantic embeddings rather than fragile token identities.
Methodology: The SemaMark Framework
SemaMark shifts the watermarking "seed" from the discrete token space to a continuous semantic space. This ensures that as long as the core meaning of the text is preserved during paraphrasing, the watermark remains detectable.
1. Semantic Context Aggregation
Instead of using a single preceding token, SemaMark employs weighted mean pooling over the embeddings of the previous $m$ tokens. A linear weight function prioritizes tokens closer to the current generation point, creating a robust representation of the local semantic context.
2. Discretization via the NE-Ring
To generate a discrete seed for vocabulary partitioning, the high-dimensional pooled embedding is projected onto a 2D unit circle, termed the Normalized Embedding Ring (NE-Ring), using a Multi-Layer Perceptron (MLP). The ring is divided into $K$ equal sections, each corresponding to a "semantic value."
3. Contrastive Learning for Security
To prevent attackers from reverse-engineering the watermark through frequency analysis, the MLP is trained using Contrastive Learning (CL). This objective forces the semantic embeddings of diverse sentences to be uniformly distributed across the NE-Ring, ensuring that the resulting green lists appear stochastic and unpredictable to unauthorized parties.
4. Robust Detection with Q-offset
Paraphrasing can cause slight shifts in semantic embeddings, potentially pushing a value across the boundary of two sections on the NE-Ring. To counter this, SemaMark introduces Q-offset detection. This "fuzzy" matching strategy checks the current token against the green lists of neighboring sections on the ring, significantly increasing tolerance for minor semantic drift.
Experimental Evaluation
The framework was evaluated using the C4 (Colossal Clean Crawled Corpus) dataset across several backbone models, including OPT (2.7B, 6.7B) and LLaMA (7B, LLaMA2-7B).
Key Results
- Robustness to Paraphrasing: SemaMark demonstrates superior resilience compared to baselines like LeftHash and EXP-Edit. In "Round-trip Translation" tests, it maintained a ROC-AUC of 0.9692. Against sophisticated paraphrasing by GPT-3.5, it achieved an AUC of 0.9406.
- Text Quality Preservation: Perplexity (PPL) analysis indicates that SemaMark has a negligible impact on generation quality. It maintains a PPL (~6.0) comparable to unwatermarked text, whereas other robust methods often significantly degrade fluency (e.g., EXP-Edit PPL > 15).
Discussion and Limitations
While SemaMark provides a significant leap in robustness, it currently operates as a white-box solution, requiring access to the model's internal embedding space and logit modification during inference. Additionally, the NE-Ring MLP must be calibrated for each specific model's embedding space. Future research aims to develop "universal" semantic watermarkers that can operate across different architectures and potentially in black-box scenarios.
Summary updated