Skip to content

doccstat/llm-watermark-adaptive

Repository files navigation

A Likelihood Based Approach for Watermark Detection

Implementation of the methods described in "A Likelihood Based Approach for Watermark Detection" by Xingchi Li, Guanxun Li, Xianyang Zhang.

OpenReview

Prerequisites

Python environments
  • Cython==3.0.10
  • datasets==2.19.1
  • huggingface_hub==0.23.0
  • nltk==3.8.1
  • numpy==1.26.4
  • sacremoses==0.0.53
  • scipy==1.13.0
  • sentencepiece==0.2.0
  • tokenizers==0.19.1
  • torch==2.3.0.post100
  • torchaudio==2.3.0
  • torchvision==0.18.0
  • tqdm==4.66.4
  • transformers==4.40.2

Set up environments

# PyTorch: https://pytorch.org/get-started/locally
# Transformers: https://huggingface.co/docs/transformers/en/installation
conda install cython scipy nltk sentencepiece sacremoses

Instructions

All experiments are conducted using Slurm workload manager. Expected running time and memory usage are provided in the corresponding sbatch scripts.

Important

Please modify the paths, Slurm mail options and adjust the GPU resources in the sbatch scripts before running the experiments.

# Setup pyx.
sbatch 1-setup.sh

# Download models to local.
sbatch 2-download.sh

# Text generation.
bash 3-textgen-helper.sh
sbatch 3-textgen.sh

# Watermark detection.
bash 4-detect-helper.sh
sbatch 4-detect.sh

# Result analysis and ploting.
Rscript 5-analyze.R

Citation

@inproceedings{
  anonymous2025a,
  title={A Likelihood Based Approach for Watermark Detection},
  author={Anonymous},
  booktitle={The 28th International Conference on Artificial Intelligence and Statistics},
  year={2025},
  url={https://openreview.net/forum?id=S2QoDt4bw4}
}

Stargazers over time

Stargazers over time