News for hackers. Stuff that matters.
Re:Stable Diffusion found to emit some images from training ... by londons_explore on Wednesday February 01, 2023 @08:56AM (#34610427)
Removing duplicates and very near duplicates ought to be one of the first things done to any training dataset...

I wonder why this wasn't done? Too computation heavy?

Re:Stable Diffusion found to emit some images from training ... by Xelynega on Wednesday February 01, 2023 @09:37AM (#34611009)
If by "computationally heavy" you're talking about the financial overhead of hiring another layer of human filters to filter duplicates out of the dataset.
Re:Stable Diffusion found to emit some images from training ... by ben_w on Wednesday February 01, 2023 @09:56AM (#34611291)
That's an unreasonable presumption.

Deduplication, to the best of my knowledge, requires every image be compared to every other image. This is necessarily O(n^2) on n images.

IIRC the training set is 2.3 billion images, if so that's 0.5 * 5.29e18 comparisons[0], which, if done by humans, would require employing literally all humans for approximately a year even if we compared 12 images per second 24/7.

This has to be done computationally, not by humans.

[0] half because (a = b) <=> (b = a)

Re:Stable Diffusion found to emit some images from training ... by yojo on Wednesday February 01, 2023 @10:06AM (#34611454)
Not an expert, but I think you can just hash using an image hashing algorithm and bucket by hash. Should be linear in time/space.

You can then either have a human check collisions, or just accept a false positive rate and move on.

This is a decent write up of someone doing this on a (smaller) dataset.

https://towardsdatascience.com/detection-of-duplicate-images...

Re:Stable Diffusion found to emit some images from training ... by bombolo on Wednesday February 01, 2023 @11:02AM (#34612369)
This doesn't really work if the image is a meme that has been scaled and converted millions of times.
Re:Stable Diffusion found to emit some images from training ... by yojo on Wednesday February 01, 2023 @11:28AM (#34612877)
Perceptual hashes are reasonably robust to small perturbations. Scaling and converting shouldn’t be a problem, though applying filters that change the colors or blur the lines might.

If it’s been changed enough that it hashes to a different value, then it might be reasonable to treat it as a different image. At some point a human is also going to say “that’s not the same.” You can always change your hashing algorithm if you find it’s missing too many dupes.

Regardless, for the domain we’re talking about (deduping training data), a few false negatives should be acceptable.

Re:Stable Diffusion found to emit some images from training ... by bombolo on Wednesday February 01, 2023 @06:23PM (#34619632)
If it's more than a few you end up with overfitting though.
Re:Stable Diffusion found to emit some images from training ... by HelloNurse on Wednesday February 01, 2023 @11:23AM (#34612781)
Why not? Many meme variants end up in the same bucket, all colliding. They are as duplicates as random rare images.

A large bucket can also be inspected by humans or cut up by applying more perceptual hash function and decreasing tolerance, but it would be counterproductive cheating in this case.

Re:Stable Diffusion found to emit some images from training ... by babel_ on Wednesday February 01, 2023 @10:13AM (#34611553)
You can lower the bounds significantly. Images do not require comparison to all others, and the presented approach to detecting and deduplicating images in the paper is easily adapted to be near linear (trading for storage or cleverness).

Put simply, do you expect google image search to compare your image to every other possible image? No, they're going to embed it to a vector (512d in the paper) and only compare to probable matches; in the paper they start by brute forcing pairwise comparison of the vectors for the dataset, and then use clique finding to go faster when checking their generated images.

Re:Stable Diffusion found to emit some images from training ... by raincole on Wednesday February 01, 2023 @09:59AM (#34611336)
You can roughly classify the images first (we already have very good AI model for this) and use humans as an additional layer. If two images don't get the same top-3 labels from the classifier, the chance that they're duplicates is neglectable.
Re:Stable Diffusion found to emit some images from training ... by londons_explore on Wednesday February 01, 2023 @10:16AM (#34611605)
At the sort of scales of these datasets, there is no way to filter by hand.

But there are lots of ways to identify near identical images algorithmically. Typically the process is to download each image, run it through a neural net to make an image embedding vector (a list of a few hundred floats). Save all those in a database. Then, for each image, if it is too close in 'embed space' to another in the database, then it is a duplicate, and should be removed.

This algorithm might catch 'duplicates' that it shouldn't, like multiple people taking photos of the eiffel tower from the same public viewpoint.

It might miss real duplicates such as an image failing to match with a collage containing the same image.

But it's still better than not removing duplicates at all...

Re:Stable Diffusion found to emit some images from training ... by babel_ on Wednesday February 01, 2023 @09:50AM (#34611188)
The paper itself actually goes to show that this is insufficient (but should still be done, they went from regenerating 1 in 819 to 1 in 1063 images in a small corpus litmus test), and that diffusion is weaker to image extraction attacks than GANs (and seems to be weaker the better it gets).

As to why? Lack of care and vigilance, most likely. If they're willing to spend millions of GPU hours training some of these big models, then this wouldn't be a huge cost, and has near linear complexity over the dataset that parallelises trivially. Sadly, vigilance is a finite resource, and that kind of data cleaning is often dismissed in favour of doubling down on the training and assumming it'll be big enough to handle it (however, as has been shown, that's not the case).

(Edit: thanks FeepingCreature. The deduplication test used for the numbers above was a separate test in the paper for just this, not indicative of their extraction attack in general, with a small corpus and compared a diffusion model trained on both. So I liken it to a litmus test for the efficacy of deduplication.)

Re:Stable Diffusion found to emit some images from training ... by FeepingCreature on Wednesday February 01, 2023 @10:12AM (#34611545)
Note: they went from regenerating 1 in 819 to 1 in 1063 on a relatively small corpus.
Re:Stable Diffusion found to emit some images from training ... by f38zf5vdt on Wednesday February 01, 2023 @10:20AM (#34611659)
SD2's dataset was deduplicated prior to training. That's why the paper is about SD1, which was a prototype model completed before Stability even had VC raises.
Re:Stable Diffusion found to emit some images from training ... by KRAKRISMOTT on Wednesday February 01, 2023 @10:40AM (#34612032)
Could be an overly enthusiastic data augmentation bug
Re:Stable Diffusion found to emit some images from training ... by 6gvONxR4sf7o on Wednesday February 01, 2023 @11:16AM (#34612653)
The open source community work in ML tends to be terrible at the science and rigor parts of it. You see tons of lazy “we recreated an open version of X” that fails to be remotely as well done as the peer reviewed version, even from the larger community groups.