Safetensors
llava_qwen
rortegaeai commited on
Commit
40842ee
·
verified ·
1 Parent(s): 6890a01

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +288 -72
README.md CHANGED
@@ -4,77 +4,293 @@ datasets:
4
  - expertailab/scigram_dataset
5
  ---
6
 
7
- ## Model Summary
8
-
9
- | Property | Details |
10
- |---|---|
11
- | **Model name** | SciGram-7B |
12
- | **Model family** | LLaVA-SciGram |
13
- | **Model type** | Vision-Language Model (VLM) |
14
- | **Architecture** | LLaVA-style architecture |
15
- | **Language model** | Qwen2-Instruct 7B |
16
- | **Vision encoder** | CLIP |
17
- | **Parameters** | ~8B |
18
- | **Primary task** | Scientific diagram understanding |
19
- | **Input** | Image + text instruction/question |
20
- | **Output** | Natural-language answer |
21
- | **Training data** | SciGram |
22
- | **Scientific diagrams** | 194,071 |
23
- | **Multimodal instructions** | ~1.4M |
24
- | **Domains** | Life, Earth, and Physical Sciences |
25
- | **Training stages** | Visual-language alignment → visual instruction tuning → scientific QA fine-tuning |
26
- | **Alignment data** | SciGram-Align (582,213 examples) |
27
- | **Instruction-tuning data** | SciGram-VIT (737,887 examples) |
28
- | **Scientific QA data** | SciGram-M³ (47,506 examples) |
29
- | **License** | CC BY 4.0 |
30
- | **Repository** | `expertailab/scigram-7b` |
31
- | **Paper** | *From Terminology to Diagrams: Visual-Instruction Generation for Scientific Diagram Understanding* |
32
- | **Authors** | Raul Ortega, José Manuel Gómez-Pérez |
33
- | **Venue** | COLM 2026 |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
  ## Evaluation
36
- ### TQA
37
- | Question type | LLaVA-SciGram 7B (Acc.) |
38
- |---|---:|
39
- | Text-only | 90.87 |
40
- | True/False | 92.00 |
41
- | Diagram | 76.68 |
42
- | **Overall** | **83.66** |
43
-
44
-
45
- ### ScienceQA
46
- | Question type | LLaVA-SciGram 7B (Acc.) |
47
- |---|---:|
48
- | Natural Sciences | 96.27 |
49
- | Social Sciences | 97.53 |
50
- | Language | 91.64 |
51
- | Text Support | 99.11 |
52
- | Visual Support | 95.24 |
53
- | No Support | 93.38 |
54
- | Grade 1-6 | 95.49 |
55
- | Grade 7-12 | 95.06 |
56
- | **Overall** | **95.33** |
57
-
58
-
59
- ### AI2D
60
- | Question type | LLaVA-SciGram 7B (Acc.) |
61
- |---|---:|
62
- | Opaque labels | 80.21 |
63
- | Transparent labels | 89.93 |
64
- | **Overall** | **85.07** |
65
-
66
-
67
- ## Training
68
-
69
- | Stage | Dataset | Method | Epochs | Learning rate |
70
- |---|---|---|---:|---:|
71
- | **1. Alignment** | SciGram-Align | Train projection matrix; vision encoder and LLM frozen | 1 | 1e-3 |
72
- | **2. Instruction tuning** | SciGram-VIT | LoRA | 1 | 1e-5 |
73
- | **3. Scientific QA fine-tuning** | SciGram-M³ | LoRA | 3 | 1e-5 |
74
-
75
- ## Training Hardware
76
-
77
- | Property | Details |
78
- |---|---|
79
- | **GPUs** | 2 × NVIDIA A100 |
80
- | **Training time** | ~450 GPU-hours |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  - expertailab/scigram_dataset
5
  ---
6
 
