Optimizing requests to Azure Document Intelligence (prebuild-receipt model)

Erik Åkerberg 0 Reputation points
2025-10-23T14:18:52.5433333+00:00

Hi,

I have a pretty standard use case for the Document Intelligence AI, in that I want to parse table data (like the cost items with their price and quantity, restaurant name, date, total sum) from receipts.

Currently the request is taking around 6-7 seconds and I was wondering if there are some optimizations I can make - e.g. maybe pass along certain option-parameters that makes the model be a bit "lighter" in its analysis or pre-process the images or something else - since, like I mentioned, my use case seems pretty basic.

Thanks!

Azure AI Document Intelligence
{count} votes

1 answer

Sort by: Most helpful
  1. Nikhil Jha (Accenture International Limited) 2,220 Reputation points Microsoft External Staff Moderator
    2025-10-23T16:38:57.7466667+00:00

    Hello Erik Åkerberg,

    I understand you are looking to optimize latency for your model analysis.

    First, to set a clear expectation: a processing time of 6-7 seconds is within the normal and expected range for the prebuilt-receipt model. And to answer your first question directly: No, there are no parameters to make the prebuilt-receipt model "lighter" or run a partial analysis. However, you can absolutely optimize the total time of the operation.

    Here are the recommended strategies/ workaround to try:

    1. Use the Asynchronous Pattern (I would recommend)

    Instead of making one long, blocking call and waiting 7 seconds for the result, you should:

    1. POST your request to the .../analyze endpoint. The service will respond immediately (in milliseconds) with a 202 Accepted status and an Operation-Location URL in the header.
    2. Your application is now free to do other work or show a "processing" UI to the user.
    3. GET (poll) the Operation-Location URL. It will return a running status. You can check this every 1-2 seconds.
    4. When the analysis is done (after 6-7 seconds), the poll will return a succeeded status, and the response body will contain your full JSON result.

    This is the most critical optimization you can make. It won't make the 6-7 second analysis itself faster, but it will make your application feel instantaneous to the user.

    2. Optimize Image Quality and Format

    This directly addresses your pre-processing idea and can shave time off the analysis.

    • Resolution: The model needs clear text, but it doesn't need a massive 10MB, 4K-resolution image. A very large file takes longer to upload and for the service to decode. The sweet spot is 150-300 DPI. Resizing images before sending is a good practice.
    • File Format: Use a compressed format like JPEG (for photos) or PNG. Avoid sending uncompressed formats like BMP or large TIFFs, as the upload and ingestion will be slower.
    • Clarity: While the model is robust, a blurry, crumpled, or poorly lit receipt will take the model longer to analyze. Pre-processing that straightens or improves the contrast of an image can help.

    3. Co-locate Your Azure Resources

    Ensure that the resource making the API call (e.g., your App Service, Azure Function, or VM) is deployed in the same Azure region as your Document Intelligence resource (e.g., both in East US 2). This minimizes the network round-trip time, which can easily add 1-2 seconds to every request if your resources are on opposite sides of the world.

    4. Use the Latest GA Model Version

    Always specify the latest stable, generally available (GA) model version in your API call. Newer models are not only more accurate but are often optimized for better performance.


    If I was helpful, kindly accept the answer and upvote for visibility to other community members remediation.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.