Qwen2.5-VL-3B-ScienceQA-Math-CoT-Merged
This model is a fine-tuned vision-language architecture optimized for scientific reasoning, mathematical problem-solving, and Chain-of-Thought (CoT) generation. It is the fully merged version of the base model and its LoRA adapter. I integrated the adapter weights directly into the base parameters to allow for standalone execution without needing to load PEFT modules dynamically at runtime.
Model Details
- Base Model:
Qwen/Qwen2.5-VL-3B-Instruct - Task: Vision-Language Mathematical and Scientific Reasoning (ScienceQA)
- Architecture: Fully merged LoRA
- Precision:
bfloat16
Capabilities and Limitations
This model processes visual inputs like charts, diagrams, and scientific figures, generating step-by-step reasoning paths before outputting a final answer. It relies on the ScienceQA dataset structures to enforce logic.
This is not a generalized conversational agent, it is a highly specialized reasoning tool. You should double-check its mathematical outputs. Even with CoT enforcement, autoregressive generation can occasionally yield arithmetic hallucinations on complex edge cases.
Usage
You can run this model directly using standard transformers libraries. Loading it in bfloat16 is recommended to prevent VRAM overhead and maintain precision integrity.
import torch
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
from PIL import Image
import requests
model_id = "salihfurkaan/Qwen2.5-VL-3B-ScienceQA-Math-CoT"
# 1. Load processor and model
processor = AutoProcessor.from_pretrained(model_id)
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto"
)
# 2. Prepare the visual and text inputs
url = "[https://example.com/sample_physics_diagram.jpg](https://example.com/sample_physics_diagram.jpg)"
image = Image.open(requests.get(url, stream=True).raw)
prompt = "Analyze the provided diagram. Think step-by-step and calculate the final velocity."
messages = [
{
"role": "user",
"content": [
{"type": "image", "image": image},
{"type": "text", "text": prompt}
]
}
]
# 3. Process inputs
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = processor(text=[text], images=[image], return_tensors="pt", padding=True).to("cuda")
# 4. Generate the CoT response
generated_ids = model.generate(**inputs, max_new_tokens=1024)
generated_ids_trimmed = [
out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
output = processor.batch_decode(generated_ids_trimmed, skip_special_tokens=True)
print(output[0])
Training Specifications
The fine-tuning process utilized Low-Rank Adaptation (LoRA) to efficiently update the model's attention weights without altering the base Qwen2.5-VL parameters. The adapter was subsequently merged to reduce inference latency and simplify deployment pipelines.
- Frameworks:
peft,transformers,accelerate,torchao - Merge Configuration: Executed via
PeftModel.merge_and_unload() - Training Precision:
bfloat16to prevent precision degradation and maintain numerical stability. - Dataset: ScienceQA (specifically filtering for Mathematical and CoT structures).
Hardware & Software Requirements
To ensure stable execution and avoid Out-Of-Memory (OOM) errors, your deployment environment must meet the following criteria:
- Inference VRAM: Approximately 7GB to 9GB for
bfloat16precision. - Recommended Hardware: NVIDIA T4, RTX 3060, or any architecture with at least 12GB of VRAM.
- Environment: Fully compatible with Kaggle Notebooks, standard Jupyter instances, and containerized Docker deployments. Ensure
transformers >= 4.45.0is installed.
Citation
If you utilize this model in your research or autonomous backend architecture, please cite it as follows:
@misc{erik2026qwen25vlcot,
author = {salih furkan erik},
title = {Qwen2.5-VL-3B-ScienceQA-Math-CoT: A Merged Vision-Language Adapter for Scientific Reasoning},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{[https://huggingface.co/salihfurkaan/Qwen2.5-VL-3B-ScienceQA-Math-CoT](https://huggingface.co/salihfurkaan/Qwen2.5-VL-3B-ScienceQA-Math-CoT)}}
}
- Downloads last month
- 23
Model tree for salihfurkaan/Qwen2.5-VL-ScienceQA-Math-CoT-Merged
Base model
Qwen/Qwen2.5-VL-3B-Instruct