---
schema_version: "1"
id: 27c3ec195332e8e4c6b35766d9ac063d71fb43ad244c3fb5d0e0231d27bdd53c
title: Data Extraction Best Practices
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/idp/data-extraction-best-practices.md
canonical_url: https://docs.mulesoft.com/idp/data-extraction-best-practices
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 340acaebe94c268e46ac033bd34b723a9d7670120018e711281efe79e51f104a
description: MuleSoft Documentation Site
latest: true
---
---
product: IDP
---

# Data Extraction Best Practices

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

MuleSoft Intelligent Document Processing (IDP) uses multimodal AI models to extract, structure, and
normalize data from diverse document types. Follow these best practices to design effective prompts
and improve extraction accuracy.

## Prompt Engineering with Multimodal Models

MuleSoft IDP uses multimodal models to deliver high accuracy by processing visual and textual
information together. These models understand layouts, tables, and handwritten content more
effectively than traditional OCR engines.

Effective prompt design is essential for consistent extraction. When designing prompts:

- Define what needs to be extracted

- Provide examples so the model learns the pattern

- Specify the response structure for consistency

### Use Specific Instructions About the Fields to Read

Detailed, context-aware prompts help the model anchor to the correct visual region.

<table><colgroup><col> <col></colgroup><thead><tr><th>Incomplete Prompt</th><th>Detailed Prompt</th></tr></thead><tbody><tr><td><div><div><div><pre><code>Extract the origin area code.</code></pre></div></div></div></td><td><div><div><div><pre><code>Extract the Origin Area Code from the address section of the shipping document.
Examples: 'Origin Area Code: J02', 'Origin: JA15'.
Return only the code (such as J02 or JA15) without additional text.</code></pre></div></div></div></td></tr></tbody></table>

### Add Logic for Filtering

Define what to include and exclude to avoid misinterpretations.

The following example shows how to filter specific email fields and specify a JSON response format:

```none
Extract the primary email address labeled 'From' or 'Sender.'
Do not extract 'Reply-To' or 'CC' addresses.
Return result as JSON: { 'PrimaryEmail': 'example@email.com' }.
If none exists, return null.
```

### Focus on Table Context

For complex tables or merged cells, instruct the model to ignore nearby data and focus on headers.

The following example shows how to target a specific table column and handle merged cells:

```none
In the table labeled 'Vehicle Details,' extract only the New/Used Status from the 'Status' column.
Ignore dimension information.
If the value is in a merged cell, interpret the topmost label as the column header.
```

## Data Quality and Troubleshooting

If your prompts are well-structured but the results are still inconsistent, the issue may relate to
data quality rather than the model itself. Multimodal models process documents visually, so visual
clarity is vital for accuracy.

### Common Data Quality Issues

<table><colgroup><col> <col></colgroup><thead><tr><th>Issue</th><th>Description</th></tr></thead><tbody><tr><td><p>Resolution and Clarity</p></td><td><p>Low-resolution scans or blurred text can confuse the model’s vision layer.</p></td></tr><tr><td><p>Complex Layouts</p></td><td><p>Merged table columns or dense formatting can make it difficult for the model to distinguish between data fields.</p></td></tr><tr><td><p>Alignment Shifts</p></td><td><p>If headers are misaligned, the model might reference the wrong data column. For example, a scanned PDF where the header "Second Month of the Quarter" is shifted may lead to incorrect extractions.</p></td></tr></tbody></table>

### Troubleshooting Strategy

Use tools such as Google Gemini as a testing environment to visualize what the model sees. After you
understand how the model interprets a specific column or label, adjust your prompt to better target
the layout.

If fields that are correctly returned as not found show a low or 0% confidence score, the selected
model might provide self-reported confidence scores. Prompt tuning doesn’t reliably fix this
behavior. Simplify the document action or select a different model. See
[Confidence Scores by Model](https://docs.mulesoft.com/idp/supported-models#confidence-scores) for additional information.

## Checkbox Detection Best Practices

Multimodal models excel at recognizing checkboxes that are often unsupported by text-only engines.
To maximize accuracy for selection-based fields:

- Enable Image Recognition

  Set the document action to use Image Recognition mode in settings.

- Use Gemini 3.5

  This model is the current recommended standard for high-fidelity checkbox detection.

- Convert PDF to Image

  If your source file is a PDF, convert it to an image format such as JPG or PNG to ensure the model
  captures the visual "checked" state correctly.

- Validate thoroughly

  Test your document actions against a large, representative set of forms before moving to
  production to account for different checkbox styles.

> [!NOTE] Future models from Gemini and OpenAI are expected to improve checkbox detection accuracy.
> As new models are onboarded, they are tested and observations are shared on the
> [supported models](https://docs.mulesoft.com/idp/supported-models) page.

## See Also

- [Security Best Practices](https://docs.mulesoft.com/idp/security-best-practices)

- [Analyzing Documents Using Pre-Built Schemas](https://docs.mulesoft.com/idp/creating-document-actions)

- [Enhancing Data Extraction with Einstein](https://docs.mulesoft.com/idp/enhancing-data-extraction-with-einstein)

- [Example Einstein Prompts](https://docs.mulesoft.com/idp/example-einstein-prompts)

- [Supported Models](https://docs.mulesoft.com/idp/supported-models)

- [IDP Permissions](https://docs.mulesoft.com/idp/permissions)
