Introduction
If you are new to SAP Document AI service, it is a product offering by SAP to provide information extraction from business documents. This primarily helps your business save time by automating and streamlining processes that require information extraction from documents, such as invoices, payment advices, purchase orders, and bills of lading. It limits manual steps, therefore saving time, energy, manpower, and money, which you can invest in growing your business's critical functions.
Instant Learning and Models
As of this writing, and provided you are using Instant Learning, the SAP Document AI uses a multi-model approach to deliver the best possible extraction results. It has mainly three model categories: Pre-trained, LLM, and Rules (Template). Each category may have further different models.
Based on our experiments, it was evident that no single model is capable of achieving higher accuracies than combining them for extraction. This is backed by our evaluation pipeline, which constantly monitors the accuracy of the individual and the combination approach.
We took the facts from the above experiments and designed Document AI naturally using multi-models and optimized extraction based on user inputs on the corrections. This is the foundation of Instant Learning.
How to instantly learn
Start with Schema
A schema is the blueprint of your extraction. End-user defines fields and type of schema. Schema comes in mainly two flavours: Manual and Auto. Manual schemas are limited to template-based extraction, whereas the Auto schemas are more dynamic, powerful, and give the full potential of extraction.
Unless you want to use only the Template model (Rule-based extraction), you should create the Auto schemas, as they can also provide automatic templates depending on when the system thinks that a template could be a good fit for certain layouts.
Now, Auto schemas come in two further flavours depending on the configuration:
Auto with Default-extractor:
This combination works under the hood with all available model types. Pre-trained, LLM and Template.
Auto without Default-extractor:
This combination can automatically provide both LLM and Template extraction without requiring users to specify it.
Recommendation: For the SAP standard schemas, such as Invoice, PO, PA, etc., a user should use "Auto with Default-extractor". For everything else, a user must use the "Auto without Default-extractor".
Extraction, Feedback, and Repeat
Once you have set up your schema and activated it, you are ready for extraction. As you are aware, the following is only applicable to the Auto schema with any flavor.
Your first extraction may not be something you like. It may have errors or inaccuracies. To remove such inaccurate extraction, you need to input it into the system, or in other words, provide feedback to the system.
You can add your feedback in many forms. Let me cover them here:
Feedback as a Schema Description
You are the controller of your extraction. If you want to influence the overall extraction and help the system know your schema better, you can explain that in the description field of the Schema. Your description should resemble a prompt for an LLM.
Feedback as a Schema Field Description
If you see the extraction is inaccurate for a field, then you can add a general instruction for the field, explaining the field, also sharing an example if that is common in all documents for the schema.
Feedback as a Confirm Document
Confirm documents are used to improve models, but without a guarantee. I recommend that you try and test extraction optimization based on your confirmed document-based feedback. Now, confirm that the documents can be used to influence pre-trained model extraction and LLM extraction, depending on your contractual agreement for using SAP Document AI, and allow SAP to use such documents for the extraction.
To confirm a document, the user should carefully review the extraction, correct any incorrect field values, and confirm the document by either making the API call or using the "Confirm" button on the UI.
The Confirm Document not only affects the model but also helps the system select the best model for extraction by switching between models. I will not touch upon the model switching in the blog post, but rather describe how an individual model can be affected with the "Confirm Document".
Pre-trained model
Confirming documents to improve the pre-trained model is a longer cycle and cannot be tested immediately. This requires the engineering teams to scrutinise the data, evaluate training results, and release new models with upcoming releases. This takes time, often weeks.
LLM extraction
Confirm documents can also be used for LLM extraction improvement, which is fundamental to Instant Learning, provided that you opt in for the feature. This optimization is instantly done when a user confirms a document. However, you may still encounter issues with the extraction in rare cases. If the user continues confirming one more document here, the model switching will use the Template model (the rule-based model) to try the extraction further.
Template
Confirm documents are used as samples for automatically created templates. System automatically finds out if you need one more template to optimize your extraction and create it.
After this, the extraction would be at its best possible accuracy. I have omitted the system-level steps for brevity. To learn more about how to do all of these, please visit the SAP Document AI documentation on the official help portal.
Disclaimer: The information in the blog post is my personal opinion and is based on my understanding of the topic. Before making a purchase or using the system in production, please review SAP's official guidance on the product. Please visit the official published help documentation for the product for more information.