How The ChatGPT Watermark Works And Why It Could Be Defeated

Posted by

OpenAI’s ChatGPT introduced a way to automatically create content but plans to introduce a watermarking feature to make it easy to detect are making some people nervous. This is how ChatGPT watermarking works and why there may be a way to defeat it.

ChatGPT is an incredible tool that online publishers, affiliates and SEOs simultaneously love and dread.

Some marketers love it because they’re discovering new ways to use it to generate content briefs, outlines and complex articles.

Online publishers are afraid of the prospect of AI content flooding the search results, supplanting expert articles written by humans.

Consequently, news of a watermarking feature that unlocks detection of ChatGPT-authored content is likewise anticipated with anxiety and hope.

Cryptographic Watermark

A watermark is a semi-transparent mark (a logo or text) that is embedded onto an image. The watermark signals who is the original author of the work.

It’s largely seen in photographs and increasingly in videos.

Watermarking text in ChatGPT involves cryptography in the form of embedding a pattern of words, letters and punctiation in the form of a secret code.

Scott Aaronson and ChatGPT Watermarking

An influential computer scientist named Scott Aaronson was hired by OpenAI in June 2022 to work on AI Safety and Alignment.

AI Safety is a research field concerned with studying ways that AI might pose a harm to humans and creating ways to prevent that kind of negative disruption.

The Distill scientific journal, featuring authors affiliated with OpenAI, defines AI Safety like this:

“The goal of long-term artificial intelligence (AI) safety is to ensure that advanced AI systems are reliably aligned with human values — that they reliably do things that people want them to do.”

AI Alignment is the artificial intelligence field concerned with making sure that the AI is aligned with the intended goals.

A large language model (LLM) like ChatGPT can be used in a way that may go contrary to the goals of AI Alignment as defined by OpenAI, which is to create AI that benefits humanity.

Accordingly, the reason for watermarking is to prevent the misuse of AI in a way that harms humanity.

Aaronson explained the reason for watermarking ChatGPT output:

“This could be helpful for preventing academic plagiarism, obviously, but also, for example, mass generation of propaganda…”

How Does ChatGPT Watermarking Work?

ChatGPT watermarking is a system that embeds a statistical pattern, a code, into the choices of words and even punctuation marks.

Content created by artificial intelligence is generated with a fairly predictable pattern of word choice.

The words written by humans and AI follow a statistical pattern.

Changing the pattern of the words used in generated content is a way to “watermark” the text to make it easy for a system to detect if it was the product of an AI text generator.

The trick that makes AI content watermarking undetectable is that the distribution of words still have a random appearance similar to normal AI generated text.

This is referred to as a pseudorandom distribution of words.

Pseudorandomness is a statistically random series of words or numbers that are not actually random.

ChatGPT watermarking is not currently in use. However Scott Aaronson at OpenAI is on record stating that it is planned.

Right now ChatGPT is in previews, which allows OpenAI to discover “misalignment” through real-world use.

Presumably watermarking may be introduced in a final version of ChatGPT or sooner than that.

Scott Aaronson wrote about how watermarking works:

“My main project so far has been a tool for statistically watermarking the outputs of a text model like GPT.

Basically, whenever GPT generates some long text, we want there to be an otherwise unnoticeable secret signal in its choices of words, which you can use to prove later that, yes, this came from GPT.”

Aaronson explained further how ChatGPT watermarking works. But first, it’s important to understand the concept of tokenization.

Tokenization is a step that happens in natural language processing where the machine takes the words in a document and breaks them down into semantic units like words and sentences.

Tokenization changes text into a structured form that can be used in machine learning.

The process of text generation is the machine guessing which token comes next based on the previous token.

This is done with a mathematical function that determines the probability of what the next token will be, what’s called a probability distribution.

What word is next is predicted but it’s random.

The watermarking itself is what Aaron describes as pseudorandom, in that there’s a mathematical reason for a particular word or punctuation mark to be there but it is still statistically random.

Here is the technical explanation of GPT watermarking:

“For GPT, every input and output is a string of tokens, which could be words but also punctuation marks, parts of words, or more—there are about 100,000 tokens in total.

At its core, GPT is constantly generating a probability distribution over the next token to generate, conditional on the string of previous tokens.

After the neural net generates the distribution, the OpenAI server then actually samples a token according to that distribution—or some modified version of the distribution, depending on a parameter called ‘temperature.’

As long as the temperature is nonzero, though, there will usually be some randomness in the choice of the next token: you could run over and over with the same prompt, and get a different completion (i.e., string of output tokens) each time.

So then to watermark, instead of selecting the next token randomly, the idea will be to select it pseudorandomly, using a cryptographic pseudorandom function, whose key is known only to OpenAI.”

The watermark looks completely natural to those reading the text because the choice of words is mimicking the randomness of all the other words.

But that randomness contains a bias that can only be detected by someone with the key to decode it.

This is the technical explanation:

“To illustrate, in the special case that GPT had a bunch of possible tokens that it judged equally probable, you could simply choose whichever token maximized g. The choice would look uniformly random to someone who didn’t know the key, but someone who did know the key could later sum g over all n-grams and see that it was anomalously large.”

Watermarking is a Privacy-first Solution

I’ve seen discussions on social media where some people suggested that OpenAI could keep a record of every output it generates and use that for detection.

Scott Aaronson confirms that OpenAI could do that but that doing so poses a privacy issue. The possible exception is for law enforcement situation, which he didn’t elaborate on.

How to Detect ChatGPT or GPT Watermarking

Something interesting that seems to not be well known yet is that Scott Aaronson noted that there is a way to defeat the watermarking.

He didn’t say it’s possible to defeat the watermarking, he said that it can be defeated.

“Now, this can all be defeated with enough effort.

For example, if you used another AI to paraphrase GPT’s output—well okay, we’re not going to be able to detect that.”

It seems like the watermarking can be defeated, at least in from November when the above statements were made.

There is no indication that the watermarking is currently in use. But when it does come into use, it may be unknown if this loophole was closed.

Citation

Read Scott Aaronson’s blog post here.

Featured image by SMM Panel/RealPeopleStudio