# The artifacts a diffusion model leaves in an image

Source: https://passreal.com/guides/diffusion-artifacts

Latent diffusion does not paint pixels. It denoises a compressed latent, then a decoder expands that latent into an image. Most of what identifies the output comes from the decoder rather than the denoising: texture reconstructed from a compressed representation loses fine irregularity, gradients come out smoother than optics produce, and the noise floor is absent where a sensor would leave one.

## Where the image is actually made

The name suggests the image is built by the denoising process. In latent
diffusion, it mostly is not.

Denoising happens in a compressed latent space, several times smaller in each
dimension than the output. What comes out of that process is a latent, not a
picture. A separate decoder - the VAE's second half - expands it into pixels.

Everything visible therefore passes through the decoder last, and the decoder
was trained to reconstruct plausible images from compressed representations.
Its characteristic behaviour is imprinted on every output regardless of prompt,
sampler or step count.

## What compression to a latent costs

Fine texture is the first casualty. A latent has a fixed budget per spatial
position, and reconstructing skin pores, individual fibres or the surface of
weathered stone from that budget is not possible, so the decoder produces
something plausible at medium scale and simplified at the finest.

Gradients come out smoother than optics deliver. A real out-of-focus background
carries sensor noise and lens aberration through the blur; a decoded one is
often clean in a way nothing photographic is.

Edges get a characteristic treatment. The decoder has learned what a sharp
boundary should look like and reproduces it consistently, which means edges
across an image resemble each other more than edges in a photograph do, where
each depends on distance, focus and motion.

## The trace that survives everything

Beneath all of that sits the grid periodicity from the decoder's upsampling
stages, which shows up as regularly spaced peaks in a two-dimensional Fourier
transform.

This one is durable. It survives moderate compression, mild resizing and colour
grading. It is also the reason the pipeline includes a frequency stage at all:
a low-pass filter at 0.88 of Nyquist attenuates the band those peaks
occupy.

## Looking for them on your own images

The artifacts are easiest to learn on your own files, where you know what the
source was.

- Open a generated image at 200 % zoom on a region of fine texture - hair,
  fabric, foliage, weathered surfaces - and compare it with a photograph of
  similar material at the same magnification.
- Find a large out-of-focus area and look for noise. A photographic background
  carries a noise floor through the blur; a decoded one is often clean.
- Check the corners against the centre for sharpness. Optics resolve less at
  the edges, and a decoder has no reason to.
- Look at where two channels meet on a high-contrast edge near a corner. Real
  lenses separate them slightly; decoders do not.

None of this is a detector, and none of it settles a question on its own. It
does build the intuition for what the measurable differences are, which makes
claims about tools much easier to evaluate - including the claims on this site.

## The negative result worth publishing

An obvious idea is to run a generated image back through a diffusion model at
low strength, letting the model re-synthesise local texture and, in the process,
overwrite whatever the first decoder left behind.

Measured on this pipeline, it went the wrong way on both axes at once. The
re-synthesised images were easier for detectors to classify, not harder, and
they were less faithful to the source. The stage remains in the codebase and is
disabled by default, with the strength setting kept only so the result can be
reproduced by anyone who doubts it.

Publishing that is more useful than quietly removing the code. It saves the next
person the same experiment.

## What is applied instead

Sensor grain at intensity 0.018 restores the noise floor the decoder never
produced. Lateral chromatic aberration reaching 1.25 px at the corners
and none at the centre breaks the perfect inter-channel registration a decoder
delivers. The frequency filter attenuates the periodic residue. The encode
writes camera EXIF with the matching quantization table.

None of that reconstructs the fine texture the latent discarded. That
information is gone before the pixels exist, and nothing downstream puts it
back.

## Questions

### Which stage leaves the most identifiable trace?

The decoder. Denoising happens in a compressed latent space at low resolution, and the decoder is what produces every pixel you see. Two images from different samplers and different step counts, decoded by the same VAE, share more than they differ.

### What does the flattened texture look like in practice?

Skin without pores, fabric where the weave becomes a pattern rather than individual threads, foliage where leaves resolve into shapes but lose their surface. The structure is right at medium scale and simplified at the finest one.

### Does more sampling steps reduce the artifacts?

It improves composition and coherence, and leaves the decoder's contribution essentially unchanged. The information lost in latent compression is not recoverable by denoising for longer, because it was never in the latent.

### Would re-running the image through diffusion help hide them?

Measurement on this pipeline says the opposite. A partial re-synthesis pass made images both easier to classify and less faithful to the source, which is why the diffusion stage exists in the code and is disabled by default.

### Are these artifacts visible to a person?

At normal viewing size, usually not. At 200 % zoom on a textured surface, often yes, once you know what to look for. The gap between those two is exactly the range in which measurement matters more than opinion.

Try it: https://passreal.com/app (three images free)
