A labeled dataset of documents is required to train, up-train, or evaluate a processor version.
This page describes how to apply labels from your processor schema to imported documents in your dataset.
This page assumes you have already created a processor that supports training, up-training, or evaluation. If your processor is supported, you now see the Train tab in the Google Cloud console. It also assumes you have created a dataset, imported documents, and defined a processor schema.
Name fields for generative AI extraction
The way fields are named influences how accurately fields are extracted using generative AI. We recommend the following best practices when naming fields:
Name the field with the same language used to describe it in the document: For example, if a document has a field described as
Employer Address, then name the fieldemployer_address. Don't use abbreviations such asemplr_addr.Spaces are currently not supported in field names: Instead of using spaces, use
_. For example:First Namewould be namedfirst_name.Iterate on names to improve accuracy: Document AI has a limitation that does not allow field names to change. To test different names, use the renaming entity name tool to update the old entity's name with a newer one in the dataset, import the dataset, enable the new entities in the processor, and disable or delete the existing fields.
Zero-shot and few-shot learning
Models with Gemini have zero-shot and few-shot learning, which can create high-performing models with little to no training data.
Zero-shot learning is a machine learning example where a pre-trained model without any up-training learns to recognize and classify classes and entities which it hasn't encountered before during testing.
Few-shot learning is a where a model learns to recognize and classify new classes and entities with only a few training examples per class. It leverages knowledge from pre-trained models on large, well-labeled datasets to improve performance on few-shot tasks.
Few-shot becomes more effective when the training dataset is tidy and carefully labeled. Typically, this means having at least 10 testing and 10 training examples available for the model to learn from.
Labeling options
Here are your options for labeling documents:
Manual: manually label your documents in the Google Cloud console
Auto-labeling: use an existing processor version to generate labels
Import pre-labeled documents: save time if you already have labeled documents
Manually label in the Google Cloud console
In the Train tab, select a document to open the labeling tool.
From the list of schema labels on the left side of the labeling tool, select the 'Add' symbol to select the Bounding box tool to highlight entities in the document and assign them to a label.
In the following screenshot, the EMPL_SSN EMPLR_ID_NUMBER, EMPLR_NAME_ADDRESS,
FEDERAL_INCOME_TAX_WH, SS_TAX_WH, SS_WAGES, and WAGES_TIPS_OTHER_COMP
fields in the document have been assigned labels.

When you select a checkbox entity with the Bounding box tool, only select the checkbox itself, and not any associated text. Ensure that the checkbox entity shown on the left is either selected or deselected to match what is in the document.

When you label parent-child entities, don't label the parent entities. The parent entities are just containers of the child entities. Only label the child entities. The parent entities are updated automatically.
When you label child entities, label the first child entity and then associate the related child entities with that line. You notice this at the second child entity the first time you label such entities. For example, with an invoice, if you label description, it seem like any other entity. However, if you label quantity next, you are prompted to pick the parent.
Repeat this step for each line item by selecting New Parent Entity for each new line item.
Parent-child entities are supported for tables with up to three layers of nesting. Foundation models support three tiers of fields (grandparent, parent, child), so child entities can have one level of children. To learn more about nesting, refer to Three-level nesting.
Quick tables
When labeling a table, it could be tedious to label each row over and over again. There is a very convenient tool that can replicate a row entity structure. Note that, this feature only works on horizontally aligned rows.
- First, label the first row as usual.
Then, hold the pointer over the parent entity representing the row. Select Add more rows. The row becomes a template to create more rows.