Skip to main content
Batch prediction allows you to process large volumes of requests asynchronously, which is more cost-effective than real-time inference for bulk operations.

Vertex AI batch prediction

Vertex AI batch prediction is only available in Vertex AI, not the Gemini Developer API.

Create a batch job

Create a batch prediction job with automatic configuration:

Input sources

Vertex AI supports multiple input sources:

Gemini API batch prediction

Create with inline requests

Create a batch job with requests defined inline:

Create with file input

Create a batch job using an uploaded file:

Input file format

The JSONL file should contain one request per line:

Get batch job status

Check the status of a batch job:

Poll for completion

Wait for a batch job to complete:

List batch jobs

List all batch jobs:

Pagination

Navigate through pages of batch jobs:

Async listing

With pagination:

Delete batch jobs

Delete a completed batch job:

Working with GCS paths

Vertex AI batch jobs use Google Cloud Storage for input and output:

Batch job states

Batch jobs progress through these states:
  • JOB_STATE_PENDING - Job is queued
  • JOB_STATE_RUNNING - Job is processing
  • JOB_STATE_SUCCEEDED - Job completed successfully
  • JOB_STATE_FAILED - Job failed with errors
  • JOB_STATE_CANCELLED - Job was cancelled
  • JOB_STATE_PAUSED - Job is temporarily paused

Best practices

  • Use batch prediction for large volumes of requests (100+)
  • Monitor job state regularly to detect failures early
  • Store input data in GCS for Vertex AI jobs
  • Set up proper IAM permissions for GCS access
  • Delete completed jobs to clean up resources
  • Use appropriate polling intervals (30-60 seconds)
  • Validate your input format before submitting large jobs