r/developersPak • u/NotSoAsian86 • 12d ago
Help Best Models For Doing Data Extraction From Accounting Documents
I am working with some complex accounting documents such as lengthy bank statements, pdf invoices, sometimes images of receipts etc.
So far I have been using Gemini 3.1 Pro for intelligent extraction because I need the output in a specific JSON format and also because the documents have no specific format of their own either, so using a dedicated OCR model like pdfminer etc won't work.
The issue is that the cost is eating up the whole budget to the point that according to calculations it would be a miracle to make breakeven for my product.
I can't compromise on accuracy because it is related to financial decisions of the users which is a sensitive thing, and I can't be too open with my wallet because what's the point of the business if it is going in loss.
I need suggestions for replacement with the following considerations:
Must have at least equivalent accuracy to 3.1 Pro in extracting data from pdf/images.
Must be less costly than 3.1 Pro (even 20% less cost would be acceptable for now).
Should have Zero Data Retention Policy.
The output should be in a structured JSON, for example it should understand that if there are two dates mentioned on the document it should properly create the JSON mentioning which date is the invoice creation/issue date and which date is the due date for invoice payment.
1
u/rizistt Software Engineer 11d ago
Hey, I am building something for data extraction for precisely cases like this. Would love your feedback if you're open.
1
u/NotSoAsian86 11d ago
Are you building a model for extraction or are you building an application with a similar case as mine?
2
u/Cheap_Fly_1003 ML/AI Engineer 11d ago
I am using Azure Document Intelligence (ADI) for Healthtech domain which includes Patient's reports that include number especially the tables, it handles these documents accurately and. It costs 10$ for 1000 pages, be it images or PDFs.
1
u/itsPerceptron 11d ago
Use azure OCR API or llamaOCR api, both work great and you can process 1000 of document under 15$
1
u/BATEMANx9 6d ago
for bank statements i wouldn't send every page through a big model at all. most statements from online banking have a real text layer, so you can pull the transaction table out without an llm and only use a small cheap model for the header bits (account, period, vendor names).
the part that actually saves you is a plain check per statement: opening balance + credits - debits = closing balance. anything that fails goes to manual review or to the expensive model. that way you know which files you can trust.
if pdfminer keeps breaking on the layouts, i built an api for this (switchfile.io, disclosure: mine). it turns pdfs into json, csv or excel, and with store=false nothing is kept after the request. servers are in the eu.
3
u/Candid-Fudge-4015 11d ago
Accounting documents give you checks that most extraction doesn't have. Line items should add up to the invoice total, a statement's opening balance plus its transactions should equal the closing balance, and a due date should come after the issue date. Run a cheaper model first, run those checks in code, and send only the documents that fail to 3.1 Pro. How much that saves depends on how many pass, which you can only learn on your own files, so label 50 or so with the correct JSON and compare both setups on them before trusting either.
Two smaller things. If your users can wait, Gemini's Batch API is priced at 50% of the standard rate. And hash every file and store its result, so a re-upload or a retry after a failure doesn't bill again for a document you already extracted.