7 minute read

[VLM] Visual-SDPO: 렌더링된 시각 피드백을 privileged context로 쓰는 self-distillation

  • paper: https://arxiv.org/pdf/2606.10334
  • arXiv preprint (인용수: 회, '26-12-02 기준)
  • 저자: Haoyu Dong (Microsoft)
  • downstream task: Code-to-Visual Artifact 생성 (chart-to-code, UI-to-code, slide generation)
    • LLM이 코드를 써서 렌더러(matplotlib, Playwright, python-pptx)로 chart/web page/slide를 만드는 테스크. 렌더 결과를 못 보고 코드를 “committing” 하는 구조라 실행은 되지만 시각적으로 깨지는 결함(요소 겹침, 텍스트 잘림, 정렬 깨짐, 낮은 대비, overflow)이 자주 생김
  • 주요 용어
    • privileged context: 학습 때만 teacher가 접근하는 추가 입력 $v$ (렌더된 이미지 또는 rubric 벡터). student는 $x$(프롬프트)만 봄. teacher와 student는 weight-sharing이라 별도 파라미터가 없음. $p_S(y_t y_{<t},x)$ vs $p_T(y_t y_{<t},x,v)$
    • Visual-SDPO: 렌더된 시각 피드백을 teacher의 privileged context로 주입하고, 그 피드백을 코딩 student로 token-level KL distillation 하는 프레임워크
    • Visual-Grounded Code Credit Weighting: 검출된 시각 결함을 그 결함을 만든 코드 statement로 역추적(region-to-code mapping)해서, 해당 statement의 token에 distillation 신호를 증폭하는 공간적으로 타깃된 가중치
    • image channel vs rubric channel: teacher에 주는 시각 신호 $v$의 두 형태. image = 렌더된 스크린샷 자체(VLM이 봄), rubric = 결함 카테고리별 binary score vector(JSON 직렬화해서 텍스트로 append)
    • resp(s): statement $s$의 책임 점수. 결함 region과의 IoU × severity의 최대값. per-token weight $w_t = 1+(\alpha-1)\cdot\mathrm{resp}(s(t))$로 변환되어 $[1,\alpha]$ 범위

1. Motivation

  • Code-driven visual artifact 생성에서는 모델이 최적화하는 대상(코드) 과 평가되는 대상(렌더된 픽셀) 사이에 non-differentiable rendering step이 끼어있음
    • 모델은 렌더를 보기 전에 코드에 commit 해야 함 $\to$ 문법적으로 valid한 코드가 시각적으로 깨진 artifact를 만듦 (legend가 데이터를 가림, 텍스트가 프레임에서 잘림, 요소 충돌 등)
  • 기존 접근 두 가지와 한계
    1. Inference-time visual reflection: render–critique–revise 루프를 VLM critic이 승인할 때까지 반복
      • 매 iteration마다 렌더러 재실행 + 코드 재생성 $\to$ polishing round 수에 비례해 배포 비용이 커지고, 렌더러와 VLM critic을 둘 다 추론 시점에 들고 있어야 함
    2. Visual-reward RL: image-level scalar reward로 GRPO/DPO 최적화
      • supervision이 sparse하고 trajectory-level임. per-element 진단(어느 요소가 겹쳤는지, 어느 텍스트가 잘렸는지)이 하나의 숫자로 뭉개져서 gradient를 모양 잡기 전에 collapse됨
  • (제3의 길) 렌더된 시각 피드백을 privileged context로 쓰는 self-distillation
    • teacher는 렌더된 artifact(또는 그 구조적 요약)에 조건부, student는 원래 프롬프트에만 조건부
    • token-level distillation이 “시각적 이해”를 student에 이식 $\to$ 추론 시점에는 렌더러가 필요 없음
    • scalar reward와 달리 이 피드백은 localizable: 어느 요소가 겹치고 어느 텍스트가 잘리고 어느 색 조합이 안 읽히는지를 짚음

figure1 첨부 (Visual-SDPO 전체 개요: student rollout → render → defect detector/rubric extractor → teacher re-score → credit-weighted KL + GRPO)

2. Contribution

  1. Visual-SDPO: code-generated visual artifact를 위한 visual-feedback self-distillation 프레임워크. weight-sharing teacher가 렌더된 artifact를 privileged context로 관찰하고 그 피드백을 코딩 student로 distill
  2. Visual-Grounded Code Credit Weighting: 렌더 결함을 책임 code statement로 역추적해 token-level distillation을 가중. 이 token-level 신호를 sequence-level GRPO reward와 결합
  3. 통합 instantiation + 평가: 단일 Qwen3-VL-8B-Instruct backbone으로 chart-to-code, UI-to-code, slide-generation을 모두 커버. zero-shot base 대비 primary metric에서 10 point 이상 개선

3. Method

3.1 Problem Setup

  • Policy $\pi_\theta$가 코드 시퀀스 $y=(y_1,\dots,y_T)$ 생성 $\to$ deterministic renderer $R$이 artifact $R(y)$ (HTML/chart image/slide deck)로 변환
  • Visual diagnostic extractor가 artifact를 privileged context $v$로 변환: raw 이미지 그 자체이거나 결함 카테고리별 rubric score vector
  • Defect detector가 결함 집합 $D={(\mathrm{region}_i, \mathrm{severity}_i)}$ 반환 (각 결함은 region + binary severity)
  • Region-to-code mapping $M$: 각 statement $s$가 만든 렌더 region 집합을 반환 (chart=Python source line, web=HTML element, slide=python-pptx shape call)

3.2 Visual-Feedback Self-Distillation

  • student: $p_S(y_t y_{<t},x)=\pi_\theta(y_t y_{<t},x)$ — 프롬프트만
  • teacher: $p_T(y_t y_{<t},x,v)=\pi_\theta(y_t y_{<t},x,v)$ — weight-sharing이지만 추가로 $v$에 조건부
    • teacher는 $y$를 재생성하지 않음. student의 token을 privileged context 하에서 re-score만 함
    • $p_T$는 현재 policy의 두 번째 forward pass로 계산되고 KL 전에 detach $\to$ gradient는 student로만 흐르고 별도 teacher 파라미터 없음
  • Visual-Feedback Self-Distillation loss (token-level KL): \(\mathcal{L}_{\mathrm{VFD}}(\theta)=\mathbb{E}_{x,y\sim\pi_\theta}\left[\sum_{t=1}^{T}\mathrm{KL}\big(p_S(\cdot|y_{<t},x)\,\|\,p_T(\cdot|y_{<t},x,v)\big)\right]\)

  • 두 채널로 시각 신호 instantiate
    • Image channel: policy가 image-conditioned VLM(Qwen3-VL-8B)일 때. teacher는 프롬프트 + 렌더 스크린샷을 받음. 코드가 실행 실패해 artifact가 없으면 스크린샷 대신 Python/browser 실행 에러 메시지를 넣음 $\to$ 원래 SDPO의 텍스트 에러 피드백을 privileged context로 복원
    • Rubric channel: 렌더 artifact에 경량 rubric extractor를 적용해 domain별 결함 카테고리 score vector 획득 (JSON-like 텍스트로 프롬프트에 append)

3.3 Visual-Grounded Code Credit Weighting

  • Vanilla token-level KD는 모든 출력 token을 균등 취급 $\to$ 대부분의 token(변수명, control flow, container scaffolding)은 시각 요소를 전혀 안 만드는데 gradient를 분산시킴
  • 세 컴포넌트로 공간 타깃팅:

Defect detection. 렌더 artifact에서 결함 집합 $D={(\mathrm{region}_i,\mathrm{severity}_i)}$ 검출. 동시에 rubric extractor가 domain별 axis set에 대한 binary defect table 생성. rubric 채널과 GRPO visual reward가 같은 per-domain axis set을 공유 (두 신호를 construction으로 coupling)

  • Web/UI (Design2Code): CLIP similarity, block-match, text, position, color (5축)
  • Slide (AeSlides): aspect ratio, whitespace, collision, imbalance (4축)
  • Chart (ChartMimic): execution validity + text/layout/chart-type/color (4 low-level 축) + reference 대비 visual similarity

Region-to-code mapping. 각 결함 region을 만든 statement를 식별. token이 아니라 statement granularity (한 시각 요소는 보통 여러 token이 묶인 하나의 coherent act로 생성됨). 두 방식:

  • Runtime introspection: 렌더러를 instrument. matplotlib은 artist constructor를 hook해 sys._getframe()로 source line, get_window_extent()로 region 포착. web은 data-src-* 속성 + getBoundingClientRect(). slide는 python-pptx shape constructor를 hook
  • VLM-based mapping: 같은 Qwen3-VL teacher가 결함 region이 annotate된 이미지 + 코드를 보고 책임 statement를 지목. renderer-agnostic이라 instrument 안 한 toolchain에 fallback

Statement-weighted KL loss. statement $s$의 책임 점수: \(\mathrm{resp}(s)=\max_{i\in D}\left[\big(\max_{b\in M(s)}\mathrm{IoU}(b,\mathrm{region}_i)\big)\cdot\mathrm{severity}_i\right]\) \(w_s=1+(\alpha-1)\cdot\mathrm{resp}(s)\in[1,\alpha]\)

  • 렌더 요소를 안 만드는 statement(import, 선언, control flow)는 $\mathrm{resp}(s)=0$ $\to$ weight 1. 결함 region 안에 완전히 들어간 요소는 weight $\alpha$
  • 최종 statement-weighted per-token KL: \(\mathcal{L}_{\mathrm{VSDPO}}(\theta)=\frac{1}{\sum_t w_t}\sum_t w_t\cdot\mathrm{KL}\big(p_S(\cdot|x,y_{<t})\,\|\,p_T(\cdot|x,v,y_{<t})\big)\)
  • $\sum_t w_t$로 normalize해 loss scale을 uniform KD와 맞춤. $\alpha=1$이면 uniform SDPO로 환원

3.4 Final Training Objective

  • token-level distillation + sequence-level GRPO를 jointly 최적화 (상보적)
    • distillation: dense, localizable supervision
    • GRPO: execution-grounded outcome reward로 toolchain 넘어 training anchor \(\mathcal{L}(\theta)=\mathcal{L}_{\mathrm{VSDPO}}(\theta)+\beta\cdot\mathcal{L}_{\mathrm{GRPO}}(\theta)\)
  • GRPO term은 multiplicative composite reward: \(r(y)=r_{\mathrm{exec}}(y)\cdot r_{\mathrm{vis}}(y)\)
    • $r_{\mathrm{exec}}\in{0,1}$: 실행되고 artifact 생성되면 1
    • $r_{\mathrm{vis}}\in[0,1]$: rubric extractor의 graded visual-quality score
    • multiplicative 형태라 실행 실패엔 reward 0, 실행되고 acceptable artifact일 때만 양의 reward
  • 실패 rollout($r_{\mathrm{exec}}=0$)도 Python/browser error trace를 teacher에 privileged context로 넘겨 $\mathcal{L}_{\mathrm{VSDPO}}$가 여전히 유용한 supervision 제공
  • Optional warm-start: labeled reference corpus가 있는 domain(Chart2Code-160K)은 초기에 reference code에 대한 standard SFT loss로 warm-start 후 joint training

4. Experiments

4.1 Setup

  • Backbone: 단일 Qwen3-VL-8B-Instruct (domain별로 따로 학습, corpus는 섞지 않음)
  • Training corpora
    • Chart: Chart2Code-160K (executable subset으로 필터)
    • Web/UI: WebCode2M + WebSight
    • Slide: AeSlides-7k (instruction-only, reference code 없음)
  • Eval: ChartMimic (Direct Mimic), Design2Code, AeSlides verifiable metrics
  • Baselines (모두 같은 backbone + per-domain corpus)
    • SFT: per-domain corpus로 표준 fine-tuning
    • OPSD (ref-code privileged teacher): teacher가 렌더 artifact 대신 ground-truth reference code에 접근 (reference-code privilege를 visual privilege와 분리하는 control)
    • GRPO with visual reward: scalar visual reward로 GRPO

4.2 Chart Domain (ChartMimic)

table1 첨부 (ChartMimic Direct Mimic ablation: zero-shot / +SFT / +OPSD / +GRPO / +Visual-SDPO)

Method Exec Low High Overall Δ
Qwen3-VL-8B (zero-shot) 81.7 62.9 72.9 67.9 —
+ SFT (Chart2Code-160K) 90.3 69.9 77.2 73.6 +5.7
+ OPSD (ref-code priv.) 92.3 73.9 80.1 77.0 +9.1
+ GRPO (visual-sim reward) 92.9 72.6 79.7 76.2 +8.3
+ Visual-SDPO (full) 92.7 74.8 82.3 78.6 +10.7
  • 비단조(non-monotone) 패턴: chart에서는 reference code의 dense token-level supervision(OPSD, +9.1)이 scalar trajectory-level visual reward(GRPO, +8.3)보다 더 informative
    • matplotlib 코드는 axis API/색·마커 철자/legend 위치 등 token-level 구조 명확화의 이득이 큼 (Low-level F1 69.9 $\to$ 73.9)
  • Visual-SDPO(+10.7)는 단일 신호 best baseline보다 +1.6 $\to$ dense per-statement credit + sequence-level reward가 상보적. Low F1(74.8)과 High score(82.3) 둘 다 단일 신호보다 우위

4.3 Web/UI Domain (Design2Code)

table2 첨부 (Design2Code public eval set: CLIP/Block/Text/Position/Color/Overall)

Method CLIP Block Text Position Color Overall Δ
Qwen3-VL-8B (zero-shot) 85.4 50.2 78.1 71.9 74.7 72.1 —
+ SFT 87.1 59.6 82.3 77.2 78.8 77.0 +4.9
+ OPSD 87.4 62.3 82.9 78.4 81.8 78.6 +6.5
+ GRPO 88.3 64.5 83.3 78.7 85.1 80.0 +7.9
+ Visual-SDPO (full) 89.2 69.7 84.9 82.4 86.8 82.6 +10.5
  • ChartMimic과 다른 per-axis 프로파일. SFT는 Block-Match(50.2 $\to$ 59.6)를 가장 많이 올림 (더 faithful한 container hierarchy)
  • Visual-SDPO(+10.5)는 공간 축(Position 78.7 $\to$ 82.4, Block 64.5 $\to$ 69.7)에서 가장 큼 $\to$ HTML DOM 위의 region-to-code mapping이 가장 informative (겹친 요소를 특정 <div>의 CSS width/position으로 역추적)

4.4 Slide Domain (AeSlides)

table3 첨부 (AeSlides-7k-eval: Avg over aspect-ratio/whitespace/collision/imbalance. OPSD는 reference code 없어 생략)

Method Avg Δ
Qwen3-VL-8B (zero-shot) 49.5 —
+ SFT (AeSlides-7k-train) 52.8 +3.3
+ GRPO (4-axis reward) 58.2 +8.7
+ Visual-SDPO (full) 60.7 +11.2
  • instruction-only corpus라 OPSD 불가. 가장 큰 single-stage gain은 verifiable-reward GRPO stage(+5.4 over SFT) — reward가 평가 metric과 일치하기 때문
  • Visual-SDPO는 GRPO 위에 +2.5 (base 대비 +11.2) $\to$ token-level code credit assignment가 metric-aligned GRPO 위에서도 추가 가치. per-statement 책임이 aspect-ratio 위반을 책임 shape/layout statement로 연결

4.5 Training Efficiency

  • dense per-token distillation 신호가 sequence-level RL보다 sample-efficient
  • GRPO의 full-training 성능을 훨씬 적은 rollout 생성 + 렌더 평가로 달성: 3개 domain 평균 GRPO rollout budget의 약 29% $\to$ wall-clock training도 그만큼 감소

5. Conclusion & Limitations

  • 요약: 렌더된 시각 피드백을 weight-sharing teacher의 privileged context로 쓰고, Visual-Grounded Code Credit Weighting으로 결함을 책임 statement로 역추적해 per-token distillation을 증폭하며, sequence-level GRPO로 보완. 단일 Qwen3-VL-8B로 3개 벤치마크에서 zero-shot 대비 10+ point, GRPO 대비 최소 2.4 point 개선. 추론 시점엔 렌더러/detector/teacher가 전부 불필요 (추가 inference 비용 0)
  • 저자가 밝힌 확장 방향 (한계)
    • training corpus를 최근 large-scale visual-reward 수준의 chart-RL regime으로 스케일
    • differentiable rendering을 제3의 visual-feedback 채널로 연구
    • region-to-code mapping을 static artifact에서 multi-step interactive UI flow로 확장

Takeaways

  • Scalar visual reward의 “localizable 하지 않음” 문제를, 결함 → code statement 역추적 + statement-weighted KL로 정면 돌파한 게 핵심 아이디어
  • teacher/student weight-sharing + privileged context 구조라 별도 teacher 파라미터·추론 비용이 없음. 실패 rollout도 에러 trace를 privileged context로 돌려 학습 신호로 재활용
  • chart는 reference-code supervision(OPSD)이, slide는 verifiable reward(GRPO)가 더 강한데 Visual-SDPO는 두 신호를 합쳐 모든 domain에서 단일 신호를 넘어섬 — dense distillation과 sequence reward의 상보성이 메시지
  • GRPO 대비 ~29% rollout budget으로 동등 성능 → render-in-the-loop RL의 비용 문제에 대한 실용적 답

Updated: