Style Transfer as a Label-Preserving Markov Chain

Semantic-aware style transfer repaints a photo in the look of a reference painting while keeping each part of the photo tied to the matching part of the painting. Sky should get sky texture and faces should get skin texture. The field's most persistent failure is "style bleeding," where brushstrokes that belong to one region of the painting spill into an unrelated region of the output. Current methods treat bleeding as something to discourage, using masks, masked losses, or attention tricks. None of them state a property that an output must satisfy, and none of them give a test that detects when that property is broken. Quantum money, where tokens are quantum states that cannot be copied, happens to contain a precise template for exactly this kind of property. In the collision-free quantum money blueprint of Breaking and Making Quantum Money, a banknote is valid when it is spread evenly over a set of configurations that share one label. Validity is checked by running a random walk that moves freely among configurations with the same label and can never move to a configuration with a different label.

We propose to build style transfer directly on that template. The output is produced and checked by a random walk over diffusion latents. Each step repaints one region using that region's matched style, and a step is accepted only if every other region keeps its style label. Bleeding is therefore forbidden by construction instead of penalized. The same walk run on a finished image becomes a measurement: the fraction of proposed moves that would change another region's label is a direct, reference-grounded leakage score. The quantum direction contributes the design principle and the verification criterion. Semantic style transfer is where they are applied and where the claims are tested. We make no claim of unclonable or quantum style assets.

Core Claim

Lutomirski et al. require two things of their verification walk: it must mix rapidly within a label class, and it must have zero probability of moving between labels. We argue these two requirements map cleanly onto the two things good regional style transfer needs. Zero cross-label transition corresponds to no bleeding. Rapid mixing within a label corresponds to outputs that are diverse, rather than collapsed onto one rendering, within the space of valid stylizations. Current diffusion methods satisfy neither requirement explicitly. Cross-Image Attention for Zero-Shot Appearance Transfer swaps the keys and values of self-attention between style and content images. It relies on the queries' semantic affinities to route appearance, so nothing prevents a sky key from being attended by a face query. CoCoDiff builds a dense correspondence map and refines the output in a closed loop that combines Sobel edge terms, Gram-matrix texture terms, and latent AdaIN (adaptive instance normalization, which rescales feature statistics to match a target). These are all soft penalties.

The testable claim has three parts. First, a hard label-preserving constraint gives measurably lower cross-region leakage than soft penalties at equal image quality. Second, this advantage grows when segmentation is noisy or when content and style contain different sets of objects. These are the two open problems the literature flags for mask-based methods such as SEAN and for the heuristic unmatched-object losses of DeepObjStyle. Third, the walk-based leakage score tracks human judgments of bleeding better than FID, LPIPS, or CFSD, which do not target bleeding at all.

What we borrow, and what constrains us

The research file offers tempting but unworkable versions of this intersection, such as unclonable quantum certificates of artistic style. We reject them for a concrete reason. On the (Im)plausibility of Public-Key Quantum Money from Collision-Resistant Hash Functions shows that publicly verifiable quantum money cannot be built in a black-box way when the verifier queries a hash function classically. A classical neural style network used as a verifier falls squarely in that regime. Physical quantum memory for such tokens also does not exist. That paper still shapes our design in a second way. Its counterfeiter treats the public verifier as an oracle and learns from every rejection. Any learned leakage scorer used during generation invites the same "mistake-as-progress" gaming by the generator. We therefore always evaluate with a labeler held out from the one used inside the chain.

From Quantum money from knots we take the same verification idea in a second form: compute an invariant (there, a knot polynomial) and check that the state is spread evenly over configurations sharing that invariant, using local moves that preserve it. In our setting the local moves are regional repaints, and the invariant is the tuple of per-region style labels.

Research Program

The system operates on the latent of a frozen Stable Diffusion model. We first obtain soft regions without requiring ground-truth masks. We cluster content and style diffusion features at the layer and timestep chosen by CoCoDiff's grid search, and use cosine correspondence between clusters to match each content region $r$ to a style region $m(r)$. A per-region label function $\ell_r(x)$ assigns region $r$ of image $x$ to its nearest style region under Gram-statistic distance. An unmatched content region, the cardinality-mismatch case, receives an explicit "inherit neighbor" label rather than borrowing the nearest style.

A chain step does the following. It picks a region $r$, re-noises the latent inside a soft mask of $r$ to an intermediate noise level, and denoises with attention keys and values drawn only from $m(r)$. The proposal $x'$ is accepted only if

