---
title: "Speed up first ICR run in C# | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/csharp/extraction/speed-up-first-icr-by-downloading-requirements/"
md_url: "https://www.nutrient.io/guides/dotnet/csharp/extraction/speed-up-first-icr-by-downloading-requirements.md"
last_updated: "2026-10-08T00:00:00.000Z"
description: "Predownload vision API models to eliminate first-request latency using Nutrient .NET SDK."
---

# Speeding up first ICR operation by predownloading models

Use warmup to pre-download vision models before processing documents.

Common use cases include:

- Removing first-request latency in user-facing apps

- Preparing batch jobs before processing starts

- Marking containers ready only after dependencies are available

- Preloading models before offline operation

- Meeting latency targets for production APIs

This guide shows how to warm up ICR models so `ExtractContent()` runs without initial download delays.

[Download sample](https://www.nutrient.io/downloads/samples/csharp/speed-up-first-icr-by-downloading-requirements.zip)

## How Nutrient helps

Nutrient.NET SDK handles model download orchestration and cache management.

The SDK handles:

- Model downloads and cache storage details

- Engine-specific model dependencies

- Download retries and transient failure handling

- Readiness checks for model availability

## Complete implementation

This example warms up ICR models and then runs extraction:

```csharp

using Nutrient;

```

## Warming up Vision API

Open a document with a [using statement](https://learn.microsoft.com/dotnet/csharp/language-reference/statements/using), set the engine to ICR, create a vision instance, and call `Warmup()`.

In this sample:

- Setting `Engine` to `VisionEngine.Icr` selects ICR mode.

- `vision.Warmup()` downloads required models.

- Models are cached for subsequent requests.

- Console output shows progress.

```csharp

try
{
    using Document document = Document.Open("input.png");
    // Configure ICR engine
    document.Settings.VisionSettings.Engine = VisionEngine.Icr;

    // Create Vision instance
    var vision = Vision.Set(document);

    // Pre-download all required models
    // This ensures subsequent ExtractContent() calls are fast
    Console.WriteLine("Downloading Vision models...");
    vision.Warmup();
    Console.WriteLine("Models ready!");

```

## Processing documents after warmup

After warmup, run `ExtractContent()` without download latency.

In this sample:

- `ExtractContent()` returns a JSON string.

- The JSON output is written to `output.json`.

- The `using` statement releases the document handle.

```csharp

    // Now ExtractContent() won't need to download anything
    string contentJson = vision.ExtractContent();

    File.WriteAllText("output.json", contentJson);
}
catch (NutrientException e)
{
    Console.Error.WriteLine($"Error: {e.Message}");
    Environment.Exit(1);
}

```

## Best practices

Apply these patterns for using warmup effectively in production environments:

- **Application startup** — Run warmup before accepting requests.

- **Background task** — Run warmup asynchronously during initialization.

- **Health checks** — Expose warmup status in readiness probes.

- **Deployment pipelines** — Validate model availability during deployment.

- **Offline environments** — Download models while connected, then process offline.

## What gets downloaded?

Warmup downloads model sets based on the configured vision engine:

- **ICR mode** (`VisionEngine.Icr`) — Layout, text, tables, equations, and key-value detection models

- **OCR mode** (`VisionEngine.AdaptiveOcr`) — OCR language and text recognition resources

- **VLM-enhanced mode** (`VisionEngine.VlmEnhancedIcr`) — ICR resources plus VLM-related resources

Downloaded models are cached locally and reused across restarts until the cache is cleared or models are updated.

## Conclusion

Use this workflow to pre-download ICR requirements:

1. Open a document with a `using` statement for automatic resource cleanup after warmup and processing complete.

2. The SDK supports multiple document formats, including PNG, JPEG, PDF, and TIFF for vision operations.

3. Configure the vision engine with `Settings.VisionSettings.Engine`.

4. Set the engine to ICR with `VisionEngine.Icr` to enable advanced document understanding with layout detection, text recognition, table extraction, equation recognition, and key-value pair detection.

5. Alternative engines include OCR mode for basic text extraction and VLM-enhanced mode for semantic understanding with vision language models.

6. Create a vision instance with `Vision.Set()` bound to the document with configured engine settings.

7. Call `vision.Warmup()` to trigger pre-download of all AI models required for the configured vision engine, fetching models from the SDK's model repository and caching them locally.

8. Warmup downloads different model sets based on engine configuration — ICR downloads comprehensive document understanding models, OCR downloads text recognition models, and VLM downloads ICR models plus semantic understanding resources.

9. Console output provides feedback during model downloads, informing users about download progress and completion status for potentially multi-second operations.

10. After warmup completes, call `vision.ExtractContent()` to perform ICR operations without model download delays, ensuring predictable and fast processing for all subsequent requests.

11. The `ExtractContent()` method returns extracted content as JSON, including document structure (headings, paragraphs, tables, lists), textual content, table structures, equations, and key-value pairs.

12. Write the extracted JSON to a file for downstream processing.

13. Handle `NutrientException` failures for vision processing issues, including model download errors, processing failures, or configuration issues.

For related image extraction workflows, refer to the [.NET SDK guides](https://www.nutrient.io/guides/dotnet/csharp.md).

Download [this ready-to-use sample package](https://www.nutrient.io/downloads/samples/csharp/speed-up-first-icr-by-downloading-requirements.zip) to integrate warmup into application startup.
---

## Related pages

- [Nutrient .NET SDK extraction guides](/guides/dotnet/csharp/extraction.md)
- [Applying OCR to a PDF page](/guides/dotnet/csharp/extraction/apply-ocr-to-pdf-page.md)
- [Applying OCR to a PDF document](/guides/dotnet/csharp/extraction/apply-ocr-to-pdf.md)
- [Classifying documents](/guides/dotnet/csharp/extraction/classify-document.md)
- [Generating image descriptions using Claude](/guides/dotnet/csharp/extraction/describe-image-with-claude.md)
- [Generating image descriptions using local AI](/guides/dotnet/csharp/extraction/describe-image-with-local-ai.md)
- [Generating image descriptions using OpenAI](/guides/dotnet/csharp/extraction/describe-image-with-openai.md)
- [Detecting document language](/guides/dotnet/csharp/extraction/detect-document-language.md)
- [Extracting data from images using ICR](/guides/dotnet/csharp/extraction/extract-data-from-image-icr.md)
- [Extracting data from images using OCR](/guides/dotnet/csharp/extraction/extract-data-from-image-ocr.md)
- [Extracting data from images using vision language models](/guides/dotnet/csharp/extraction/extract-data-from-image-vlm.md)
- [Extracting data from specific pages](/guides/dotnet/csharp/extraction/extract-data-from-specific-pages.md)
- [Extracting form fields from images](/guides/dotnet/csharp/extraction/extract-form-fields-from-image.md)
- [Extracting structured data from documents](/guides/dotnet/csharp/extraction/extract-structured-data.md)
- [Generating extraction schemas](/guides/dotnet/csharp/extraction/generate-extraction-schema.md)
- [Extracting JSON data from a PDF document](/guides/dotnet/csharp/extraction/json-data-extraction.md)
- [Labeling form fields with a vision language model](/guides/dotnet/csharp/extraction/label-form-fields-with-vlm.md)
- [Parsing a document into structured content](/guides/dotnet/csharp/extraction/parse-document.md)
- [Extracting text from PDF documents](/guides/dotnet/csharp/extraction/pdf-to-text.md)
- [Reading barcodes with vision extraction](/guides/dotnet/csharp/extraction/read-barcodes-with-vision.md)
- [Extracting text from multilingual images](/guides/dotnet/csharp/extraction/read-text-from-image-multi-language.md)
- [Extracting text from images](/guides/dotnet/csharp/extraction/read-text-from-image.md)
- [Searching document text](/guides/dotnet/csharp/extraction/search-document-text.md)

