The capabilities described on this page are included in Appian's advanced and premium capability tiers. Usage limits may apply. |
This topic covers how to create an AI skill to extract text from documents using machine learning (ML) models.
A document extraction skill takes a document as input via the Extract from Document smart service, analyzes the document, and returns a map of the text extracted from the document. You'll create a document extraction AI skill for each type of document you want to extract data from.
Tip: AI skills created before the 23.4 release use pre-trained models for document extraction. To create custom models for document extraction, create a new AI skill.
Appian 24.1 includes enhancements to extract data from tables and checkboxes more accurately. To confirm your environment takes advantage of these enhancements, contact Appian Support.
Here's a high-level breakdown of how to create and use a document extraction AI skill:
Note: This AI skill type is only available in select regions.
In the Build view, click NEW > AI Skill.
In the Extraction section, select Documents.
Choose the type of document you're extracting data from:
Configure the following properties:
Property | Description |
---|---|
Name | Enter a name that follows the recommended naming standard. |
Description | (Optional) Enter a brief description of the AI skill. |
The document extraction AI skill is powered by a machine learning model designed to extract data from documents businesses commonly receive or interact with, such as invoices, purchase orders, insurance claims, ID cards, and more.
Before you add the fields you want to extract, you need to upload samples that represent the document you want to extract data from. The model needs training documents to learn about the patterns or traits of the fields within the documents. The model also uses some of these training documents to test its knowledge after training.
The model can only learn from the documents you provide, so be sure to build a comprehensive and diverse set of documents that represent what you expect to extract in your process.
Training documents must meet the following requirements:
In Step 1: Provide Documents:
Next, you'll add the fields that commonly appear in the document type. For example, if you're building an AI skill to extract data from invoices, you'll want to add common fields that contain the data you want to extract, such as Invoice Number, Date, and Vendor Name.
Before Appian can extract data from your documents, you'll need to define what those fields are and the type of data they contain:
Tip: Add a field for each piece of data in the document you want to extract using the AI skill. If you don't add a field, the skill won't know to extract the data or how to label it.
The document extraction AI skill extracts data as type Text or Boolean (for checkboxes). However, your document data may be of different data types, such as Dates or Numbers. Additionally, you may want to save this extracted data in specific data objects, such as record types or custom data types (CDTs).
To ensure your data reaches the intended destination and in the proper format, you'll need to properly name and map fields as you configure your AI skill and smart service.
Pick the right name for the field as you define your document structure in the AI skill.
Flat data: If you're planning to save extracted data to a flat CDT or record type, name each field in the document structure to match the target field so Appian casts it properly.
invoiceNumber
field in your InvoicesReceivable
record type. To achieve this, create a invoiceNumber
field (type: Text) in your skill to match its ultimate destination (the invoiceNumber
field in your record type) in Appian.Tables (nested data): If you plan to extract document data that's formatted in a table, you'll need to carefully name these fields as well. When Appian extracts data from a table in a document, the results is a list of maps, with each map representing a row in the table. The name you choose for the table field helps Appian cast all of this data properly.
Name the table fields based on the data object where you plan to store it:
Example: You want to extract data from invoices. Each invoice has a table containing a list of items you ordered, the unit costs, and how many of each item you ordered. Invoice data is stored in the Invoice
CDT, which contains a field lineItems
(type: Invoice_Table
CDT) to store itemized data from tables in each invoice. You want to configure your process so that the smart service saves the itemized values into the Invoice_Table
CDT.
To achieve this, create a lineItems
(type: Table) field in your skill to match its ultimate destination (the Invoice_Table
CDT, by way of the lineItems
field of the Invoice
CDT) in Appian. Additionally, name each field within the table to match the corresponding fields within the CDT as well.
The following image include numbers to demonstrate the fields that should match when extracting table data with an AI skill.
The following table summarizes guidance for naming fields in your document structure:
Extracted data type | Target location | Field name requirement | Example field name |
---|---|---|---|
Text or Boolean | Record type or CDT | Field name must match the target field. | invoiceNumber |
Table | Record type relationship | Field name must match the name of the relationship. | maInvoiceItems |
Table | CDT | Field name must match the name of the field that contains table data. Fields within the table must match the names of the fields within the CDT. | lineItems |
As you build your process, you'll map the smart service output to process variables. Appian supports casting data from Maps to CDTs or record types so you can use the extraction results to write to your database.
Note: Review the design guidance to ensure that the fields in your AI skill are named based on how you want to cast the data.
To ensure that the AI skill extracts and uses your data as you intend, carefully map the Extract from Document smart service output to the proper variables so your data is used or stored properly:
After you tell Appian which fields you want to extract from the document, you'll indicate the values that correspond to those fields in the sample documents. This process is called labeling, and it helps the model understand what the data might look like or where it might appear in other documents.
Tip: You'll only label Text values in this step. Although you won't label tables and checkboxes, these fields will still be extracted.
$4,000
in the document, you might select total
as the field it maps to.Above the document preview, click NEXT to view other sample documents and label additional values. To select a specific document, use the dropdown menu labeled with a count of the documents you uploaded.
Tip: Each field will need labels in at least half of the documents you uploaded.
The final step of creating a document extraction AI skill asks you to review the fields you've labeled in the sample documents. The more fields you label, the more the model can learn about your fields. This is what makes the model smarter and better at extracting data of interest.
If you haven't labeled enough fields in the set of documents you uploaded, you'll see a message encouraging you to add more files and fields.
You'll manually prompt the model to start training based on the training documents and labeled fields you provided. When you've labeled all the fields you can, click TRAIN MODEL on the Review page.
During training, the model analyzes a portion of your training documents to learn about the traits or patterns that identify each field.
After learning about your documents, the model uses the remaining portion of the training documents to test itself. The model training will display metrics to show how it performed.
Tip: Training can take a few minutes. You can close the Training Summary page and return later to view the results.
After the model is finished training and testing, you're shown a number of metrics measuring its performance. You'll use this information to determine if this model is ready to publish, or if you'd like to provide more documents or labels for the model to continue training.
Some of these metrics might be more or less relevant based on your use case and the fields you expect to extract.
Learn more about evaluating model performance.
If the model's training metrics don't yet meet your requirements, you can continue training to try to boost the model's performance. Each time you retrain, you're creating a new model. Provide the new model with additional training documents to help it learn more about the document fields. Be sure your training documents represent the documents you expect to see in production.
Tip: Training a new model doesn't make the AI skill unavailable or otherwise impact a published model. The AI skill uses the existing published model until you publish a new one.
To continue training by creating a new model:
As you expand how you use machine learning models throughout your applications, you might wonder: when should I train a new model vs. creating an entirely new skill?
Keep in mind you can only publish one model for a skill. In practice, this means that a Extract from Document smart service will only be able to access one model for the skill the smart service is configured to use.
Also keep in mind that ML models are designed for a specific purpose. To help the model specialize and hone in on key traits in your document, consider creating one at the lowest level possible for your process. That is, if a single step in a process requires you to extract data from invoices, don't bother including fields for fields that appear on purchase orders. Adding this extraneous information will only serve to distract the model, so it's best to exclude. Instead, create fields specific to the documents you expect to extract from in your specific use case.
When the model's training metrics meet your requirements, you're ready to put it to use. Publish the model to make it available for use in your process, through the Extract from Document smart service.
You'll configure the Extract from Document smart service to use your AI skill. When the process reaches the smart service node, it uses the published model within the skill to analyze your document and extract field data.
Now you're ready to use your document extraction skill in a process.
Add the Extract from Document smart service and configure it to call your new skill.
You'll also want to add the Reconcile Doc Extraction smart service so a person can verify that the extracted table and checkbox data maps to the proper fields.
Learn more about how document extraction works in Appian.
Review the feature's compliance to ensure it aligns with your organization's security requirements.
Create a Document Extraction AI Skill