Your Codec, Your Generator:Idempotent Generative Compression without Retraining

Raz Haim Assaf Shocher

Technion — Israel Institute of Technology

Original codec, round 1Original codec, round 10Original codec, round 20Original codec, round 50
Original codec (AEIC)
With our adapter, the same image at every round identical at every round
Same codec with our adapter

A Kodak image decoded, stored as 8-bit, and compressed again, 50 times. Labels: PSNR and bpp.

Left: an image recompressed 1, 10, 20 and 50 times with a pretrained codec drifts, while the adapted codec reproduces the same image at every round. Middle: PSNR across 50 recompression rounds; ours stays flat while methods designed for idempotency lose quality. Right: patch FID versus PSNR for regular and generative decoding of the same bitstreams.

(a) 1, 10, 20, and 50 recompressions, with and without our adapter. (b) PSNR across recompression rounds against methods designed for idempotency, at a common initial bitrate, on Kodak benchmark. (c) Nonlinear back-projection controls the perception–distortion trade-off. Each colored curve varies decoding while keeping the transmitted bitstreams fixed. Top labels indicate bitrate in bpp.

Abstract

We introduce an image compression framework with three properties: (i) adaptation of pretrained codecs without retraining or fine-tuning, (ii) cycle-consistent recompression, even of already-encoded images, and (iii) decoding with independently chosen generative priors. We wrap the frozen encoder with non-learned operations so that every continuous latent has a preimage, yielding a surjective pseudo-invertible neural network. A nonlinear right inverse built from the pretrained decoder satisfies E′(D′(E′(x))) = E′(x). To extend consistency to quantized bitstreams, the receiver searches for a continuous latent that reproduces both the transmitted main symbols and entropy side information. A successful search and an exact correction preserve both streams under deterministic coding; the final reconstruction is checked through the actual coding path.

The encoder’s pseudo-inverse enables a nonlinear counterpart of back-projection. In the linear case, back-projection has the closed-form solution x′ = x + A†(y − Ax), giving the closest reconstruction to x satisfying Ax′ = y. Our nonlinear formulation enforces the transmitted code on proposals from an independently chosen generative model. Adjusting the starting noise controls the prior’s influence without changing that code.

Experiments show small first-pass quality changes, higher retained quality than trained consistency codecs over 50 recompressions, also under 8-bit storage, and decoder-side control of the perception–distortion trade-off. Decoupling the codec from its prior lets the receiver adopt future generators without retraining or re-encoding.

Eight pretrained codecs, no retraining

More examples in the viewer

Each chain recompresses the same Kodak image 50 times, with 8-bit storage (GLC: float chain). Both panels flicker between round 1 and round 50: the original codec drifts, while the adapted codec reproduces its round-1 image exactly and does not move.

identical to round 1
Original codec
identical to round 1
With our adapter

Choose the generator at decoding time

The receiver chooses a prior and its influence after encoding, without weight updates.

HPCM λ = .0018, Kodak kodim16. Every decoder reads the same bitstream; right: the 128×128 detail outlined on the left, enlarged. PixNerd uses its tuned setting; Z-Image uses an untuned setting. Whole-image PSNR ↑ and DISTS ↓.

How it works

We wrap the frozen encoder with non-learned operations so that every continuous latent has a preimage, which turns it into a surjective pseudo-invertible network. A nonlinear right inverse built from the pretrained decoder makes recompression consistent: E′(D′(E′(x))) = E′(x). For quantized bitstreams, the receiver searches for a continuous latent that reproduces both the transmitted main symbols and the entropy side information, and writes it into the image. No network is retrained.

Method diagram. (a) Encoding: PCA splits the image into a and b; b passes through the frozen encoder E, a is scaled by c and added, giving the latent y, which is quantized and entropy coded with the frozen hyperprior. (b) Decoding: target search selects y-star, and the explicit write W places it into the image while keeping the b part of the decoded image.
(a) The adapted encoder E′ splits the image with PCA, passes one part through the frozen encoder E, and adds the other part scaled by c. (b) Decoding: target search selects a latent y⋆ that reproduces the transmitted symbols, and the explicit write W writes it while preserving bD, the complementary PCA part of the decoded image. The first encode uses E, later ones E′. Dark blocks are frozen pretrained networks.
  1. 01

    Wrap the frozen encoder

    Non-learned operations give every continuous latent a preimage. No network is retrained.

  2. 02

    Search for the code

    The receiver finds a latent that reproduces the transmitted symbols and side information.

  3. 03

    Decode with any generator

    Nonlinear back-projection keeps the code while a chosen prior adds detail.

Interactive results

Step through recompression rounds and flicker between methods, storage protocols, and decoders that read the same bitstream.

Open the viewer

About 106 MB of lossless images, loaded on demand.

BibTeX

@misc{haim2026yourcodec,
  title   = {Your Codec, Your Generator: Idempotent Generative Compression without Retraining},
  author  = {Haim, Raz and Shocher, Assaf},
  url     = {https://assafshocher.github.io/your-codec/},
  year    = {2026}
}