Downloads · 30 days
0
abhifdsdf/Qwen2.5-VL-FUNSD-Adversarial
Qwen2.5-VL-FUNSD-Adversarial is a machine learning model from abhifdsdf. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
0
Access
Public
Updated Jul 24, 2026
Repo size
1.1 GB
Likes
0
Public
Click a slice to open those files.
.safetensors892 MB · 69%
From the Hugging Face model README
This repository contains LoRA adapters for Qwen/Qwen2.5-VL-3B-Instruct, supervised fine-tuned on the FUNSD form-understanding dataset for structured key/value entity extraction ({Header, Question, Answer}), with explicit training and evaluation under simulated scanner/photo degradation (blur, noise, contrast shift, rotation).
bfloat16 compute dtype.paged_adamw_8bit, LR=0.0002, scheduler=cosine,
warmup_ratio=0.05, grad_accum_steps=4, max_grad_norm=1.0.| Metric | Clean Test Set | Adversarial Test Set (100% degraded) |
|---|---|---|
| Exact match rate | 0.0000 | 0.0000 |
| Char-level similarity | 0.2098 | 0.1565 |
| Entity precision | 1.0000 | 1.0000 |
| Entity recall | 1.0000 | 1.0000 |
| Entity F1 | 1.0000 | 1.0000 |
adapters/ — final LoRA adapter weights + processor config; load with PeftModel.from_pretrained.graphs/training_loss_curve.png — training vs. validation loss over training.graphs/clean_vs_adversarial_metrics.png — bar chart of all eval metrics, clean vs. adversarial.graphs/parameter_efficiency_pie.png — trainable vs. frozen parameter share.predictions/sample_clean_inference.png — qualitative clean-image predictions vs. ground truth.predictions/sample_adversarial_inference.png — qualitative degraded-image predictions vs. ground truth.metrics.json — full numerical results breakdown.import torch
from PIL import Image
from transformers import AutoProcessor, Qwen2_5_VLForConditionalGeneration
from peft import PeftModel
base_model_id = "Qwen/Qwen2.5-VL-3B-Instruct"
adapter_repo = "abhifdsdf/Qwen2.5-VL-FUNSD-Adversarial"
processor = AutoProcessor.from_pretrained(base_model_id, trust_remote_code=True)
base_model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
base_model_id, torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True
)
model = PeftModel.from_pretrained(base_model, adapter_repo)
image = Image.open("your_document.png").convert("RGB")
messages = [{"role": "user", "content": [
{"type": "image", "image": image},
{"type": "text", "text": "Analyze this document image and extract all structured key-value pairs in standard text format."},
]}]
prompt = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = processor(text=[prompt], images=[image], return_tensors="pt").to(model.device)
output = model.generate(**inputs, max_new_tokens=512)
print(processor.batch_decode(output[:, inputs["input_ids"].shape[1]:], skip_special_tokens=True)[0])
This table shows the exact same clean/adversarial evaluation harness run against:
Qwen/Qwen2.5-VL-3B-Instruct) with no fine-tuning at all (zero-shot).| Model | Split | Exact Match | Char Similarity | Entity Precision | Entity Recall | Entity F1 |
|---|---|---|---|---|---|---|
| Fine-tuned (ours) | clean | 0.0000 | 0.2098 | 1.0000 | 1.0000 | 1.0000 |
| Fine-tuned (ours) | adversarial | 0.0000 | 0.1565 | 1.0000 | 1.0000 | 1.0000 |

This table shows the exact same clean/adversarial evaluation harness run against:
Qwen/Qwen2.5-VL-3B-Instruct) with no fine-tuning at all (zero-shot).| Model | Split | Exact Match | Char Similarity | Entity Precision | Entity Recall | Entity F1 |
|---|---|---|---|---|---|---|
| Fine-tuned (ours) | clean | 0.0000 | 0.2098 | 1.0000 | 1.0000 | 1.0000 |
| Fine-tuned (ours) | adversarial | 0.0000 | 0.1565 | 1.0000 | 1.0000 | 1.0000 |
| Qwen2.5-VL-3B-Instruct (zero-shot, no fine-tuning) | clean | 0.0000 | 0.2120 | 0.3283 | 0.2335 | 0.2531 |
| Qwen2.5-VL-3B-Instruct (zero-shot, no fine-tuning) | adversarial | 0.0000 | 0.1651 | 0.2439 | 0.1847 | 0.1987 |
| Qwen2-VL-2B-Instruct (different model, zero-shot) | clean | 0.0000 | 0.0618 | 0.1440 | 0.1440 | 0.1440 |
| Qwen2-VL-2B-Instruct (different model, zero-shot) | adversarial | 0.0000 | 0.0353 | 0.1422 | 0.1433 | 0.1427 |
