架構深入剖析:以視覺可歸因的 on-policy 自我蒸餾進行強化學習
Architectural Deep-Dive: Reinforcement Learning with Visually Attributable On-Policy Self-Distillation
Visual-Attribution Gating(VAG)以對比驗證篩選多模態 RLVR 的 on-policy 自我蒸餾(OPSD)更新,避免把無視覺依據的教師修正傳給學生模型。
Eliminating Privileged-Correction Contamination in Multimodal RLVR with Visual-Attribution Gating
Reinforcement learning with verifiable rewards (RLVR) and Group Relative Policy Optimization (GRPO) have established themselves as standard approaches for post-training advanced reasoning models. While task-level outcome supervision works exceptionally well for formal domains like competitive programming or symbolic math, it exhibits severe structural limitations when applied to multimodal agents performing fine-grained visual reasoning.
When an agent fails to locate a coordinate or misinterprets an engineering blueprint, scalar outcome rewards fail to indicate which specific intermediate reasoning token introduced the error. Integrating on-policy self-distillation (OPSD) using a privileged teacher addresses credit assignment by introducing dense token-level corrections. However, in production pipelines, this introduces an insidious failure mode: privileged-correction contamination.
The Failure Mode: Privileged-Correction Contamination
In standard OPSD setups, a privileged teacher is provided with high-resolution crops, focal patches, or privileged spatial evidence. The student policy is then nudged token-by-token toward the teacher's distribution.
Under empirical scrutiny, the teacher's corrective trajectory often conflates true visual evidence with:
- Over-reliance on internal linguistic priors (hallucinating details based on prompt semantics rather than pixels).
- Response style shifts induced by the privileged prompting scaffold.
- Counter-directional token updates where the gradient does not directly derive from visual evidence.
Directly distilling these contaminated token updates poisons the optimization path, entrenching spurious visual shortcuts rather than rigorous perceptual reasoning.
Contaminated Path: [Visual Input + Text] -> [Privileged Teacher] -> [Linguistic Prior Noise] -> [Corrupted Student Updates]
Attributed Path: [Visual Input] vs [Degraded View] -> [Attribution Gating] -> [Verified Visual Updates]
Visual-Attribution Gating (VAG): Architectural Scaffold
To decouple genuine visual corrections from spurious linguistic drift, the Visual-Attribution Gating (VAG) framework enforces a contrastive verification gate prior to accepting any token-level update.
The anchor of the optimization remains the verifier-derived advantage $\hat{A}t$. A corrective candidate token $w_t^*$ proposed by the teacher $M{\text{teacher}}$ is evaluated across two distinct execution contexts:
- $V_{\text{evidence}}$: The privileged view containing visual ground truth.
- $V_{\text{degraded}}$: A counterfactual view where target visual regions are systematically masked or degraded (e.g., Gaussian blur or feature dropout).
If the directional alignment of the proposed token update $\Delta \theta_t$ persists identically under $V_{\text{degraded}}$, the token update is classified as non-attributable to the visual evidence and dropped.
Minimal Conceptual PyTorch Implementation
import torch
import torch.nn as nn
import torch.nn.functional as F
class VisualAttributionGate(nn.Module):
def __init__(self, threshold: float = 0.15):
super().__init__()
self.threshold = threshold
def forward(
self,
logits_evidence: torch.Tensor,
logits_degraded: torch.Tensor,
student_logits: torch.Tensor,
verifier_advantage: torch.Tensor
) -> torch.Tensor:
"""
Filters teacher distillation updates based on visual attribution.
"""
# Compute KL divergence shifts from student
p_student = F.softmax(student_logits, dim=-1)
p_evidence = F.softmax(logits_evidence, dim=-1)
p_degraded = F.softmax(logits_degraded, dim=-1)
# Directional impact of visual evidence
kl_evidence = F.kl_div(p_student.log(), p_evidence, reduction='none').sum(dim=-1)
kl_degraded = F.kl_div(p_student.log(), p_degraded, reduction='none').sum(dim=-1)
# Visual Attribution Score: Difference in distribution divergence
attribution_delta = kl_evidence - kl_degraded
# Gate condition: update must be positively grounded in visual evidence
# and aligned with task-level verifier advantage
gate_mask = (attribution_delta > self.threshold) & (verifier_advantage > 0)
return gate_mask.float()
Production Takeaways for Multimodal Systems
- Stop Distilling Unchecked Teacher Tokens: In multi-agent teacher-student pipelines, never assume privileged inputs yield clean gradients. Without contrastive degradation, teachers simply inject stylized text artifacts into the student policy.
- Ground Intermediate Rewards in Physical Counterfactuals: Counterfactual perturbation (e.g., blanking out UI bounding boxes or telemetry logs) serves as an effective unit test for gradient attribution.
- Preserve Task-Level Anchoring: Token-level gating must never operate in a vacuum. Anchoring the gate to a deterministic verifier advantage ensures the policy does not optimize for attribution at the expense of end-to-end task completion.
Canonical publication: https://bohdanhordii.dev
Author: Bohdan Hordii | Website: bohdanhordii.dev | Contact: @bohdan_hordii
來源:DEV Community · dev.to