Recent advancements in watermarking techniques have enabled the embedding of
secret messages into AI-generated text (AIGT), serving as an important
mechanism for AIGT detection. Existing methods typically interfere with the
generation processes of large language models (LLMs) to embed signals within
the generated text. However, these methods often rely on heuristic rules, which
can result in suboptimal token selection and a subsequent decline in the
quality of the generated content. In this paper, we introduce a plug-and-play
contextual generation states-aware watermarking framework (CAW) that
dynamically adjusts the embedding process. It can be seamlessly integrated with
various existing watermarking methods to enhance generation quality. First, CAW
incorporates a watermarking capacity evaluator, which can assess the impact of
embedding messages at different token positions by analyzing the contextual
generation states. Furthermore, we introduce a multi-branch pre-generation
mechanism to avoid the latency caused by the proposed watermarking strategy.
Building on this, CAW can dynamically adjust the watermarking process based on
the evaluated watermark capacity of each token, thereby minimizing potential
degradation in content quality. Extensive experiments conducted on datasets
across multiple domains have verified the effectiveness of our method,
demonstrating superior performance compared to various baselines in terms of
both detection rate and generation quality.