# Batch Inference

Batch inference in Valohai runs as a standard execution, letting you process datasets or file collections at scale without managing infrastructure.

### How it works

Batch inference uses the same execution system you use for training:

1. Define a step in `valohai.yaml` with your inference code
2. Specify inputs (model files and data to process)
3. Run the execution via CLI, API, or schedule it
4. Collect results from outputs

**Key advantage:** You already know this system. If you've run training jobs, you can run inference jobs.

### What you can do

* Process thousands of images, CSVs, or other file types
* Schedule recurring inference jobs (e.g., nightly predictions)
* Trigger inference via API when new data arrives
* Chain inference into pipelines after training completes
* Track inference metrics alongside training metrics

### Example use cases

**Image classification at scale** Process a directory of product images to tag inventory items.

**Batch predictions on tabular data** Run monthly churn predictions on your entire customer database.

**Document processing** Extract entities from legal documents or medical records in batches.

### When to use batch inference

Choose batch inference when:

* You're processing datasets, not individual requests
* Latency requirements are in minutes or hours, not milliseconds
* You want to leverage Valohai's execution tracking and versioning
* You need to schedule or automate inference runs

**Need lower latency?** Check out [Real-Time Endpoints](https://github.com/valohai/dokuhai/blob/main/real-time/concepts.md) for sub-second predictions.

### Next steps

See practical examples:

* [CSV Inference Example](https://github.com/valohai/dokuhai/blob/main/docs/csv-inference.md)
* [Image Inference Example](https://github.com/valohai/dokuhai/blob/main/docs/image-inference.md)

Or jump straight to defining your inference step in `valohai.yaml`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.valohai.com/serving-your-models/deploy-batch.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
