shravvvv commited on
Commit
3208c6b
·
verified ·
1 Parent(s): 6065aa8

Add CVPD model card

Browse files
Files changed (1) hide show
  1. README.md +137 -0
README.md ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen3-VL-4B-Instruct
3
+ base_model_relation: adapter
4
+ library_name: peft
5
+ pipeline_tag: image-text-to-text
6
+ license: apache-2.0
7
+ language:
8
+ - en
9
+ tags:
10
+ - lora
11
+ - peft
12
+ - cvpd
13
+ - self-distillation
14
+ - self-evolving
15
+ - multimodal
16
+ - vision-language
17
+ - lmm
18
+ - ocr
19
+ - visual-perception
20
+ - qwen3-vl
21
+ - unsupervised
22
+ ---
23
+
24
+ # CVPD: Contrastive Counterfactual Visual Process Distillation
25
+
26
+ This is the CVPD LoRA adapter for `Qwen/Qwen3-VL-4B-Instruct`, from our paper
27
+ [Perception Before Supervision: Self-Contained Visual Distillation from Counterfactual Blind Spots](https://github.com/mbzuai-oryx/CVPD).
28
+
29
+ CVPD is a fully self-contained framework for dense, on-policy, token-level visual
30
+ self-distillation. Prior visual distillation methods build their privileged context
31
+ with external tools — segmentation models, region proposal networks, annotation
32
+ pipelines, or stronger annotators such as GPT-4o. CVPD removes that dependency
33
+ entirely: the privileged context is recovered from the model's *own* counterfactual
34
+ behavior over unlabeled images, with no captions, bounding boxes, labels, reward
35
+ models, verifiers, or teacher models at any stage.
36
+
37
+ The key insight is that a region carries useful privileged information when zooming
38
+ into it *changes and sharpens* the model's answer distribution, while erasing it
39
+ leaves the full-image behavior largely unchanged. Such regions are **visual blind
40
+ spots**: the model can already perceive them, but fails to exploit them under
41
+ full-image conditioning.
42
+
43
+ - **Phase 1 — Counterfactual Blind-Spot Discovery.** The model generates its own
44
+ fine-grained question and probe answer per image, proposes candidate regions from
45
+ three tracks (self-grounding, a 3x3 grid, and a 2x2 grid), and keeps only regions
46
+ passing a three-gate Counterfactual Criterion: latent capability divergence
47
+ (the crop moves the answer distribution), default perceptual invariance (the
48
+ ghosted image does not), and epistemic sharpening (the crop lowers entropy).
49
+ - **Phase 2 — Contrastive Self-Distillation.** Each retained region instantiates
50
+ four policies from the same backbone: an online student, a crop-conditioned
51
+ positive teacher, a ghost-conditioned negative teacher, and a frozen reference
52
+ policy. The student is pulled toward the crop teacher (latent transfer), pushed
53
+ away from the ghost teacher (contrastive ranking, margin `m=0.1`), and anchored
54
+ to the reference policy (adaptive KL, target `0.03`).
55
+
56
+ ## Usage
57
+
58
+ This is a LoRA adapter, so load the base model first and attach the adapter:
59
+
60
+ ```python
61
+ import torch
62
+ from PIL import Image
63
+ from transformers import AutoModelForImageTextToText, AutoProcessor
64
+ from peft import PeftModel
65
+
66
+ BASE = "Qwen/Qwen3-VL-4B-Instruct"
67
+ ADAPTER = "shravvvv/CVPD"
68
+
69
+ model = AutoModelForImageTextToText.from_pretrained(BASE, dtype=torch.bfloat16, device_map="auto")
70
+ model = PeftModel.from_pretrained(model, ADAPTER)
71
+ processor = AutoProcessor.from_pretrained(ADAPTER)
72
+ model.eval()
73
+
74
+ image = Image.open("example.jpg").convert("RGB")
75
+ messages = [{"role": "user", "content": [
76
+ {"type": "image", "image": image},
77
+ {"type": "text", "text": "What is the text written on the sign?"},
78
+ ]}]
79
+ text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
80
+ inputs = processor(text=[text], images=[image], return_tensors="pt").to(model.device)
81
+
82
+ with torch.inference_mode():
83
+ out = model.generate(**inputs, max_new_tokens=128)
84
+ print(processor.batch_decode(out[:, inputs["input_ids"].shape[1]:], skip_special_tokens=True)[0])
85
+ ```
86
+
87
+ ## Results (Qwen3-VL-4B-Instruct)
88
+
89
+ | Benchmark | Base | CVPD |
90
+ | --- | --- | --- |
91
+ | OCRBench | 81.70 | 84.35 |
92
+ | MMStar Fine-Grained Perception | 60.86 | 63.35 |
93
+ | MMStar Logical Reasoning | 62.96 | 65.25 |
94
+ | MMStar Instance Reasoning | 69.83 | 71.20 |
95
+ | InfoVQA | 77.73 | 79.15 |
96
+ | ScienceQA | 87.51 | 89.05 |
97
+ | AI2D | 80.10 | 82.35 |
98
+ | CV-Bench | 85.45 | 87.15 |
99
+ | RealWorldQA | 71.24 | 73.45 |
100
+ | MMBench-EN | 83.51 | 84.60 |
101
+ | MME-Perception | 1702.9 | 1715.5 |
102
+ | SEED-Image | 78.05 | 78.20 |
103
+
104
+ The largest gains appear on benchmarks requiring precise localized attention —
105
+ OCRBench (+2.65), MMStar Fine-Grained Perception (+2.49), and MMStar Logical
106
+ Reasoning (+2.29). CVPD is the only method in our comparison that improves over
107
+ the base model on every benchmark without regressing on any, at both the 4B and
108
+ 8B scales. Full results, ablations, and the 8B model are in our paper.
109
+
110
+ ## Training
111
+
112
+ - Base: `Qwen/Qwen3-VL-4B-Instruct`, vision encoder frozen.
113
+ - LoRA: `r=32`, `alpha=64` on the attention and MLP projections of the language model backbone.
114
+ - Optimizer: AdamW, `lr=2e-5`, weight decay `0.01`, gradient clipping `1.0`, bfloat16.
115
+ - Objective: latent transfer + contrastive ranking (`lambda_rank=0.5`, margin `m=0.1`)
116
+ + KL anchor (`beta_0=1e-3`, adapted online to target KL `kappa=0.03`).
117
+ - Momentum teacher pair via EMA of the LoRA parameters (`alpha=0.05`).
118
+ - Discovery thresholds: `tau_crop = tau_ghost = 0.05`. All views resized to 448x448.
119
+ - Data: 15,000 raw, unlabeled images (10,000 natural-scene + 5,000 reasoning-domain),
120
+ yielding ~2,590 curated blind-spot tuples (17.2% pass rate). No captions,
121
+ bounding boxes, labels, answers, or reward signals are used at any stage.
122
+
123
+ ## License
124
+
125
+ Apache 2.0.
126
+
127
+ ## Citation
128
+
129
+ ```bibtex
130
+ @article{venkatraman2026cvpd,
131
+ title = {Perception Before Supervision: Self-Contained Visual Distillation
132
+ from Counterfactual Blind Spots},
133
+ author = {Venkatraman, Shravan and Thawakar, Omkar and Thawkar, Ritesh and
134
+ Shaker, Abdelrahman and Anwer, Rao Muhammad},
135
+ year = {2026}
136
+ }
137
+ ```