How we scaled our invoice recognition to process over 5 million pages every month.

Ward Van Laer
Ixor
Published in
3 min readFeb 25, 2022

Our machine learning team has been building and improving our document processing algorithms for over 2 years now. You can read a lot about this process in some of our previous blogs:

However, the key is being able to do this fast, reliable and in a scalable way, especially when this is used in a commercial context. We want to keep offering the same speed and quality of service during peak periods and our services should be able to scale up fast when new clients subscribe to our recognition API or platform.

To deploy our machine learning modules in a scalable way, we decided to use AWS lambda functions. These functions can be linked together to support custom document flows with combinations of classification and detection algorithms.

Scaling using AWS Lambda and Stepfunctions

AWS Lambda is a cloud computing service that lets you run code without managing resources or servers. When the workload is high, more lambda functions are spun up to scale your application. Lambda functions are best suited for short event-driven workloads, which is why we split up our AI services into modules. This gives us certain advantages:

  • Each lambda function can be updated separately which makes it easy to release only some of our updated modules into production.
  • Lambda functions can be chained together using stepfunctions. This means we can reuse our modules to create document flows (function chains) that match our client's needs.
  • Each lambda function can scale independently of the others. Machine learning modules that are used multiple times every second are scaled separately from other modules depending on the needs. This reduces costs.

Creating custom document flows using modules

Thanks to the modular nature of AWS Step Functions, we can easily create custom recognition flows for our clients. We manage these flows by using 1 iterator module. This module reads the client-specific config file and sends the correct event to the next ML module. This way, the iterator module can be called several times during one flow, which allows one AWS Step Function to support an infinite amount of possible module combinations.

An example flow for accounting documents

As an example, we can take a look at a basic flow for accounting documents. Considering we expect incoming documents to be invoices or scanned receipts, we can use a classification model to send each type to the appropriate detection module.

In the overview below, we show that these types can both be processed using only one stepfunction. Depending on the document class, we can detect different fields on the document. At the left, you can see the logical flow, consisting of a classification step followed by the appropriate detection module. At the right, you can see how our iterator-function mimics this flow by triggering the correct module at each time step.

A possible flow for accounting documents (at the left) and what this flow would look like in our configurable stepfunction.

At IxorThink, the machine learning practice of Ixor, we are constantly trying to improve our methods to create state-of-the-art solutions. As a software company, we can provide stable products from proof-of-concept to deployment. Feel free to contact us for more information.

--

--

Ward Van Laer
Ixor
Editor for

Machine Learning Engineer at Ixor | Magician