StyleVAR: Controllable Image Style Transfer via Visual Autoregressive Modeling

Liqi Jing, Dingming Zhang, Peinian Li, Lichen Zhu

View Original ↗
AI 導讀 technology AI 重要性 3/5

Duke大學StyleVAR以自回歸+GRPO超越AdaIN

  • Blended cross-attention 同時以風格與內容特徵為 Query、以目標歷史 token 為 K/V,比 AdaIN 統計矩方法捕捉更高階風格語意
  • PANW(α=0.7)解決 VAR 十尺度間 256 倍 token 不平衡問題,確保構圖尺度獲得足夠梯度更新
  • SFT(267,710 三元組)+ GRPO(DreamSim 獎勵)兩階段訓練,OmniStyle 基準 SSIM +0.26、LPIPS −0.28,單張 NVIDIA 4090 完成

256 倍 token 落差讓過去的自回歸風格遷移難以平衡構圖與細節,Duke 大學的 StyleVAR 用梯度重加權與強化學習重新定義這個問題,在單張消費級 GPU 上就超越了 AdaIN 基準。

VAR:用「由粗到細」的自回歸取代擴散模型

Visual Autoregressive Modeling(VAR)是近年圖像生成的新範式:不像擴散模型逐步去噪,VAR 把圖像拆成從 1×1 到 16×16 共 10 個尺度的 token 地圖(每張圖合計 680 個 token),以自回歸方式由粗到細逐尺度生成。這種架構天然具備「先定構圖、再填細節」的層次性,Duke 大學研究團隊選擇以此為底座打造 StyleVAR,讓風格遷移脫離統計矩的侷限。

Blended Cross-Attention:讓風格與內容同時驅動解碼

StyleVAR 的核心創新是「blended cross-attention」機制:在每個自回歸解碼步驟中,同時把風格圖特徵和內容圖特徵作為 Query,將目標圖的歷史 token 序列作為 Key 與 Value。相較於傳統 AdaIN 用均值/方差這類低階統計量傳遞風格,blended cross-attention 直接在注意力層融合兩類語意,使模型能捕捉筆觸方向、色彩組合、紋理密度等高階風格特徵,同時維持內容的語意結構不變形。

兩階段訓練:SFT 打底,GRPO 對齊感知

訓練流程分兩階段。第一階段監督微調(SFT):以 267,710 組(風格、內容、目標)三元組訓練 600M 參數的 VAR 骨幹,讓模型掌握基本的風格遷移映射。第二階段引入 Group Relative Policy Optimization(GRPO):以 DreamSim 感知相似度為獎勵信號對每個生成結果評分,用強化學習驅動模型進一步對齊人類感知上「風格到位、內容保真」的雙目標。這是 GRPO 首次被用於視覺風格遷移,驗證了語言模型 RLHF 範式可移植至圖像生成領域。

PANW:正面解決 256 倍 token 不平衡

VAR 最大的訓練陷阱在於多尺度 token 數量懸殊——1×1 尺度只有 1 個 token,16×16 尺度則有 256 個,相差整整 256 倍。直接最大化似然會讓大尺度(細節)主導梯度,粗尺度(構圖)幾乎得不到更新。StyleVAR 提出 Per-Action Normalization Weighting(PANW),以超參 α=0.7 對各尺度損失做正規化,確保 1×1 與 16×16 的梯度量級相當,讓模型在 10 個尺度上均衡學習構圖與細節的風格映射。

量化結果:SSIM +0.26,LPIPS −0.28,單張 4090 可跑

在 OmniStyle 基準上,StyleVAR 對比 AdaIN 的 SSIM 提升 +0.26(結構相似度),LPIPS 下降 −0.28(感知距離縮短),在 CSFD 與 ArtFID 等評估指標上亦全面領先。模型在單張 NVIDIA 4090 上完成訓練,推論時跳過擴散模型的多步去噪,生成速度顯著更快。現階段主要限制:人臉生成仍有失真,對訓練集外的網路圖片泛化能力有待提升。

本文要點:StyleVAR 把視覺自回歸生成(VAR)與強化學習(GRPO)引入風格遷移,用 blended cross-attention 取代統計矩、用 PANW 平衡多尺度梯度;以消費級硬體在 OmniStyle 基準超越 AdaIN,為可控圖像風格化開闢了新的技術路線。

項目AdaIN 基準StyleVAR變化方向
SSIM(OmniStyle)↑基準+0.26↑ 提升
LPIPS(OmniStyle)↓基準−0.28↓ 改善
訓練資料規模267,710 三元組
模型參數量600M
訓練硬體單張 NVIDIA 4090

Abstract

We build on the Visual Autoregressive Modeling (VAR) framework and formulate style transfer as conditional discrete sequence modeling in a learned latent space. Images are decomposed into multi-scale representations and tokenized into discrete codes by a VQ-VAE; a transformer then autoregressively models the distribution of target tokens conditioned on style and content tokens. To inject style and content information, we introduce a blended cross-attention mechanism in which the evolving target representation attends to its own history, while style and content features act as queries that decide which aspects of this history to emphasize. A scale-dependent blending coefficient controls the relative influence of style and content at each stage, encouraging the synthesized representation to align with both the content structure and the style texture without breaking the autoregressive continuity of VAR. We train StyleVAR in two stages from a pretrained VAR checkpoint: supervised fine-tuning on a large triplet dataset of content--style--target images, followed by reinforcement fine-tuning with Group Relative Policy Optimization (GRPO) against a DreamSim-based perceptual reward, with per-action normalization weighting to rebalance credit across VAR's multi-scale hierarchy. Across three benchmarks spanning in-, near-, and out-of-distribution regimes, StyleVAR consistently outperforms an AdaIN baseline on Style Loss, Content Loss, LPIPS, SSIM, DreamSim, and CLIP similarity, and the GRPO stage yields further gains over the SFT checkpoint, most notably on the reward-aligned perceptual metrics. Qualitatively, the method transfers texture while maintaining semantic structure, especially for landscapes and architectural scenes, while a generalization gap on internet images and difficulty with human faces highlight the need for better content diversity and stronger structural priors.