Form autofill automation from documents: Donut, LLM, and PyTorch

Manual entry of data from forms and scans consumes hours of employee time and generates errors. We automate form autofill: we parse your documents, configure data extraction, and deliver a turnkey solution. Document processing time is reduced severalfold, while ambiguous cases are routed to human review.
Frequently Asked Questions

AI form autofill: where manual input breaks

Manual data entry works predictably while the flow is homogeneous: one type of form, text layer in PDF, even columns.

As soon as heterogeneous scans enter the flow — phone photos, faxes, pages with skew and print over text — the operator starts transferring guesses rather than values.

Composite and contextual fields cost the most. Address, full name, series and number, payment details are split across several cells, and in the scan column boundaries shift; table line items are carried over to the second page, and some rows simply do not make it into the form. A separate category is marks: checkboxes, underlines, handwritten edits over printed text.

Field extraction errors are dangerous not by frequency but by the moment they are detected. A typo in one digit passes acceptance quietly and surfaces during reconciliation or in reporting, where rework costs not operator minutes but manual parsing of the entire batch.

Form autofill on hard rules does not cover this: a template for each new document supplier lasts until the first change to the form.

In this section, we break down how this is covered: where manual transfer ends, how document recognition with value validation by rules is structured, and why a hybrid scheme — field extraction by a model plus validation — produces fewer rejects than templates or pure manual entry.

What automatic data extraction from documents provides

Most often at the process input there is manual transfer: an operator reads the document and distributes details, amounts, dates, and line items across the fields of the accounting system.

With a flow of hundreds of documents per day, this is a bottleneck — the queue grows faster than headcount, and downtime slows period close.

AI form autofill removes transfer as a separate operation: the model labels fields directly in the document and outputs them in structured form.

A document is processed in seconds instead of minutes, process throughput grows severalfold with the same number of operators, and peak loads no longer require temporary hiring.

We measure extraction accuracy not by eye but by the share of fields matching the reference annotation.

On typical details and amounts this is usually 95-98%, and errors are concentrated in a narrow class — crumpled scans and non-standard layouts that a human used to handle anyway.

Separate effect — share of manual edits: it falls from almost complete retyping to exception review.

An entire class of errors also disappears — digit transposition in amounts, lost table rows, incorrectly concatenated details: the model works with the visual structure of the form, not with flat recognition text.

Operator workload shifts from entry to reviewing disputed cases: only those where model confidence is below threshold are checked manually. A control sample and a log for each field remain — you can see exactly what the model extracted. We fine-tune for specific document types on PyTorch.

Data extraction methods: from templates to language models

The incoming flow is almost never homogeneous: PDFs with a text layer, contract scans, phone photos of forms, and tabular forms from regular suppliers sit side by side.

There is no universal parsing method — the method is chosen by the share of each file type in the flow and the cost of an error in a specific field. Therefore, we first count how many documents fall into each type and which fields operators edit manually most often.

Approach When it fits Limitations
Template extraction by masks and coordinates 1–2 stable forms, layout unchanged for months Breaks when the form changes; rules are edited manually for each new type
Parsing by keywords and anchors 5–15 types with predictable structure and a text layer Sensitive to wording; multiple values cause false positives
Language models that read the image as a whole Scans and photos without a text layer, heterogeneous layout Requires annotation on your documents; errors are harder to explain
Hybrid approach: rules + model + checks Mixed flow, critical fields Takes longer to implement; requires explicit handling of conflicts between rule and model

In practice, the boundary is drawn by statistics: if most of the flow is one form, a template is more reliable and easier to maintain; if layout changes every week, a language model is indispensable.

Next, we configure field annotation: for each, we set a confidence threshold, required status, and format validation, and send disputed values to the operator.

The hybrid scheme gives a predictable result on a mixed flow — the model retrieves values, rules filter out what does not pass business logic.

Order of work: document audit, schema, setup, acceptance

Work proceeds from a document corpus to a working extraction scheme: until fields are fixed and a held-out test set is assembled, setup turns into guesswork.

Therefore the order is rigid — first document audit, then the annotation schema, and only then setting up extraction rules.

  1. Document audit. We collect the real flow: scans, photos, rotated pages, different templates from counterparties. We record the required fields, where they are located, how often layout changes, and what share of files reads poorly.
  2. Annotation schema. We describe the field composition, types, required status, and normalization rules — dates to a unified format, codes, organization names. The schema becomes a contract between extraction and the accounting system.
  3. Test document set. We set aside part of the flow, manually annotated, together with inconvenient cases: tables, handwritten edits, merged cells. The model is not tuned on this set — it is used to calculate final quality.
  4. Setting up extraction rules. Fields are retrieved by a neural network model, with deterministic rules operating on top: required fields, amount reconciliation, detail formats. Low-confidence fields go to the operator, and their edits return to fine-tuning.
  5. Acceptance of the result. Run on the held-out set: precision and recall for each field, share of documents accepted without edits, error analysis down to zero critical errors.
  6. Handover to operation. We hand over the schema, rule configurations, test set, monitoring, and the fine-tuning procedure for when document templates change.

Configurations, annotation schemas, and acceptance regulations

After launch, the customer's team retains not only a working service but also a set of artifacts by which it can be operated and developed without us.