7
+ # SciGram-7B
8
+
9
+ SciGram-7B is a 7B-class vision-language model specialized in understanding **scientific diagrams**. It is based on a LLaVA-style architecture with a pretrained CLIP vision encoder and a Qwen2-Instruct 7B language model, and is trained on SciGram, a large-scale dataset of scientific diagrams and synthetic visual instructions covering life, earth, and physical sciences.
10
+
11
+ The model is designed for multimodal understanding tasks involving scientific diagrams, including diagram question answering, visual grounding, diagram description, and science-related visual reasoning.
12
+
13
+ SciGram-7B corresponds to the **LLaVA-SciGram 7B** model described in:
14
+
15
+ > Raul Ortega and José Manuel Gómez-Pérez. *From Terminology to Diagrams: Visual-Instruction Generation for Scientific Diagram Understanding*. Proceedings of the Conference on Language Modeling (COLM 2026).
16
+
17
+ ## Model Details
18
+
19
+ ### Model Description
20
+
21
+ SciGram-7B is a vision-language model trained to improve scientific diagram understanding. It uses a pretrained CLIP vision encoder together with a Qwen2-Instruct 7B language model. The model is trained using three SciGram training stages: SciGram-Align, SciGram-VIT, and SciGram-M³.
22
+
23
+ The training data contains scientific diagrams paired with synthetic captions and multiple-choice visual instructions covering life sciences, earth sciences, and physical sciences.
24
+
25
+ The model is intended primarily for research on scientific diagram understanding and multimodal scientific question answering.
26
+
27
+ - **Developed by:** Expert.ai Language Technology Research Laboratory
28
+ - **Authors:** Raul Ortega and José Manuel Gómez-Pérez
29
+ - **Shared by:** Expert.ai Language Technology Research Laboratory
30
+ - **Model type:** Vision-language model (VLM)
31
+ - **Architecture:** LLaVA-Qwen
32
+ - **Language(s):** English
33
+ - **License:** CC BY 4.0
34
+ - **Vision encoder:** Pretrained CLIP vision encoder
35
+ - **Language model:** Qwen2-Instruct 7B
36
+ - **Model format:** Safetensors, FP16
37
+ - **Maximum context length:** 32,768 tokens
38
+
39
+ The released checkpoint contains approximately 8B parameters and is approximately 16.3 GB in size.
40
+
41
+ ### Model Sources
42
+
43
+ - **Repository:** https://huggingface.co/expertailab/scigram-7b
44
+ - **Dataset:** https://huggingface.co/datasets/expertailab/scigram_dataset
45
+ - **Paper:** https://arxiv.org/abs/2609.00948
46
+ - **Demo:** No official demo is currently provided.
47
+
48
+ ## How to Get Started with the Model
49
+
50
+ The model is released using the LLaVA-Qwen architecture. It can be loaded using a compatible LLaVA implementation and the Hugging Face checkpoint.
51
+
52
+ A typical workflow is:
53
+
54
+ ```python
55
+ from transformers import AutoProcessor, AutoModel
56
+ from PIL import Image
57
+ import torch
58
+
59
+ model_id = "expertailab/scigram-7b"
60
+
61
+ processor = AutoProcessor.from_pretrained(model_id)
62
+ model = AutoModel.from_pretrained(
63
+ model_id,
64
+ torch_dtype=torch.float16,
65
+ device_map="auto",
66
+ )
67
+
68
+ image = Image.open("scientific_diagram.png").convert("RGB")
69
+
70
+ prompt = "What does this scientific diagram show? Explain the main components and their relationships."
71
+
72
+ inputs = processor(
73
+ images=image,
74
+ text=prompt,
75
+ return_tensors="pt"
76
+ ).to(model.device)
77
+
78
+ with torch.no_grad():
79
+ output = model.generate(
80
+ **inputs,
81
+ max_new_tokens=512,
82
+ )
83
+
84
+ answer = processor.batch_decode(
85
+ output,
86
+ skip_special_tokens=True
87
+ )[0]
88
+
89
+ print(answer)
90
+ ```
91
+
92
+ The model repository contains a `LlavaProcessor` configuration and uses the Qwen2 tokenizer with the special `<image>` token. For reproducible benchmark evaluation,
93
+ users should follow the prompts and evaluation procedure described in the paper rather than relying on the generation defaults.
94
+
95
+ ## Training Details
96
+
97
+ ### Training Data
98
+
99
+ SciGram-7B was trained using the three SciGram subsets:
100
+
101
+ 1. **SciGram-Align:** 582,213 image-caption instruction pairs used for visual-language alignment.
102
+ 2. **SciGram-VIT:** 737,887 diagram-based multiple-choice instruction examples.
103
+ 3. **SciGram-M³:** 47,506 examples curated from TQA, ScienceQA, OpenBookQA, and ARC-Easy/Challenge.
104
+
105
+ Together, these subsets contain approximately 1.37 million training instructions.
106
+
107
+ The complete SciGram dataset contains 194,071 scientific diagrams and more than 1.4 million synthetic visual instructions. The diagrams cover life sciences, earth sciences, and physical sciences.
108
+
109
+ The dataset construction pipeline extracts scientific terminology from middle-school science curricula, generates atomic scientific facts, retrieves candidate diagrams from the web, filters and deduplicates the retrieved images, and generates captions and multiple-choice questions using a vision-language model.
110
+
111
+ The instruction-generation process used Qwen2-VL-7B to generate captions and diagram-grounded multiple-choice questions.
112
+
113
+ ### Training Procedure
114
+
115
+ SciGram-7B was trained using a LLaVA-style three-stage training pipeline:
116
+
117
+ 1. **Alignment:** The multimodal projection/alignment components are trained using SciGram-Align while the relevant pretrained components are kept frozen.
118
+ 2. **Visual Instruction Tuning:** LoRA fine-tuning is performed on SciGram-VIT.
119
+ 3. **Further Fine-tuning:** The resulting model is further fine-tuned with LoRA on SciGram-M³.
120
+
121
+ The model was trained on two NVIDIA A100 GPUs for approximately 450 GPU-hours.
122
+
123
+
124
+ ### Preprocessing
125
+
126
+ The model follows the LLaVA image-processing and multimodal training pipeline.
127
+
128
+ For the visual instruction tuning and further fine-tuning stages, the training configuration uses an any-resolution image processing strategy and the following image grid pinpoints:
129
+
130
+ ```text
131
+ (384, 768)
132
+ (768, 384)
133
+ (768, 768)
134
+ (1152, 384)
135
+ (384, 1152)
136
+ ```
137
+
138
+ The multimodal projector uses an MLP with two GELU layers (`mlp2x_gelu`), and the selected vision feature layer is `-2`.
139
+
140
+ ### Training Hyperparameters
141
+
142
+ **Alignment stage — SciGram-Align**
143
+
144
+ - Epochs: 1
145
+ - Batch size: 4
146
+ - Learning rate: 1e-3
147
+ - Weight decay: 0
148
+ - Multimodal projector learning rate: 2e-5
149
+ - Maximum sequence length: 32,768
150
+
151
+ **Visual Instruction Tuning — SciGram-VIT**
152
+
153
+ - Epochs: 1
154
+ - LoRA rank: 128
155
+ - LoRA alpha: 256
156
+ - Batch size: 1
157
+ - Gradient accumulation steps: 16
158
+ - Learning rate: 1e-5
159
+ - Weight decay: 0
160
+ - Warmup ratio: 0.03
161
+ - Scheduler: cosine
162
+ - Maximum sequence length: 32,768
163
+ - Multimodal projector learning rate: 2e-5
164
+
165
+ **Further Fine-tuning — SciGram-M³**
166
+
167
+ - Epochs: 3
168
+ - LoRA rank: 128
169
+ - LoRA alpha: 256
170
+ - Batch size: 1
171
+ - Gradient accumulation steps: 16
172
+ - Learning rate: 1e-5
173
+ - Weight decay: 0
174
+ - Warmup ratio: 0.03
175
+ - Scheduler: cosine
176
+ - Maximum sequence length: 32,768
177
+ - Multimodal projector learning rate: 2e-5
178
+
179
+ ## Speeds, Sizes, Times
180
+
181
+ - **Training hardware:** 2 × NVIDIA A100 GPUs
182
+ - **Training compute:** approximately 450 GPU-hours
183
+ - **Parameter count:** approximately 8B
184
+ - **Maximum sequence length:** 32,768 tokens
185
 
