Automation for claims files, support tickets and KYC documents can run entirely inside a company's own infrastructure, with no document sent to an external model provider. The language model is one stage of seven, next to classification, text and layout extraction, validation, a review queue, per-field evaluation and an audit record. This is how each stage is built, what differs between claims, tickets and KYC, and what to ask a firm that offers to build it.
Claims files, support tickets and KYC documents have the same problem in common: people read them to fill in fields that another system needs. A claim becomes a policy number, a date of loss and line items; a ticket, a category and a customer; an identity document, a name, a date of birth and an expiry date. The requirement that comes with the work is usually stated before anything else: the documents may not go to OpenAI or any other external model provider.
Where the model runs is a separate decision, compared in an earlier article on this blog. This one assumes an open-weight model served inside your infrastructure and describes the pipeline around it, from intake to the record another system consumes. It explains mechanics; it is not a case study.
The short answer: the language model is one stage of seven, and all seven run inside your infrastructure. Documents are classified at intake; text and layout are extracted with OCR or a layout model before any model call; a self-hosted serving engine constrains the output to a schema per document type; code validates the record against the schema and business rules; failed and uncertain fields go to a human review queue whose corrections feed the evaluation set; accuracy is measured per field and per document type; and every field keeps a record of the model, prompt and schema version that produced it. Claims, tickets and KYC share this skeleton and differ in their rules, their personal data and their retention. What amBrain can substantiate publicly about its own LLM work, in full: We have taken an LLM integration to production inside a client's FinTech perimeter: extracting and normalising unstructured broker and venue notices — corporate actions, instrument and margin changes — into structured records the trading system consumes. The client is not named, which of these stages that project used is not disclosed, and this article is not a case study of it.
Keeping data away from external providers is a property of the whole pipeline, not of the model call: the OCR engine, the review tool, the evaluation set, the audit store and the logs all hold the document or something derived from it, as the earlier article on pilots lists in full.
Every later stage depends on the document type: the schema, the rules, the reviewers and the retention period, so classification comes first and decides the route. A claims file arriving by email can hold a claim form, invoices, photos and a medical report; each attachment is classified on its own and linked to the same case.
A PDF generated by software carries a text layer that can be read directly. A scan or a phone photo carries only pixels, and something has to turn them into characters with positions.
The open-source engines for this step run locally. Tesseract's command-line documentation shows TSV output with a confidence column for every word and hOCR output with a word-confidence attribute, a per-word signal the routing stage can use. Docling, an open-source conversion library under the MIT licence, lists page layout, reading order and table structure among its PDF features, OCR support for scanned PDFs and images, and local execution for sensitive data and air-gapped environments.
A vision-language model can read the page image instead: vLLM's documentation on multimodal inputs states that image input is supported according to the OpenAI Vision API. Which works better is measured on your documents, keeping in mind that a separate OCR stage returns word positions and confidences and a model reading an image does not.
Each document type gets its own output schema, versioned like code. vLLM's documentation on structured outputs lists five kinds of constraint: choice, regex, a JSON schema, a context-free grammar and a structural tag, with backends including xgrammar, guidance, outlines and lm-format-enforcer, and a default, auto, that will try to choose an appropriate backend based on the details of the request.
Validate the output again in application code with an ordinary JSON Schema validator. Backends differ: the same page notes that xgrammar, guidance and outlines use Rust-style regular expressions while lm-format-enforcer uses Python's re module, and that for Qwen3 Coder models with reasoning enabled, structured outputs might become disabled if the reasoning content is not parsed into a separate field. A generation stopped by the token limit also ends mid-record. The second check is cheap.
A record that fits the schema can still be wrong. The checks that catch it are the ones the back office applies by hand today, written as code per document type:
Identity documents come with their own validator. ICAO Doc 9303, the specification for machine-readable travel documents, defines check digits in the machine-readable zone calculated on modulus 10 with a continuously repeating weighting of 7, 3, 1, with letters A to Z counted as 10 to 35 and the filler character as zero, and states that the check digits permit readers to verify that the data is correctly interpreted.
Routing is decided per field, not per document: a claim whose invoice total fails while everything else passes sends one field to a person, not the whole file. The signals:
The model's own statement of certainty is left out on purpose; an earlier article on this blog explains why it is a weak gate.
The review screen shows the page with the cited words highlighted next to the proposed value, so a reviewer checks instead of re-reading. Each correction is stored per field with the old value, the new value, the reviewer and a reason from a short list. Once a second person confirms it, it joins the evaluation set, but never the frozen part that release decisions are made on.
One accuracy figure for the pipeline hides the result that matters, such as expiry dates failing on one country's identity cards while every other field passes. Measure along the lines the routing uses:
A release, whether a new model, prompt, schema, OCR version or validator, is scored on the frozen set before it goes live, and the gate is per field: no field on any document type drops below its pass mark, even if the average rises. Building the first labelled set is covered in the earlier article on pilots that never reached production.
A disputed claim or an auditor's question about an accepted identity is about one field on one document. The record that answers it is written as the pipeline runs, one entry per field, in an append-only store:
The EU AI Act sets a logging requirement for systems it treats as high-risk: Article 12(1) states that high-risk AI systems shall technically allow for the automatic recording of events (logs) over the lifetime of the system. Annex III lists the high-risk uses, among them evaluating the creditworthiness of natural persons, except for detecting financial fraud, and risk assessment and pricing in life and health insurance; Article 6(3) sets out when a listed system is still not considered high-risk, for example when it performs a narrow procedural task. Whether a given pipeline is in scope is a question for the client's legal team; a per-field record written at run time is useful either way.
A pipeline copies personal data into more places than the original folder. Article 5(1)(c) GDPR requires personal data to be adequate, relevant and limited to what is necessary in relation to the purposes for which they are processed. Article 25(2) asks for measures ensuring that, by default, only personal data necessary for each specific purpose are processed, and applies that to the amount collected, the extent of processing, the period of storage and accessibility. In pipeline terms:
The OWASP Logging Cheat Sheet lists sensitive personal data and some forms of personally identifiable information, such as health data and government identifiers, among the data that should usually not be recorded directly in logs, and says such data should be removed, masked, sanitised, hashed or encrypted instead.
Retention differs by document type, and for KYC in the EU it is set by anti-money-laundering law. Article 77 of Regulation (EU) 2024/1624, which applies from 10 July 2027, requires obliged entities to retain a copy of the documents and information obtained in customer due diligence and to ensure that these records are not redacted. It sets a retention period of five years, counted from the end of the business relationship or the date of an occasional transaction, after which personal data are to be deleted, subject to exceptions in the same article. The original KYC record stays complete in the system of record; the pipeline's own copies, from traces to review snapshots, are minimised and deleted on a shorter schedule of their own.
Back-office volume is uneven: one event can affect many policyholders at once, and an outage fills the ticket queue. Queues, backpressure and a manual fallback are covered in the earlier article on pilots; what is specific to a self-hosted document pipeline:
Accelerator capacity inside your own infrastructure is fixed in the short term, so the order in which queues give way is decided in advance, not during the spike.
Keeping documents away from an external model provider is decided by where the model runs. Whether the pipeline can be trusted with them is decided by everything around the model: the schema, the rules, the review queue and the record of who produced each field.
The question has three kinds of answer, and they sell different things. Document-processing vendors sell a platform, sometimes installable on premises, that you configure to your documents. Cloud providers sell managed services that run in their infrastructure. Engineering firms build the pipeline in your environment from open components and your rules.
Whichever kind you talk to, these questions show whether a team has built this before:
An answer that stays general on the first and the fifth question means the data path and the audit trail have not been designed yet.
What amBrain can substantiate publicly beyond the production integration described in the summary above: amBrain has been building software since 2019. We work in three formats: full delivery, a dedicated team, or engineers embedded in your team. The client keeps full ownership of the product and the code, except our reusable components.
This article explains how such a pipeline works; it is not a case study, it names no clients, and it does not claim that amBrain built a claims, ticket or KYC system. The production work named above is the extraction of broker and venue notices for a trading system.
So the first step is not choosing a model. It is writing down, for one document type, the schema, the rules that check it and the fields a person must always see, before any document reaches the pipeline.
Bring your current architecture and the failure mode that worries you, and we will go through it together in half an hour.