qwen2.5-1.5b-sroie-qlora
receipt data extraction adapter
2 min readupdated
This QLoRA (a lightweight adapter for targeted model fine-tuning) adapter turns the base Qwen/Qwen2.5-1.5B-Instruct model into a specialized tool for parsing scanned receipts. It takes pre-OCR receipt text as input and outputs a structured JSON object with key fields. The solution is built for developers who need to automate bookkeeping document processing or purchase digitization.
Key features
- Efficient base: Uses the compact and fast Qwen2.5-1.5B-Instruct, fine-tuned via QLoRA (4-bit quantization).
- Structured output: Extracts four strictly defined fields: company name, date, full address, and total amount.
- Low system requirements: Trained and runs on a consumer graphics card with 8 GB VRAM.
- Open license: Distributed under the Apache 2.0 license, matching the base model.
What you can do
- Pipeline integration: Connect the adapter after the OCR module in an expense tracking or receipt scanning application.
- Bookkeeping automation: Use it in a Telegram bot to quickly convert paper receipts into structured JSON.
- Extraction testing: Check data extraction accuracy on English-language receipts in a Python environment using the peft library.
Example
import json
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
BASE = "Qwen/Qwen2.5-1.5B-Instruct"
ADAPTER = "titouhiomar/qwen2.5-1.5b-sroie-qlora"
tok = AutoTokenizer.from_pretrained(ADAPTER)
model = AutoModelForCausalLM.from_pretrained(
BASE,
quantization_config=BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16),
device_map="auto",
)
model = PeftModel.from_pretrained(model, ADAPTER).eval()Read more
Details• Dataset: ICDAR 2019 SROIE (551 training and 75 validation receipts).
• LoRA parameters: r = 16, alpha = 32, dropout = 0.05 on q/k/v/o_proj and gate/up/down_proj layers.
• Hardware and resources: NVIDIA RTX 5060 Laptop (8 GB), peak VRAM usage 4.8 GB, training time about 30 minutes.
• Limitations: trained on English-language Malaysian receipts; the model works only with ready OCR text and cannot read images directly.










Comments