Introduction
Long Document Information Extraction is a self-learning information extraction task based on deep learning. It lets you define custom fields for extraction. The platform provides visual guides to help you annotate data and train models. This process enables high-precision extraction from unstructured documents with various layouts.
For high-quality images, fine-tuning a model with over 100 annotated training samples achieves an accuracy rate of over 85%.
Benefits
High precision: Using Alibaba Cloud's powerful pre-trained models, fine-tuned models for multiple layouts can achieve an accuracy rate of over 85%.
Few-shot learning: You can optimize and iterate models by annotating only a small amount of data. The models also have good generalization capabilities.
Low barrier to entry: You can use the feature out-of-the-box without writing any code and configure rules independently through a user-friendly and controllable interface.
High efficiency: The platform provides intelligent pre-annotation capabilities, which shortens the time required for collaborative annotation by multiple users.
Scenarios
High-performance model: Suitable for documents with simple styles or formats, such as documents that contain only titles and paragraphs. Supported document formats include PDF and images. This model is applicable to scenarios such as certificates, official papers, files, letters, and announcements.
Hybrid-layout model: Suitable for documents with rich styles or formats, such as documents that include titles, paragraphs, tables, and forms. Supported document formats include PDF and images. This model is applicable to scenarios such as contracts, bids, insurance policies, and engineering forms.
Long documents that require continuous optimization and have many data samples (more than 20) available for model training to improve performance.
Related links
OCR Document AutoML: Console
Long Document Information Extraction model task developer guide: Online debugging, API operation documentation (asynchronous invocation API operation documentation), and SDK documentation
Operation guide
For a video tutorial on how to use Long Document Information Extraction, see the following video:
The following figure shows the workflow for creating a Long Document Information Extraction task. You need more than 20 images for training to complete model creation.

Step 1: Prepare data
In the **Data Center** > **Datasets** section, you can upload and manage the data required for your model task. Click **Add Dataset** to open the upload interface, edit the dataset name, and upload your business data.
To achieve better recognition and extraction results, a custom Long Document Information Extraction model requires at least 50 training images.
Step 2: Annotate data
Data annotation is divided into three main steps: creating an annotation task, annotating data, and performing a quality check.
Create an annotation task
On the **Data Center** > **Annotation Tasks** page, click Create Annotation Task to open the creation page. Edit the Task Name and select a dataset or upload local files in the Upload Data section. After you finish, proceed to Field Settings.
Pre-annotation: After you enable OCR pre-annotation, the text content within a drawn box is automatically detected during annotation. This improves annotation efficiency.
Question Bank: A collection of predefined questions that you can use to create an annotation task.
Field Name: The name of the recognition field that is exposed externally. This corresponds to the name in the API operation. The field name must be globally unique.
Field Type: The property definition of the field. Selecting an appropriate field type can improve the end-to-end recognition result. You can select a common field or add a custom field. If no post-processing is needed, select a regular field type.
Annotate
In the **Data Center** > **Annotation Tasks** section, select the created annotation task and click Annotate to go to the Data Annotation page. In the annotation tool, use the Draw Box button to draw boxes around the fields to be detected. Select the corresponding field and carefully check the automatically detected text. After all images and their fields are annotated, click Submit Task to complete the annotation for this part.
The quality of the annotated data, including text and position, directly impacts the model's training performance and evaluation metrics.
If you encounter incorrect or un-annotatable data, you can skip that image.
Quality check
Go to the **Data Center** > **Annotation Tasks** page and select a completed annotation task to perform a quality check. The quality checker can modify or reject annotations. After all annotation tasks are completed, submit the task. Make sure that all fields have been annotated.
Step 3: Train and evaluate the model
Go to the **Model Hub** and click Create Model to open the model creation page. Select the annotation results for the training dataset and test dataset, and fill in the basic information. After the model is created successfully, model training starts automatically.
Pre-trained Model: Long Document Information Extraction currently supports two versions: **High-performance** and **Hybrid-layout**.
High-performance model: Suitable for documents with simple styles or formats, such as documents that contain only titles and paragraphs. Supported document formats include PDF and images.
Hybrid-layout model: Suitable for documents with rich styles or formats, such as documents that include titles, paragraphs, tables, and forms. Supported document formats include PDF and images.
Training Dataset: The data source used to train the model. You can only select datasets that have been annotated and quality-checked as the training dataset. Datasets already selected as a test dataset cannot be selected again. We recommend selecting more than 20 valid data samples for model training.
Test Dataset: The data source used to test the model. You can only select datasets that have been annotated and quality-checked as the test dataset. Datasets already selected as a training dataset cannot be selected again.
Automatically use 1/10 of the training dataset as the test dataset: If you enable this option, you do not need to manually select a test dataset. The system automatically partitions 1/10 of the training dataset to use as the test dataset. If a test dataset was already uploaded before you enabled this feature, the system will ignore the manually uploaded test dataset.
Model training fees and the estimated duration vary based on the task type and data volume. The values displayed on the interface are final.
Training Duration: This is determined by multiple factors, such as data volume, annotation status, and machine resources. For example, using a V100 machine, it takes about 1 minute to train on 60,000 characters.
Algorithm evaluation metrics: The metrics include overall metrics and field-specific metrics.
Overall metrics - Mean
Precision: The precision of the algorithm model before post-processing rules are applied. It is the ratio of correctly identified positive class samples to all samples identified as a positive class. The formula is: Number of correctly predicted fields / Total number of predicted fields. This metric measures how many of the predicted fields match the annotated content and position in the test dataset.

Recall: The recall rate of the algorithm model before post-processing rules are applied. It is the ratio of correctly identified positive class samples to all actual positive class samples. The formula is: Number of correctly predicted fields / Total number of actual correct fields.

F1-score: A comprehensive evaluation metric (F1-Measure). It is the weighted harmonic mean of precision and recall and is often used to evaluate the performance of a classification model.

Field-specific metrics
Precision: The precision of the algorithm model before post-processing rules are applied. In the test dataset, this is the number of correct fields for a specific field type / the total number of predicted fields for that field type.

Recall: The recall rate of the algorithm model before post-processing rules are applied. In the test dataset, this is the number of correct fields for a specific field type / the total number of actual correct fields for that field type.

F1-score: A comprehensive evaluation metric (F1-Measure) before post-processing rules are applied. In the test dataset, it is the weighted harmonic mean of precision and recall.

Step 4: Deploy the model
After model training is complete, go to **Model Hub** > **Model Details** and click the **Deploy** button at the bottom of the page to start model deployment. Model deployment takes some time. After the deployment is successful, you can test the model's performance on the online testing page or call the online service directly using the API.
After you publish and deploy the model service, you can use the service. For more information, see the API overview document. You can also go to the Online Use page to test the model's performance.
OCR Document AutoML started its full commercialization on August 23, 2023. Model training is billed by duration, and model inference is billed by the number of calls. For more information, see OCR Document AutoML billing.
Widget - Question Bank
Field Library: The field library is used in the **Field Settings** step. You can pre-create fields for annotation tasks, and these fields can be referenced multiple times. If multiple annotation tasks require the same fields, you can select them from the field library. This reduces the manual effort of editing fields multiple times and lowers the risk of editing errors.
Modifying the field library does not affect annotation tasks or models that have already been initiated.

