layer-groupContinuous Learning (RAG)

Enhance extraction accuracy with Retrieval-Augmented Generation using your own documents.

Overview

When using an Extraction Model regularly, it can happen that the extraction is not satisfying on a given document or particular template.

If you notice this, you have a way to durably improve the performance of the model for the next predictions you'll make. The solution you need is the RAG feature.

Basics of RAG Inner Workings

RAG stands for Retrieval-Augmented Generation, a novel approach in artificial intelligence that combines the strengths of retrieval-based models with generative LLM text production.

Essentially, RAG leverages a rich database of source documents and embeddings to augment the knowledge base from which it draws responses. This means that the system retrieves specific and context-based data snippets and then uses them to generate semantic and fine-tuned responses that are both creative and factually accurate.

Overall Steps of RAG

  1. Annotating a given sample, which means giving the model the difference between the extracted data and the expected value(s). When activated, this example will be added to the RAG Database for the future.

  2. Retrieval: When a next document will be send with the RAG option activated, the model will try to search for a similar example in the existing database. The question here is : "Maybe there is an existing example where I need to follow the instructions so that I'm not doing a same mistake again". If no example found, no need to augment the prediction. If an examples is matched in the RAG Database, here comes step 3.

  3. Augmented Generation: A document was matched in the RAG Database. The model will use the instructions you gave on the RAG sample to make a better prediction this time. The prediction generated is augmented with an existing context helping the model to be better this time.

RAG process overview

Activate RAG

money-check-dollar-pen

Set Up the RAG Database

To use RAG on a given Extraction Model, you'll need to first set up the RAG database which will contain your documents and data.

Access the database by clicking on the "Continuous Learning (RAG)" link in the model's configuration section. You can then enrich your RAG database by uploading documents with an unsatisfying behavior.

You need to annotate the document, ticking the fields you want to be covered by the RAG augmentation on this template. You can also add additional guidelines using plain language.

circle-check

Once this document is annotated, be sure to validate it, and go to the Live test tab. You should upload a document, and leave "Show RAG extraction" ticked.

Ideally, pick a document with the same template (another invoice from the same supplier for instance), but not exactly the one you used in the RAG database. You will see the before/after predictions and should be able to check that the extra instructions were taken into account to augment properly the prediction. In the future, the documents respecting the same template should be augmented, which should increase a lot the performances on this given template. For other types of documents, the behavior remain the same, which means that RAG is improving the result with no regression on other documents.

Activate RAG on the Platform

When setting the activation state of a feature on the Platform, this will be the default. All API calls will use the default state unless explicitly set otherwise during the API call.

This is useful for project managers, as it allows activating or deactivating a feature across all API calls on that model.

Anyone with write access to the model can set the option's default value.

Click on "Data Schema" then "Optional Features" tab. There you can activate the "RAG Processing" feature.

Activate RAG via API Calls

If you need finer-grained control over when the feature is used, you can activate or deactivate it when making API calls.

This allows dynamically setting the activation state using your internal business or domain logic.

Check the Optional Features Configuration section if using our Client Libraries / SDKs.

Frequently Asked Questions

Is my RAG data shared with other users or sold to 3rd parties?

No, never.

RAG data is only accessible to the users of the organization that the model belongs to.

Mindee never sells data to 3rd parties.

All storage and retrieval of RAG data is done on Mindee's dedicated servers.

Does Mindee use my RAG data for training?

No, never.

We only use RAG data internally for debugging or testing, and with your explicit knowledge and consent.

Last updated

Was this helpful?