186
  ## Evaluation
187
+
188
+ ### Testing Data, Factors & Metrics
189
+
190
+ #### Testing Data
191
+
192
+ SciGram-7B was evaluated on three scientific multimodal question-answering benchmarks:
193
+
194
+ - **TQA (Textbook Question Answering):** includes text-only, true/false, and diagram-grounded questions across physical, life, and earth sciences.
195
+ - **ScienceQA (SQA):** contains multimodal science questions covering elementary and high-school science curricula.
196
+ - **AI2D:** contains grade-school science diagrams paired with multiple-choice questions, including evaluations with opaque and transparent diagram labels.
197
+
198
+ #### Metrics
199
+
200
+ The primary evaluation metric is **accuracy (%)**, computed as the proportion of correctly answered multiple-choice questions.
201
+
202
+ ### Results
203
+
204
+ The reported results for LLaVA-SciGram 7B are:
205
+
206
+ | Benchmark | Subset | Accuracy |
207
+ |---|---|---:|
208
+ | TQA | Text MC | 90.87 |
209
+ | TQA | True/False | 92.00 |
210
+ | TQA | Diagram MC | 76.68 |
211
+ | TQA | Overall | 83.66 |
212
+ | ScienceQA | Natural Sciences | 96.27 |
213
+ | ScienceQA | Social Sciences | 97.53 |
214
+ | ScienceQA | Language | 91.64 |
215
+ | ScienceQA | Text | 99.11 |
216
+ | ScienceQA | Visual/Image Support | 95.24 |
217
+ | ScienceQA | No Support | 93.38 |
218
+ | ScienceQA | Grade 1–6 | 95.49 |
219
+ | ScienceQA | Grade 7–12 | 95.06 |
220
+ | ScienceQA | Overall | 95.33 |
221
+ | AI2D | Opaque Labels | 80.21 |
222
+ | AI2D | Transparent Labels | 89.93 |
223
+ | AI2D | Overall | 85.07 |
224
+
225
+ ## Technical Specifications
226
+
227
+ ### Model Architecture and Objective
228
+
229
+ SciGram-7B uses a LLaVA-Qwen multimodal architecture.
230
+
231
+ The model consists of:
232
+
233
+ - **Architecture:** `LlavaQwenForCausalLM`
234
+ - **Language backbone:** Qwen2-Instruct 7B
235
+ - **Vision encoder:** pretrained CLIP vision encoder
236
+ - **Multimodal projector:** 2-layer MLP with GELU activation
237
+ - **Image processing:** LLaVA-style image processing
238
+ - **Maximum sequence length:** 32,768
239
+
240
+ -
241
+ - **Architecture:** `LlavaQwenForCausalLM`
242
+ - **Language backbone:** `Qwen/Qwen2-7B-Instruct`
243
+ - **Vision encoder:** `openai/clip-vit-large-patch14-336`
244
+ - **Multimodal projector:** 2-layer MLP with GELU activation
245
+ - **Image processing:** Any-resolution (`anyres`)
246
+ - **Maximum sequence length:** 32,768
247
+ - **Data type:** FP16
248
+ - **Attention implementation:** SDPA
249
+ - **Model objective:** Autoregressive multimodal language modeling
250
+
251
+
252
+ ## Compute Infrastructure
253
+
254
+ Training was performed using two NVIDIA A100 GPUs and required approximately 450 GPU-hours.
255
+
256
+ ### Hardware
257
+
258
+ - 2 × NVIDIA A100 GPUs
259
+
260
+ ### Software
261
+
262
+ The released checkpoint is compatible with the LLaVA-Qwen architecture.
263
+
264
+ The associated environment includes:
265
+
266
+ - srsly~=2.5.1
267
+ - nltk~=3.9.1
268
+ - flair~=0.15.1
269
+ - transformers~=4.56.2
270
+ - tqdm~=4.67.1
271
+ - numpy~=2.3.3
272
+ - torch~=2.8.0
273
+ - textdistance~=4.6.3
274
+ - datasets~=4.1.1
275
+ - pillow~=11.3.0
276
+
277
+ ## Citation
278
+
279
+ If you use SciGram-7B or the SciGram dataset, please cite the accompanying paper:
280
+
281
+ **BibTeX:**
282
+
283
+ @inproceedings{ortega2026terminology,
284
+ title = {From Terminology to Diagrams: Visual-Instruction Generation for Scientific Diagram Understanding},
285
+ author = {Ortega, Raúl and Gómez-Pérez, José Manuel},
286
+ booktitle = {Proceedings of the Conference on Language Modeling (COLM)},
287
+ year = {2026}
288
+ }
289
+
290
+ **APA:**
291
+
292
+ Ortega, R., & Gómez-Pérez, J. M. (2026). *From Terminology to Diagrams: Visual-Instruction Generation for Scientific Diagram Understanding*. Proceedings of the Conference on Language Modeling (COLM 2026).
293
+
294
+ ## Model Card Contact
295
+
296
+ For questions concerning the model or dataset, please contact rortega@expert.ai or jmgomez@expert.ai.