Below is what is handed over for each processing flow: with this set, a new engineer will understand what is configured where, and an operator will know how to act when there is a deviation.

  • Extraction configuration — a settings file with the list of document types, model confidence thresholds, and conditions under which a value goes to manual review.
  • Field schemas — a description of each detail: type, required status, format mask, allowed values, and mapping to the accounting system field where the result is written.
  • Annotation agreement — rules for annotating entities for the training and validation samples, so that fine-tuning on new documents does not break the quality already achieved.
  • Access rights matrix — role separation: who sees the source scan, who sees extracted values, who changes the field schema and confirms the result.
  • Processing regulations — the procedure for low confidence, discrepancy with accounting system data, and mass recognition failure.
  • Operator instructions — reference guides for the review screen: what counts as an error, how to correct it, and where to escalate disputed cases.
  • Run log and metrics — access to accuracy by document type, so degradation can be seen before users notice it.

Changes to the field schema and thresholds are made without editing code, and a new document type is added through annotation and configuration setup. This is the condition under which the system remains manageable after delivery.

Case: how manual entry was reduced during form annotation

Before

The customer received an incoming document flow: invoice scans, supplier questionnaires, acts. Operators transferred 12–18 fields into a form by hand, and the average processing time for one document stayed at 6–8 minutes.

Up to 15% of records were returned for correction after reconciliation, and on peak-load days the queue reached several hundred files — some documents waited more than a day for processing.

What was changed

We assembled a pipeline that reads a document as an image and immediately outputs a filled form.

The Donut model extracts the structure and field values, a language model brings dates, amounts, and counterparty names to a unified format, and reconciliation rules check required fields and row arithmetic.

The operator no longer enters data: they confirm the result where model confidence is below threshold and see highlighted problem fields.

What became

Document processing time dropped to 40–60 seconds, the share of edits to 3–4%, and almost all of them concern handwritten notes.

Rejections, when a document was lost in the queue, disappeared: every file gets a status and ends up either in a ready record or in the manual review queue.

About 90% of documents are closed without human involvement, and with the same staff the flow grew approximately threefold — processing stopped being a bottleneck.

How does template extraction differ from model-based extraction?

Template parsing relies on field coordinates, anchor labels, and regular expressions: it is deterministic, fast, and predictable as long as the document layout does not change.

The model works with the meaning of fields — it does not care where a detail is located or how it is labeled, so it parses a new form without redrawing a template, but it requires annotated examples and validation of answers.

The choice of approach is about the variability of the document flow. With one layout type, a template is cheaper to maintain and easier to debug.

When there are dozens of layouts and they come from hundreds of counterparties, template versus model loses: the number of rules grows faster than the volume of documents.

The hybrid scheme removes this opposition: Donut and related models extract values together with a confidence estimate for each field, while rules check formats, required status, and consistency of details. Disputed cases go to the operator, and their edits become annotation for fine-tuning.

If a parsing system is already implemented, it is not thrown away. We keep the rules as a control layer and benchmark for comparison, enable the model in shadow mode on the same flow, and look at field-level discrepancies. Migration of rules happens gradually: first fields with high variability, then the rest.

The switching criterion is the share of fields that the model closes no worse than the rules with the same volume of manual edits. Until the threshold is reached, the hybrid works: the model proposes, rules and the operator confirm.

Technical questions asked before starting

Autofill accuracy is not one number but a distribution across document types and fields. On a stable template, the system closes almost everything; on a crumpled scan with handwritten edits, noticeably less: it is not about the model, but about how it behaves on weak input.

Therefore, we build a pipeline with a confidence threshold: recognition on Donut and language post-processing return a field together with an estimate, values below the threshold go to manual review, and inconsistent ones are not written to the accounting system. Quality is held by the architecture, not by a single model.

What to do with non-standard documents and handwritten text?

We do not promise a single number: we calculate quality for each document type on your sample. Printed forms are closed automatically, handwritten notes go through a separate route — the system proposes a value, a human confirms.

How is personal data protected?

Processing can be kept in the customer's closed environment. Personal data is masked before being written to the log, access is separated by roles, and the retention period for source files is set by policy.

How is the solution integrated into the accounting system?

Through a software interface: fields are sent with a link to the object, and resubmission does not duplicate records. If there is no interface, we take documents from a shared folder or email and return the result to the same place.

How is quality controlled after launch?

We calculate the metric by fields, not by whole documents — this shows where accuracy is lost. Once per agreed period, we reconcile a sample with the source files and fine-tune the model on discrepancies.

Let's discuss the task and come back with an estimate and plan

So that the estimate is based on data rather than guesses, we need input from you: how the document enters the process, which fields are extracted from it, and what happens to the result next.

Usually 20-30 samples in the form in which they arrive are enough, plus a description of where a human currently edits. This is enough to understand where extraction ends and normalization with reference data begins.

Tell us point by point:

  • document types and their sources — scans, photos, electronic files, or a flow from the accounting system;
  • which fields are extracted and which of them are critical, and which are acceptable to fill in manually;
  • flow volume and its peaks — how many documents per day and which pages are the heaviest;
  • where the result goes: export to the accounting system, a file in an agreed format, or manual review;
  • control requirements: whether confidence highlighting is needed for each field and a log of operator edits;
  • what validation rules already exist on the customer side and who is responsible for acceptance.

In response, we will come back with a solution scheme, implementation plan, and timeline estimate. We will separately define the pilot area — usually one document type and 3-5 fields, to measure the share of correct entries and processing time on real data. After that — expansion to other types and the full scope of work by stages.

AI Development Areas

Latest works

  • B2B ADVANCE company website development
    B2B ADVANCE company website development
    1542
  • Development of a web application for FEEDME
    Development of a web application for FEEDME
    1394
  • Website development for BELFINGROUP
    Website development for BELFINGROUP
    1081
  • Development of an online store for the company FURNORO
    Development of an online store for the company FURNORO
    1369
  • B2B Advance company logo design
    B2B Advance company logo design
    816
  • Development of a web application for Enviok
    Development of a web application for Enviok
    1142