The problem
A document-verification intake pipeline has to do two things with the same image: read the fields off it, and decide whether it was edited. DocGuard-VLM trains a single LoRA adapter on a small open-weight vision-language model, Qwen2-VL-2B-Instruct, to do both: return a receipt's line items, subtotal and total as JSON, and say whether the document was tampered with and roughly where.
Real forged ID scans cannot be used for training, so following the document-forgery literature the project starts from CORD-v2, a public receipt dataset with word-level OCR ground truth, and tampers a subset of it synthetically.
Data: realistic tampering, plus an adversarial test set
- Three tamper types applied to a real text line (from CORD's own line boxes, not a random patch): copy-move within the document, splicing from a donor document, and patch-overlay that blanks a field and writes different digits over it.
- An earlier version picked a uniformly random region and sometimes "tampered" blank background, which is a trivial signal. Recovering per-line boxes from CORD's annotations fixed that.
- A separate adversarial test split runs the same kind of images through JPEG re-compression, noise, blur, rotation and downscaling, so robustness is measured instead of assumed.
- Splits: 350 training images, and 60 clean plus 60 adversarial test images, each with an OCR task and a roughly 50/50 tampered/authentic forgery task.
Training and evaluation
QLoRA fine-tune of unsloth/Qwen2-VL-2B-Instruct on a free Colab T4: 4-bit base weights, rank-16 LoRA over the vision, language, attention and MLP layers, 2 epochs. The evaluation harness scores the zero-shot base model and the fine-tuned adapter on both test splits, so the gain and the robustness gap are both visible.
OCR is scored by JSON-validity (did the model emit parseable output at all) and exact match on the total. Forgery is scored by accuracy and precision, recall and F1 on the tampered class. Verdict parsing is negation-aware, because naive matching on "tamper" misreads answers like "no signs of tampering".
Results
| Model | Split | JSON-valid | Total match | Forgery F1 | Tampered recall |
|---|---|---|---|---|---|
| Zero-shot | clean | 25.0% | 33.3% | 0.21 | 11.8% |
| Zero-shot | adversarial | 13.3% | 18.3% | 0.16 | 8.8% |
| LoRA (ours) | clean | 91.7% | 90.0% | 0.60 | 57.1% |
| LoRA (ours) | adversarial | 88.3% | 78.3% | 0.60 | 57.1% |
Field extraction is the clear win: the zero-shot model rarely produces valid JSON in this schema, and the adapter does so on about 9 in 10 documents, with the expected drop under perturbation. Forgery recall goes from almost never flagging a tampered document to flagging most of them; the zero-shot model's high precision and very low recall is an "always say authentic" failure, not detection.
The bug that inflated my own results
The fine-tuned model's forgery confusion matrix was bit-for-bit identical on the clean and adversarial splits, even though the images differ. The zero-shot baseline's matrix did shift between them, which made the problem diagnosable: the dataset builder reseeded the random generator to the same value for every split, so both test splits got the same shuffle, and with it the same labels, tamper types and prompt wording in the same positions.
The seeding is fixed in the code. The published forgery numbers were measured on the earlier data, so the forgery robustness claim is stated as provisional until a retrain; the OCR numbers do not depend on the label pattern and are unaffected. I published the caveat rather than quietly retraining it away.
Limitations
- Tampering is synthetic, so performance on real forged documents is unverified.
- Receipts, not identity documents: layouts and field types differ.
- A small dataset (470 unique source images), sized for one day on one GPU.


