Skip to content
mentoor

Topic 2 of 4 · 4 min read

Choosing workloads that suit batching

Goal: Sort a list of workloads into batch, real-time or neither based on latency need, volume and deadline.

Use a batch when nobody is waiting, the requests are independent, and a delay of hours is acceptable; use real-time calls when a person or a live process needs the answer now. The decision is about latency need, not about how impressive the task is.

Check yourself · 1 of 3

Which job is the best fit for a batch API?

Choose one answer

Why it matters

Batching a user-facing feature breaks the product. Not batching a nightly backfill wastes money. Teams get both wrong, usually because they picked the API before asking who is waiting.

How to decide

Ask three questions in order.

  1. Is a person or a live system blocked on this answer? Chat replies, autocomplete, a support agent drafting a reply while a customer waits: real-time. A batch window of up to 24 hours cannot serve them.
  2. Are the requests independent? Each request must stand alone. If request 2 needs the output of request 1, you can still batch by stages, one batch per stage, but only when each stage has many items.
  3. Is there enough volume and a deadline that fits? Ten requests save a few cents and add polling code. Ten thousand save real money. The deadline must leave room for the full window, plus a rerun of anything that expired.

Good batch workloads

  • Evaluations. Run 5,000 test prompts against a new model or prompt version overnight.
  • Backfills. Add a summary or category to every record in an old table.
  • Bulk classification and extraction. Tag a year of support tickets or pull fields from scanned contracts.
  • Document processing. Summarise, translate or redact a folder of reports.

Before and after

Weak: a team routes everything through a batch because "batch is cheaper", including the reply suggestions in their helpdesk app. Agents wait hours for a suggestion, stop using it, and the feature dies.

Better: the helpdesk suggestions stay real-time. The same team batches the weekly job that tags last week's 30,000 resolved tickets by topic, which no one reads until Monday.

What goes wrong

  • Chaining without a plan. A multi-step agent loop where each step depends on the last cannot be batched as one job. Each round trip would cost up to a day.
  • Ignoring the deadline. A report due at 9:00 that you submit at 22:00 has no room for an expired batch. Submit early or keep a real-time fallback for the items that miss.
  • Batching tiny jobs. Below a few hundred requests the saving is smaller than the cost of building and testing the pipeline.

Examples

Sorting four workloads

Workload Choice Reason
Chat reply in the app Real-time A user is waiting
Re-tag 200,000 old tickets Batch No one waits, high volume
Nightly eval of 3,000 prompts Batch Results needed by morning
Rename 12 files Neither A script does it with no model

One product, two paths

A contract tool extracts fields in real time while a lawyer has the file open. The same tool batches a nightly re-extraction of 8,000 archived contracts after a prompt change. Same model and prompt, different latency need.

Key points

  • Batch when no one is waiting, requests are independent and a delay of hours is acceptable.
  • Evaluations, backfills, bulk tagging and document processing are the classic batch jobs.
  • Anything a person or live process blocks on stays real-time.
  • Small jobs rarely repay the extra pipeline code.
  • A deadline needs room for the full window and a rerun of expired items.

Common mistakes

  • Batching a user-facing feature because the per-token price is lower.
  • Batching a workflow whose steps depend on each other's output, so each step waits up to a day.
  • Submitting a batch with a deadline that leaves no room for expired requests.
  • Using a model at all for a job a regular script handles exactly.

Check yourself · 2 of 3

A nightly job tags 5,000 records and the results are read at 09:00. Which choice is sensible?

Choose one answer

Check yourself · 3 of 3

A team wants to cut cost on a feature that returns product suggestions while shoppers browse. What is the right call?

Choose one answer

Practice items, not counted towards your mastery.

Start here