zenithli commited on
Commit
d7aed9f
Β·
verified Β·
1 Parent(s): cb37e24

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +59 -131
README.md CHANGED
@@ -16,190 +16,118 @@ tags:
16
 
17
  # ZwZ2-4B
18
 
19
- ### From Seeing Details to Connecting Visual Evidence
 
 
 
20
 
21
- **ZwZ2 releases:** [4B](https://huggingface.co/inclusionAI/ZwZ2-4B) Β· [9B](https://huggingface.co/inclusionAI/ZwZ2-9B) Β· [27B](https://huggingface.co/inclusionAI/ZwZ2-27B) Β· [Dataset](https://huggingface.co/datasets/inclusionAI/ZwZ2-RL-VQA)
22
 
23
- **First-generation ZwZ:** [Paper](https://huggingface.co/papers/2602.11858) Β· [Code](https://github.com/inclusionAI/Zooming-without-Zooming) Β· [Collection](https://huggingface.co/collections/inclusionAI/zooming-without-zooming)
24
 
25
- ## Model Summary
26
 
27
- **ZwZ2-4B** is a vision-language model built on **Qwen3.5-4B**, released as part of the 4B/9B/27B Zooming-without-Zooming-v2 family. As the second generation of **Zooming without Zooming**, it extends fine-grained perception from recognizing local details to **connecting evidence**: locating relevant visual facts, binding them to the right entities, recovering their relations, and composing them into an answer.
28
 
29
- We introduce **EvidenceConnect**, a data synthesis framework that uses privileged, zoomed views of related regions within a single image to construct questions requiring comparison, aggregation, matching, or multi-step composition. Independent VLM answer agreement and drop-one region tests assess answer reliability and evidence dependence. Verified questions are converted into multiple-choice form and paired with full-image policy views for reinforcement learning with verifiable rewards (**RLVR**), using **GRPO** without an additional supervised fine-tuning stage.
30
 
31
- Although trained on single images, **ZwZ2-4B** improves over **Qwen3.5-4B** on all **25 evaluated benchmarks across six domains**. Its overall average increases from **49.41 to 54.79 (+5.39 percentage points)**. Improvements extend from fine-grained and spatial perception to multimodal long-context understanding, embodied spatial reasoning, multimodal agents, and general visual reasoning.
 
 
32
 
33
- Individual benchmark scores are accuracies (%) from the second-generation manuscript; domain means and overall scores follow the latest 25-benchmark results table; Ξ” denotes absolute percentage-point improvement over the corresponding backbone. Domain averages are unweighted within each domain. Overall follows the latest 25-benchmark results table; it is not a mean of the six domain scores.
34
 
35
- ### Performance Highlights
36
 
37
- ![ZwZ2-4B, ZwZ2-9B and ZwZ2-27B on eight representative benchmarks](assets/zwz2_performance_highlights.png)
38
 
39
- Accuracy (%) on eight representative benchmarks: ZoomBench, Perception-Bench, MMSI-Bench, SPAR-Bench, MileBench, ERQA, ViewSpatial-Bench, and MMStar. Full 25-benchmark results are below; overall scores for ZwZ2-4B / 9B / 27B are 54.79 / 56.59 / 60.51.
40
-
41
- [View vector PDF](assets/zwz2_performance_highlights_editable.pdf)
42
-
43
- <!-- RESULTS_IMAGE_START -->
44
- ### Benchmark Results
45
 
46
  ![All 25 benchmark results](assets/zwz2_4b_results.png)
47
 
48
- [View full-resolution table](assets/zwz2_4b_results.png)
49
-
50
- <!-- RESULTS_IMAGE_END -->
51
-
52
- **Evaluation scope.** **MMLongBench\*** denotes the visual-core aggregate of **25 non-Counting tasks from V-RAG, Image MM-NIAH, and VH-Multi**, not the full benchmark. Starred entries use the subset or aggregate specified in the manuscript.
53
-
54
- ## Key Features
55
-
56
- - πŸ” **From Details to Evidence Connections:** Learn to compare, aggregate, and compose facts across related regions, beyond recognizing individual visual details.
57
- - 🎯 **Verified Visual Supervision:** Cross-model answer checks and region-ablation tests filter unreliable labels and questions that do not depend sufficiently on their selected evidence.
58
- - πŸ“ˆ **Broad Transfer from Single Images:** Improvements extend to long-context multimodal understanding, embodied spatial reasoning, and multimodal agents.
59
- - ⚑ **Full-Image Inference:** The perception models operate on full-image inputs without requiring the privileged zoomed crop layouts used during data synthesis.
60
-
61
- ## How It Works
62
-
63
- Zooming-without-Zooming-v2 develops the training-time zooming principle of the first-generation ZwZ into **multi-region evidence connection**:
64
 
65
- 1. **Discover related evidence.** Screen visually rich images, propose localized regions, and group **3–7 regions** that jointly support a compositional question.
66
- 2. **Synthesize from privileged views.** Use zoomed region layouts to construct questions involving aggregation, comparison, matching, or dependency chains.
67
- 3. **Verify answers and evidence.** Retain reference answers supported by independent VLM families, and use drop-one tests to assess whether the selected regions are needed.
68
- 4. **Build the policy-view task.** Convert each verified question into four-option MCQ form. The training model receives the full image with colored region outlines identifying the referenced regions, rather than the privileged zoomed layouts.
69
- 5. **Train with verifiable rewards.** Apply GRPO directly to the base VLM, rewarding the correct final option letter. Privileged crops are used in data construction, not supplied as additional training-time policy observations.
70
 
71
- ## Quickstart
72
-
73
- ### Installation
74
-
75
- Install a hardware-compatible PyTorch build first, then the inference dependencies:
76
 
77
  ```bash
78
  pip install "transformers==5.13.1" accelerate pillow
 
 
79
  ```
80
 
81
- The example targets Transformers 5.13.1. All three sizes use `Qwen3_5ForConditionalGeneration`, including the Qwen3.6-27B backbone. Use sufficient accelerator memory for the selected model; `device_map="auto"` distributes weights across the available devices. See the [Transformers Qwen3.5 documentation](https://huggingface.co/docs/transformers/model_doc/qwen3_5).
82
-
83
- Keep the weights, processor, tokenizer, and `chat_template.jinja` in the same downloaded model directory.
84
-
85
- ### Inference
86
-
87
- Set `MODEL_PATH` to the downloaded model directory and `IMAGE_PATH` to an existing image file:
88
-
89
- ```bash
90
- export MODEL_PATH="/absolute/path/to/ZwZ2-4B"
91
- export IMAGE_PATH="/absolute/path/to/image.jpg"
92
- ```
93
 
94
  ```python
95
  import os
96
- import re
97
  from pathlib import Path
98
  import torch
99
- from transformers import Qwen3_5ForConditionalGeneration, AutoProcessor
100
 
101
  model_path = os.environ["MODEL_PATH"]
102
- assert Path(model_path, "config.json").is_file(), "MODEL_PATH must be a model directory"
103
- assert Path(os.environ["IMAGE_PATH"]).is_file(), "IMAGE_PATH must be an existing image"
104
  processor = AutoProcessor.from_pretrained(model_path)
105
- # Preserve the training template, including its default answer-tag instruction.
106
- processor.chat_template = Path(model_path, "chat_template.jinja").read_text(encoding="utf-8")
107
  model = Qwen3_5ForConditionalGeneration.from_pretrained(
108
- model_path,
109
- dtype=torch.bfloat16,
110
- device_map="auto",
111
  ).eval()
112
 
113
- messages = [{
114
- "role": "user",
115
- "content": [
116
- {"type": "image", "url": os.environ["IMAGE_PATH"]},
117
- {"type": "text", "text": "Describe the relevant objects and their spatial relationships."},
118
- ],
119
- }]
120
  inputs = processor.apply_chat_template(
121
- messages,
122
- tokenize=True,
123
- add_generation_prompt=True,
124
- return_dict=True,
125
- return_tensors="pt",
126
- enable_thinking=False,
127
  ).to(model.device)
128
 
129
  with torch.inference_mode():
130
- generated = model.generate(
131
- **inputs,
132
- max_new_tokens=2048,
133
- do_sample=False,
134
- )
135
-
136
- completion = generated[:, inputs["input_ids"].shape[1]:]
137
  response = processor.batch_decode(
138
- completion, skip_special_tokens=True
139
  )[0]
140
  print(response)
141
-
142
- # Final-answer extraction; this also supports non-MCQ answers.
143
- matches = re.findall(r"<answer>(.*?)</answer>", response, flags=re.S)
144
- if matches:
145
- print("Final answer:", matches[-1].strip())
146
- else:
147
- print("No <answer> tag found; inspect the raw response above.")
148
  ```
149
 
150
- Use a plain local image path, not a `file://` URI. The example uses **non-thinking mode** explicitly. The packaged template supplies the default training instruction, including the `<answer>...</answer>` final-answer convention. Supplying a custom system message replaces that default instruction. The example's output budget is for demonstration; benchmark reproduction uses benchmark-specific generation settings.
151
 
152
- <details>
153
- <summary><strong>Multiple-image input and answer extraction</strong></summary>
154
 
155
- Multiple-image questions use the same message format: place the image items in their intended order, followed by the text question. Let the processor insert visual tokens; do not manually add another set of `<image>` tokens to structured messages.
156
 
157
- For multiple-choice tasks, the training label is a bare letter, e.g. `A`, while the response convention is `<answer>A</answer>`. Extract the tagged answer before comparing it with the label. Record malformed, conflicting, or truncated responses explicitly. Benchmark adapters may have their own answer-extraction policies, which should be preserved when reproducing reported results.
 
 
 
 
158
 
159
- Non-thinking mode disables the dedicated thinking channel, but does not guarantee that the model never generates explanatory text. Multi-image capacity and usable context depend on model configuration, image tokenization, runtime limits, and available memory.
160
 
161
- </details>
 
 
 
162
 
163
- ## Training Data
164
 
165
- Zooming-without-Zooming-v2 is trained on approximately **20K EvidenceConnect examples** synthesized from **SA-1B** images. The questions connect evidence across regions within a single image and end in four-option answers suitable for rule-based rewards.
166
 
167
- The policy receives full-image views; zoomed crops provide privileged information during data construction. The data are designed around transferable evidence-connection skills rather than downstream benchmark-specific formats. The models are post-trained with **GRPO**, without an additional supervised fine-tuning stage.
168
 
169
- This second-generation dataset is distinct from the first-generation **ZwZ-RL-VQA** dataset.
170
 
171
- ## Model Family
172
 
173
- | Release | Backbone |
174
  |---|---|
175
- | ZwZ2-4B | Qwen3.5-4B |
176
- | ZwZ2-9B | Qwen3.5-9B |
177
- | ZwZ2-27B | Qwen3.6-27B |
178
-
179
- This repository contains **ZwZ2-4B**. The three sizes share the EvidenceConnect research framework; results and runtime requirements should be interpreted for the specific checkpoint.
180
-
181
- ## Related Work
182
-
183
- The following citation refers to the **first generation**, not the second-generation manuscript:
184
-
185
- ```bibtex
186
- @article{wei2026zooming,
187
- title={Zooming without Zooming: Region-to-Image Distillation for Fine-Grained Multimodal Perception},
188
- author={Wei, Lai and He, Liangbo and Lan, Jun and Dong, Lingzhong and Cai, Yutong and Li, Siyuan and Zhu, Huijia and Wang, Weiqiang and Kong, Linghe and Wang, Yue and Zhang, Zhuosheng and Huang, Weiran},
189
- journal={arXiv preprint arXiv:2602.11858},
190
- year={2026}
191
- }
192
- ```
193
-
194
- ## License
195
-
196
- Please refer to the license accompanying the released weights and the applicable backbone license for usage terms.
197
 
198
- <details>
199
- <summary><strong>Limitations and evaluation notes</strong></summary>
200
 
201
- This model can hallucinate details, misread text, and make counting or spatial-relation errors. Automated synthesis checks reduce label noise but do not remove it completely. Performance varies with image resolution, visual complexity, context length, and prompt format.
202
 
203
- Individual benchmark results are from Table 1 of the second-generation manuscript; domain means and overall scores follow the latest 25-benchmark results table. Overall is reported as provided in the latest 25-benchmark results table. The listed backbones, task subsets, reasoning mode, image processing, generation limits, and scoring rules must be matched for reproducible comparisons. The quickstart is an inference example, not a reproduction script.
204
 
205
- </details>
 
16
 
17
  # ZwZ2-4B
18
 
19
+ <!-- Replace PAPER_URL, PROJECT_URL, and COLLECTION_URL with the final v2 URLs. -->
20
+ <p align="center">
21
+ πŸ“ƒ <a href="PAPER_URL">Paper</a> | 🏠 <a href="PROJECT_URL">Project</a> | πŸ€— <a href="COLLECTION_URL">Collection</a>
22
+ </p>
23
 
24
+ ## ✨ Model Summary
25
 
26
+ **ZwZ2-4B** is the **Qwen3.5-4B**-based model in **Zooming-without-Zooming-v2 (ZwZ2)**. It learns to connect visual evidence across regions through comparison, aggregation, matching, and multi-step reasoning. Training uses full images; inference requires no zooming tools.
27
 
28
+ On **25 benchmarks across six domains**, it improves over its base model on every benchmark, increasing overall accuracy from **49.41 to 54.79 (+5.39 points)**. Gains extend from fine-grained perception to spatial reasoning, long-context understanding, multimodal agents, and general visual reasoning.
29
 
30
+ ## βš™οΈ Method and Data
31
 
32
+ **EvidenceConnect** builds verified multi-region questions from SA-1B images:
33
 
34
+ 1. Group 3–7 related regions and generate questions using privileged zoomed views.
35
+ 2. Check answers through cross-model agreement and drop-one region tests.
36
+ 3. Convert verified questions to four-option tasks and train with **GRPO**, without an additional supervised fine-tuning stage.
37
 
38
+ All three model sizes use approximately **20K training examples**. The policy sees full images with colored region outlines; privileged crop layouts are used only for data construction. See [ZwZ2-RL-VQA](https://huggingface.co/datasets/inclusionAI/ZwZ2-RL-VQA) for the data schema and synthesis process.
39
 
40
+ ## πŸ“Š Performance
41
 
42
+ ![ZwZ2 performance on eight representative benchmarks](assets/zwz2_performance_highlights.png)
43
 
44
+ [Editable vector PDF](assets/zwz2_performance_highlights_editable.pdf). The figure shows eight representative benchmarks; the complete results follow.
 
 
 
 
 
45
 
46
  ![All 25 benchmark results](assets/zwz2_4b_results.png)
47
 
48
+ [Full-resolution results](assets/zwz2_4b_results.png). Scores are accuracies (%); domain and overall averages weight the corresponding benchmarks equally. **MMLongBench\*** uses the visual core: V-RAG, Image MM-NIAH, and VH-Multi, comprising **25 non-Counting tasks**. Advanced-model image resolution is constrained by their serving platforms.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
+ ## πŸš€ Getting Started
 
 
 
 
51
 
52
+ Install a hardware-compatible PyTorch build, then:
 
 
 
 
53
 
54
  ```bash
55
  pip install "transformers==5.13.1" accelerate pillow
56
+ export MODEL_PATH="/path/to/ZwZ2-4B"
57
+ export IMAGE_PATH="/path/to/image.jpg"
58
  ```
59
 
60
+ Keep the weights, processor, tokenizer, and `chat_template.jinja` together. All three sizes use `Qwen3_5ForConditionalGeneration`, including the Qwen3.6-27B-based model.
 
 
 
 
 
 
 
 
 
 
 
61
 
62
  ```python
63
  import os
 
64
  from pathlib import Path
65
  import torch
66
+ from transformers import AutoProcessor, Qwen3_5ForConditionalGeneration
67
 
68
  model_path = os.environ["MODEL_PATH"]
 
 
69
  processor = AutoProcessor.from_pretrained(model_path)
70
+ processor.chat_template = Path(model_path, "chat_template.jinja").read_text()
 
71
  model = Qwen3_5ForConditionalGeneration.from_pretrained(
72
+ model_path, dtype=torch.bfloat16, device_map="auto"
 
 
73
  ).eval()
74
 
75
+ messages = [{"role": "user", "content": [
76
+ {"type": "image", "url": os.environ["IMAGE_PATH"]},
77
+ {"type": "text", "text": "Describe the objects and their spatial relationships."},
78
+ ]}]
 
 
 
79
  inputs = processor.apply_chat_template(
80
+ messages, tokenize=True, add_generation_prompt=True,
81
+ return_dict=True, return_tensors="pt", enable_thinking=False,
 
 
 
 
82
  ).to(model.device)
83
 
84
  with torch.inference_mode():
85
+ output = model.generate(**inputs, max_new_tokens=2048, do_sample=False)
 
 
 
 
 
 
86
  response = processor.batch_decode(
87
+ output[:, inputs["input_ids"].shape[1]:], skip_special_tokens=True
88
  )[0]
89
  print(response)
 
 
 
 
 
 
 
90
  ```
91
 
92
+ Use the packaged template with **non-thinking mode**. Its default system instruction requests `<answer>...</answer>`; for MCQs, compare the extracted letter with the bare reference (e.g. `A`). A custom system message replaces that default instruction. For multiple images, add image entries in order and let the processor insert visual tokens. The 2,048-token output budget above is a demonstration setting; benchmark generation settings vary by task.
93
 
94
+ ## πŸ§ͺ Evaluation
 
95
 
96
+ From the released code repository, use the same **configure β†’ prepare β†’ evaluate** workflow:
97
 
98
+ ```bash
99
+ cd eval
100
+ python -m pip install -e '.[api,data]'
101
+ python -m zwz_eval init --directory local/my-eval --bench hr4k,hr8k
102
+ ```
103
 
104
+ Edit `local/my-eval/model.json` with your model/judge paths, GPU settings, and output directory, and `datasets.json` with the downloaded benchmark paths. Then run:
105
 
106
+ ```bash
107
+ bash scripts/prepare_benchmarks.sh local/my-eval
108
+ bash scripts/evaluate.sh local/my-eval
109
+ ```
110
 
111
+ See the code repository's `eval/README.md` for all 25 benchmark IDs and data requirements. Match its prompts, task selections, preprocessing, generation limits, and judging settings to reproduce the results.
112
 
113
+ ## πŸ“ Usage Notes
114
 
115
+ The Transformers example loads a downloaded model directory. Choose accelerator memory appropriate for the checkpoint; automatic device mapping distributes the weights but does not remove their memory requirements. Use an existing local image path in the example.
116
 
117
+ For multiple-choice evaluation, preserve the original question, option order, image order, and answer parser. Keep the complete raw response alongside the extracted answer so malformed or truncated responses remain inspectable. Benchmark scores are taken from the latest results table; the quickstart demonstrates inference rather than reproducing every benchmark configuration.
118
 
119
+ ## πŸ€— Models and Data
120
 
121
+ | Model | Base model |
122
  |---|---|
123
+ | [ZwZ2-4B](https://huggingface.co/inclusionAI/ZwZ2-4B) | Qwen3.5-4B |
124
+ | [ZwZ2-9B](https://huggingface.co/inclusionAI/ZwZ2-9B) | Qwen3.5-9B |
125
+ | [ZwZ2-27B](https://huggingface.co/inclusionAI/ZwZ2-27B) | Qwen3.6-27B |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
 
127
+ [πŸ€— ZwZ2-RL-VQA training dataset](https://huggingface.co/datasets/inclusionAI/ZwZ2-RL-VQA)
 
128
 
129
+ ## πŸ“„ Limitations and License
130
 
131
+ The model can hallucinate details, misread text, and make counting or spatial errors. Performance depends on image resolution, context length, and prompt format. Refer to the license accompanying the released weights and the applicable backbone license for usage terms.
132
 
133
+ **First-generation ZwZ:** [Paper](https://huggingface.co/papers/2602.11858) Β· [Code](https://github.com/inclusionAI/Zooming-without-Zooming).