Edit the Bits, Diff the Codes: Bitwise Residual Editing for Visual Autoregressive Models

Shengqiang Zhang, Ruotong Liao, Volker Tresp, Barbara Plank, Hinrich Schütze

TL;DR

BitResEdit is a training-free, optimization-free image editing framework designed specifically for bitwise-residual Visual Autoregressive (VAR) models like Infinity. By decoupling the editing process into bit-level guidance before sampling (BitEdit) and mask-gated continuous code composition after sampling (ResEdit), it achieves state-of-the-art text alignment while preserving backgrounds exactly in latent space. Crucially, it delivers these results at a fraction of the computational cost of prior optimization-based methods.

What Problem Does This Paper Address?

While diffusion models have long dominated text-guided image editing, Visual Autoregressive (VAR) models are rapidly gaining traction due to their high generation quality and low latency. Instead of denoising a continuous trajectory, VAR models generate images by sequentially sampling discrete multi-scale tokens.

However, existing image editing tools do not translate well to VAR architectures. Current VAR editors treat the generator as a black box, manipulating flat token streams or attention maps. This ignores two native properties of bitwise-residual VAR models: their independent per-bit Bernoulli prediction heads and their additive multi-scale code fields. Consequently, existing methods suffer from a harsh trade-off: they either fail to align well with the new text prompt or inadvertently distort the unedited background regions of the image.

Methods

The authors introduce BitResEdit, a two-stage pipeline that intervenes at two distinct internal sites of a frozen VAR generator (detailed in Figure 2):

  1. BitEdit (Decision-Time Bit Guidance): Operating before token sampling, BitEdit modifies the per-bit Bernoulli log-odds. It introduces a "source-negative guidance" contrast that nudges the model away from the source prompt's attributes and toward the target prompt. To ensure the edits remain realistic and on-distribution, BitEdit projects these modified log-odds back into a closed-form Bernoulli-KL trust region around the clean sampler.
  2. ResEdit (Combination-Time Code Composition): Operating after sampling, ResEdit shifts the focus to spatial preservation. It computes a continuous-code residual between the newly sampled edit and the cached source image. This residual is gated by a soft localization mask and injected directly into the model's native sum-of-scales. Outside the mask, the residual is exactly zero, ensuring the background remains perfectly untouched in the latent space.
BitResEdit Pipeline

Datasets

The authors evaluated BitResEdit on PIE-Bench, a standard text-guided image-editing benchmark. It contains 700 source-target image-prompt pairs across 10 distinct editing categories, including object swapping, attribute modification, background changes, and style deletion.

Key Insights and Ideas

  • A Sharp Division of Labor: Rather than forcing a single mechanism to handle both text alignment and background preservation, BitResEdit splits the task. BitEdit dictates what to sample, while ResEdit dictates where to apply it.
  • The Power of Bitwise Math: Because bitwise-residual VARs factorize tokens into independent bits, the authors could derive a mathematically exact, closed-form KL-divergence bound per bit. This acts as a highly effective "safety rail" against structural artifacts during aggressive editing.
  • Continuous Residuals for Discrete Models: Even though VARs sample discrete bits, the final image is assembled by linearly summing continuous multi-scale codes. Exploiting this additive code space allows for clean, algebraic mask gating that completely bypasses the need to alter complex attention maps or token streams.

Key Results

Evaluated against the Infinity-2B backbone on PIE-Bench, BitResEdit demonstrated impressive quantitative and qualitative improvements:

  • Top-Tier Text Alignment: It achieved the strongest text alignment among same-backbone VAR editors, improving the edited-region CLIP score by +1.07 over the previous best method (EditInfinity).
  • Excellent Background Preservation: It maintained highly competitive background preservation metrics (91.71 SSIM vs. EditInfinity's 92.12).
  • Massive Speedups: Because BitResEdit is training-free and requires no per-image fine-tuning or optimization, it runs ~45x faster than EditInfinity, taking just 10.41 seconds per image compared to 466.77 seconds.

Limitations and Future Work

The primary bottleneck for BitResEdit is object deletion (e.g., removing an object without replacing it with something specific). Because the framework is fundamentally biased toward background preservation and lacks an explicit inpainting prior, subtractive prompts often cause the model to restyle the object rather than erase it, or fill the region with incoherent textures (see Figure 5).

Additionally, the method is sensitive to mask quality; loose bounding boxes can cause edits to leak into unedited corners. The authors note that automatically deriving tight localization masks directly from the model's internal per-bit Bernoulli geometry is a promising direction for future work.

Object Deletion Failure Cases

Summary updated

BibTeX
@inproceedings{zhang2026edit,
  author = {Shengqiang Zhang and Ruotong Liao and Volker Tresp and Barbara Plank and Hinrich Schütze},
  title = {{Edit the Bits, Diff the Codes: Bitwise Residual Editing for Visual Autoregressive Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=c371hRPzMl},
}
Figure