$$\ell_{r'}(x') = \ell_{r'}(x) \ \text{for all } r' \neq r \quad \text{and} \quad d_c(x', x) \le \epsilon,$$

where $d_c$ is a content-structure distance (edge maps plus CFSD-style features) and $\epsilon$ bounds content drift. A rejected step leaves the state unchanged. The chain starts from a Cross-Image-Attention output and runs for a fixed number of steps.

For evaluation we run the same proposal mechanism on any finished image. Here $\hat\ell$ is a held-out labeler, and $R$ is the set of regions whose candidate moves we sample. We define leakage as

$$\mathcal{L}(x) = \Pr_{r \sim R,\, x' \sim q(\cdot \mid x, r)}\big[\exists\, r' \neq r : \hat\ell_{r'}(x') \neq \hat\ell_{r'}(x)\big],$$

where $q$ is the proposal distribution: the probability that repainting one region disturbs another region's style label. A leakage-free image sits in a regime where regional repaints stay regional. A bled image has regions whose labels are fragile or already wrong. We also report within-label diversity as the pairwise LPIPS between independent chain runs from the same content–style pair. This is the "mixing" half of the blueprint.

The work has three parts. The first is building the chain and its hard constraint. The second is validating $\mathcal{L}$ against human bleeding annotations. The third is stress-testing both under corrupted segmentation and asymmetric object sets.

Baselines

The naive reference is global AdaIN or Gram-matrix transfer. It applies uniform statistics across the whole canvas and, as StyleBank notes, cannot separate foreground from background. It sets the ceiling on leakage. We run it with the same VGG features used in our labeler.

The strongest existing method on this benchmark is CoCoDiff. On MS-COCO content with WikiArt styles it reports FID 18.432, LPIPS 0.549, CFSD 0.609, and a 0.492 user preference rate against StyleID's 0.174 (CoCoDiff). We rerun it on the same Stable Diffusion version and the same 13-style split, and give our chain the same wall-clock budget as its fitting loop. Beating it means lower leakage $\mathcal{L}$ and lower human-rated bleeding with FID and CFSD within noise of its reported values, not a gain on FID alone.

Plain Cross-Image Attention is the mask-free zero-shot competitor. The file contains no reported result for it on these metrics, so we run it ourselves. A masked variant, which restricts attention to matched regions, is the most dangerous baseline: it implements "no cross-region attention" with no chain at all.

On CelebAMask-HQ, SEAN is the ground-truth-mask reference, with a reported FID of 17.66 (SEAN). On DeepObjStyle's 100-instance asymmetric set, DeepObjStyle reports NIMA 5.49 and PieAPP 2.83 (DeepObjStyle).

Two ablations isolate the key ingredient. The first replaces the hard acceptance rule with the same label condition added as a soft penalty inside a CoCoDiff-style loop. The second is best-of-N sampling from masked Cross-Image Attention, scored by the in-chain labeler, at matched compute.

Why not just…?

Why not just mask the attention swap? Masked cross-image attention forbids cross-region routing at each denoising step. With correct masks it may match our leakage, and we treat that as a real threat. Our argument is that masks enter it as a fixed input, while our labels are re-checked on the actual output after each move. The mask-noise experiment settles this. If masked attention's leakage stays flat as masks are eroded, dilated, and label-swapped, and it matches ours on the DeepObjStyle asymmetric set, then the chain adds nothing beyond a verification metric, and we will report the paper that way.

Why not just add a masked Gram penalty to CoCoDiff's loop? Soft penalties trade bleeding against content and texture losses. Mastan and Raman's observation that globally computed objectives average activations across boundaries (DeepObjStyle) suggests the trade will sometimes favor bleeding. The penalty-versus-hard-constraint ablation, run at equal compute and tuning budget, measures this directly.

Why not just sample many outputs and keep the least-bled one? Best-of-N uses the same scorer and needs no chain. It cannot repair a single bad region without resampling everything, and when it uses the in-chain labeler it is exposed to the verifier-gaming problem described above. The matched-compute best-of-N ablation, scored with the held-out labeler, shows whether local repair beats global resampling.

Why not just use FID, LPIPS, and CFSD? They compare distributions or overall structure, and none of them refers to which reference region a texture came from. The human-correlation study below tests whether $\mathcal{L}$ adds information beyond them.

Proposed Experiments

The main benchmark is MS-COCO content with WikiArt styles across CoCoDiff's 13 styles. We report FID, LPIPS, CFSD, $\mathcal{L}$ under a held-out labeler (a different backbone and layer), within-label diversity, and human bleeding ratings. For these ratings, annotators mark the output regions whose texture visibly comes from the wrong reference region. CelebAMask-HQ provides ground-truth region masks, so we can compute an oracle leakage from the true masks, check $\mathcal{L}$ against it, and run SEAN-style crossover tests. DeepObjStyle's 100-instance set probes cardinality mismatch. SPair-71k checks that the region matching $m(r)$ is reliable under pose and scale changes.

The decisive checks are three. First, $\mathcal{L}$ must correlate with human bleeding ratings and with the CelebAMask-HQ oracle leakage more strongly than FID, LPIPS, or CFSD do. If it does not, the verification half of the proposal fails. Second, under clean masks and then under increasing mask corruption, the chain must show leakage that grows more slowly than masked attention's and than the soft-penalty ablation's, while holding FID and CFSD near CoCoDiff's reported 18.432 and 0.609. Third, $\mathcal{L}$ measured with the held-out labeler must not diverge from $\mathcal{L}$ measured with the in-chain labeler. A large gap would mean the chain is sculpting outputs to satisfy its own verifier, the failure mode Ananth et al. formalize for quantum money. That outcome would count against the method, not for it.