r/MachineLearning 10d ago

Project Implementing Watermarking for Language Models [P]

I recently implemented a minimal, educational version of SynthID-Text-style watermarking for language models.

I saw anthropic post about how they'll start adding watermarks to their model responses and it made me very curious as to how they'll do it and what do they even mean by watermark here. Like will we start getting random ads or something in the middle of model responses or what.

Then decided to read their article and found out that watermark is not a visible message at all. It is a subtle statistical pattern introduced while the model chooses its tokens.

My implementation is not an exact reproduction of the original SynthID-Text system. I simplified or implemented a few components differently to keep the project understandable, but the main idea is there I think.

Github: https://github.com/Saad1926Q/llm-watermark

If you find it interesting then you may star the repo !!

21 Upvotes

23 comments sorted by

View all comments

9

u/Lopsided-Bridge-9810 10d ago edited 9d ago

Reliable watermarking for linguistically based inferencing is not possible, imo. You can feed the output to multiple other llms that don't watermark and ask to have text rewritten a certain way, you can translate the text to other languages and translate back and the entire statistic signature gets lost. Linguistic styled can be targeted and attacked. There is no watermarking happening in text based llms anytime soon. I mean labs can watermark but it's a nonsense approach.

3

u/surffrus 9d ago

Your argument is that it won't work because it can be "removed" by taking extra steps. Ok, sure.

You and others are missing the point that this is about capturing the 99% of users who just use the model and move on with their lives because they don't want to be bothered or are simply naive. Watermarking will be useful for many things, including online filters.

1

u/robobub 9d ago

Agreed. It's the same with image watermarks, even the less visible ones like Gemini image SynthID

1

u/Lopsided-Bridge-9810 9d ago

What benefit will you obtain from an image watermark? Image generators already can inject all sorts of Metadata to an image file.

2

u/robobub 9d ago

Because image metadata is easily removed by just modifying the tag section. Many sites will also strip various or even all metadata for privacy reasons.

Visible watermarks are similar, though easier to notice and thus easier to remove.

Invisible image watermarks are harder in both ways. Even saving different formats, increasing compression, and cropping to an extent can still retain the watermark.

It's about extra steps and each one gets a big chunk of users but will never get all of them.

1

u/Lopsided-Bridge-9810 9d ago

I don't see the point, its seems like you contradict yourself (or the argument by someone else you supported):

You want watermarks/meta data, great, you got those today, use the apps that don't strip them. You are a bad actor who wants to mislead with images that are not what a watermark or no watermark suggests? Sure, no problem, a watermark is not gonna be the least of your problems. They can be removed from images very easily. So, what again is the benefit of a watermark?

See the difficulty and goal of authenticity checks and guarantees is not to cover the vast amount of usecases, it must be solid to prevent nefarious characters from mischaracterizing content. Its not the average user that you need to be concerned with, its the bad actors. And watermarking provides absolutely zero benefit in that regard.

2

u/robobub 9d ago edited 9d ago

I don't see the point, its seems like you contradict yourself

Well yes, as you said, you don't understand the purpose of these watermarks. As I explicitly said, the goal is not to get everyone or the bad actors. It's to stop 80% (simple watermarks/metadata) or 95% (invisible watermarks). It works as intended, to catch those cases. I hope you can understand why catching those are useful, but if not, I can go into more detail.

The goal of these is not to catch insistent targeted bad actors. For that, there is a solution, but it's going to take more effort and support. It's cryptography to verify human produced artifacts. It's not unlike signing binaries, transactions, or messages to verify authenticity. Some cameras have that, so we can verify real non-AI pictures. It can be added to various other types of media as well. But this can only protect against pretending to be others with higher dimensional data.

For low dimensional data like text, no, I don't think there will be a way to prove the inverse, that AI wasn't used to help create it. You'll have to do other checks depending on the purpose. E.g for school, evaluating comprehension and process.

1

u/Lopsided-Bridge-9810 9d ago

"catch" what "cases", what are you even aiming to achieve? And no, there is no solution to prevent bad actors from misleading with doctored images or text generated my language models,as you incorrectly claimed. And you clearly don't understand a thing about computer science. A digitally signed pdf document, for example, or a hash for a file is 100% solid and reliable in all circumstances and edge cases. Change one byte and the authenticity is guaranteed to not be guaranteed anymore. Signatures by cameras today are all referee engineered and available to inject into images even when the image was not originating from a specific camera. And that is not even the problem that researchers try to solve: it's not important to guarantee that an image originated from a specific camera, it's to guarantee that an image originated from any camera.

The question remains, what are you hoping to "catch" and which "cases" are you even targeting with a watermark?

1

u/robobub 9d ago edited 9d ago

"catch" what "cases", what are you even aiming to achieve?

So you are asking what is the point of capturing 95% of these cases? I'll humor you if you really don't understand:

  • easily identifying lots of ai generated content from various places like social media that the general public is falling for
    • this can either be automatically removed
    • triaged differently in moderation
    • even just deprioritized in the feed
    • notify the poster: many posters have no idea they are forwarding AI generated stuff
  • measuring AI slop prevalance for various other metric purposes
  • creates friction for the lower effort bad actors

and no, they won't just outright be banned and notified that they need to evade detection better. They will just suppress their slop in the feed, yielding some amount of loss of interactions from real users. Between that and the not as easy to evade more subtle watermarks means a significant reduction in harm.

And no, there is no solution to prevent bad actors from misleading with doctored images or text generated my language models,as you incorrectly claimed. And you clearly don't understand a thing about computer science. A digitally signed pdf document, for example, or a hash for a file is 100% solid and reliable in all circumstances and edge cases. Change one byte and the authenticity is guaranteed to not be guaranteed anymore.

I'll clarify this for you. What I was referring to is people pretending to be the white house or other public figure, posting some statement, image, or video. Those can easily be signed and if modified, well, it can be identified it's not a true press release.

Signatures by cameras today are all referee engineered and available to inject into images even when the image was not originating from a specific camera.

Source on something like C2PA being defeated in practice? To clarify, I brought this up as a separate thing from watermarks.

Also some cameras will embed 3D depth information from phase detection points all over the sensors, so this will even defeat taking a photo of a fake printed out scene.

And you clearly don't understand a thing about computer science.

Lol. It's pretty clear that you aren't really understanding my responses before firing off your own. If you want me to respond again, demonstrate some real effort.

1

u/Lopsided-Bridge-9810 9d ago

Are you seriously thinking that those who aim for clicks will not push their images through apps that make images pass through all sorts of filters, even if such filters existed? We are talking hard cold cash for them that's what they do to earn money. Also, signatures can be very easily reverse-engineered. You have no idea how easy that is.

You are incredibly naive. I am done with this exchange, clearly you have very little understanding how this all works.