Qwen3.5-4B DocVQA LoRA (v2_r32_mlp)

LoRA adapters fine-tuning Qwen/Qwen3.5-4B for document visual question answering. Trained with Unsloth on 2,000 curated DocVQA samples from the train split.

Usage (critical: disable thinking)

from unsloth import FastVisionModel
from peft import PeftModel

base, processor = FastVisionModel.from_pretrained("Qwen/Qwen3.5-4B", load_in_4bit=True)
FastVisionModel.for_inference(base)
model = PeftModel.from_pretrained(base, "hxcsa/qwen35-4b-docvqa-lora")
FastVisionModel.for_inference(model)

# Qwen3.5 is a thinking-style model โ€” disable thinking for concise answers
text = processor.apply_chat_template(
    messages, add_generation_prompt=True, tokenize=False,
    enable_thinking=False,  # โ† essential
)
inputs = processor(images=image, text=text, add_special_tokens=False, return_tensors="pt").to("cuda")
out = model.generate(**inputs, max_new_tokens=64, do_sample=False)
answer = processor.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True).strip()

Results (ANLS on 300 DocVQA validation, seed 1234, 1344px)

Model ANLS Exact Match
Qwen3.5-4B base (zero-shot) 0.6265 0.5933
v1 LoRA (1k from val, contaminated) 0.8626 0.8333
v2 r16 attn-only (2k train, 2 epochs) 0.8687 0.8567
v2 r32 + MLP (2k train, 2 epochs) 0.8833 0.8667

+0.26 ANLS over zero-shot. Clean eval (trained on train, tested on val).

Training

  • Base: Qwen/Qwen3.5-4B (4-bit NF4)
  • LoRA: r=32, ฮฑ=32, dropout 0 โ€” attention (q/k/v/o) + MLP (gate/up/down)
  • ViT frozen; loss on assistant tokens only
  • 2 epochs, 2,000 samples, eff. batch 8, LR 2e-4 cosine, bf16
  • 5% holdout eval โ†’ best checkpoint auto-restored
  • ~34 min on A6000 48 GB, peak VRAM 4.8 GB

Data

Trained on hxcsa/docvqa-2k-train (2,000 samples from DocVQA train split, quality-filtered, 1344px max edge). The validation ANLS uses the clean DocVQA validation split.

Files

  • adapter_model.safetensors โ€” LoRA weights (34 MB)
  • tokenizer.json / tokenizer_config.json / chat_template.jinja โ€” Qwen3.5 template
  • processor_config.json โ€” vision processor config
Downloads last month
87
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for hxcsa/qwen35-4b-docvqa-lora

Finetuned
Qwen/Qwen3.5-4B
Adapter
(508)
this model