Visual-ERM: Vision-to-Code를 위한 Visual Equivalence Reward Modeling
Visual-ERM: Reward Modeling for Visual Equivalence
TL;DR Highlight
차트/표/SVG를 코드로 변환하는 RL 학습에서 기존 DINO나 텍스트 기반 보상이 놓치는 세밀한 시각 오류를 잡아내는 8B 멀티모달 Reward Model
Who Should Read
차트/문서 이미지를 코드나 마크다운으로 변환하는 파이프라인을 개발하는 ML 엔지니어. 특히 RL(강화학습)로 Vision-Language 모델을 파인튜닝할 때 보상 설계 문제를 겪고 있는 개발자.
Core Mechanics
- DINO 임베딩 유사도나 TEDS(텍스트 편집 거리 기반 지표)같은 기존 보상은 reward hacking에 취약 — DINO 스코어 0.99인데도 차트 색상/축/데이터가 완전히 틀린 사례 존재
- Visual-ERM은 Qwen3-VL-8B-Instruct 기반으로 학습된 8B 멀티모달 생성형 Reward Model로, 원본 이미지와 렌더링된 예측 이미지를 비교해 structure/data/text/style 4가지 오류 카테고리와 severity를 JSON으로 출력
- GPT-5-mini로 생성한 34만 건(차트 104K, 표 125K, SVG 111K)의 오류 어노테이션 데이터로 SFT 학습 — 대형 모델 지식을 작은 모델로 증류(Distillation)하는 방식
- RL 보상으로 사용 시 Qwen3-VL-8B-Instruct 대비 chart-to-code +8.4점, table-to-markdown +2.7점, SVG-to-code +4.1점 향상 (DINO 기반 RL 대비 일관되게 우세)
- Test-Time Scaling에도 활용 가능 — Visual-ERM 피드백으로 모델이 자기 출력을 반성·수정하는 루프를 3라운드 돌리면 추가 +8.0점 향상
- VC-RewardBench(1,335개 고품질 인스턴스)에서 Visual-ERM 8B가 Qwen3-VL-235B-Instruct를 크게 앞서고, GPT-4o 등 클로즈드 소스 모델에 근접한 성능
Evidence
- Chart-to-Code: Qwen3-VL-8B-Instruct 기준 69.6 → Visual-ERM RL 후 78.0 (+8.4점), DINO 기반 RL은 76.1에 그침
- VinciCoder-8B-SFT(이미 강한 특화 모델)에 Visual-ERM RL 적용 시 +10.1점 추가 향상 — 강한 베이스라인에도 효과적
- VC-RewardBench에서 Visual-ERM(8B)의 평균 F1h/F1s/Sc = 42.1/44.7/58.4 vs Qwen3-VL-235B-Instruct 29.5/32.4/56.2 — 30배 작은 모델이 역전
- Test-Time Scaling 3라운드 반성·수정 후 Chart-to-Code 평균 78.0 → 81.1 (+3.1점), 기본 모델은 65.7 → 77.6 (+8.0점)
How to Apply
- RL 보상 설계 시: 모델 출력 코드를 렌더링해 이미지로 만든 뒤 (원본 이미지, 렌더링 이미지) 쌍을 Visual-ERM에 넣어 severity 합산 점수를 보상으로 사용. render 성공 여부를 format reward처럼 추가하면 학습 안정성 향상.
- Test-Time Scaling 적용 시: 모델이 코드 초안을 생성 → 렌더링 → Visual-ERM으로 오류 피드백 추출 → 피드백을 프롬프트에 붙여 재생성하는 루프를 3회 반복. 3라운드가 비용 대비 최적.
- Reward Model 학습 데이터 구축 시: 정답 이미지+코드에서 GPT-5-mini로 오류를 주입해 (원본, 오류버전) 쌍을 만들고, 강한 모델로 category/severity/location/description을 JSON 어노테이션으로 생성하는 증류 파이프라인 사용.
Code Example
# Visual-ERM 추론 프롬프트 예시 (Chart-to-Code)
PROMPT_CHART2CODE_JUDGEMENT = """
You are an Experienced Specialist for Data Visualization.
You will be provided with two images:
1. Original Image: a chart rendered using ground-truth Matplotlib code.
2. Generated Image: a chart rendered using AI-generated Matplotlib code.
Compare the Generated Image against the Original Image and identify all visual discrepancies.
Assign severity: 1(minor) / 2(medium) / 3(severe)
Output ONLY a single JSON object:
{
"structure_error_count": int,
"data_error_count": int,
"text_error_count": int,
"style_error_count": int,
"errors": [
{
"category": "structure_error | data_error | text_error | style_error",
"severity": 1 | 2 | 3,
"location": "Specific location (e.g., 'Legend', 'X-axis label')",
"description": "Concise description of the error."
}
]
}
"""
# RL 보상 계산 예시
def compute_verm_reward(errors: list, epsilon: float = 1e-6) -> float:
"""
Visual-ERM 출력 오류 리스트를 받아 [0,1] 범위 보상으로 변환
"""
total_severity = sum(e['severity'] for e in errors)
# 실제 구현에서는 태스크 내 최대 severity로 정규화
max_severity = 15.0 # 태스크별 조정 필요
normalized = total_severity / (max_severity + epsilon)
reward_verm = max(0.0, min(1.0, 1.0 - normalized))
return reward_verm
def compute_total_reward(rendered_image, gt_image, render_success: bool) -> float:
render_success_reward = 1.0 if render_success else 0.0
# Visual-ERM 호출 후 오류 리스트 획득
errors = call_visual_erm(gt_image, rendered_image) # 실제 모델 호출
verm_reward = compute_verm_reward(errors)
return render_success_reward + verm_reward # 최대 2.0Terminology
Related Resources
Original Abstract (Expand)
Vision-to-code tasks require models to reconstruct structured visual inputs, such as charts, tables, and SVGs, into executable or structured representations with high visual fidelity. While recent Large Vision Language Models (LVLMs) achieve strong results via supervised fine-tuning, reinforcement learning remains challenging due to misaligned reward signals. Existing rewards either rely on textual rules or coarse visual embedding similarity, both of which fail to capture fine-grained visual discrepancies and are vulnerable to reward hacking. We propose Visual Equivalence Reward Model (Visual-ERM), a multimodal generative reward model that provides fine-grained, interpretable, and task-agnostic feedback to evaluate vision-to-code quality directly in the rendered visual space. Integrated into RL, Visual-ERM improves Qwen3-VL-8B-Instruct by +8.4 on chart-to-code and yields consistent gains on table and SVG parsing (+2.7, +4.1 on average), and further strengthens test-time scaling via reflection and revision. We also introduce VisualCritic-RewardBench (VC-RewardBench), a benchmark for judging fine-grained image-to-image discrepancies on structured visual data, where Visual-ERM at 8B decisively outperforms Qwen3-VL-235B-Instruct and approaches leading closed-source models. Our results suggest that fine-grained visual reward supervision is both necessary and sufficient for vision-to-code RL, regardless of task specificity.