Summary
Batch inference runs many independent model requests as one asynchronous job and returns every result within a completion window instead of answering each request as it arrives. You give up latency and get a separate rate-limit pool and, on many providers, a lower per-token price. If no user is waiting on the answer and no request depends on another's output, the work is a batch candidate.
Batch LLM inference, also called offline inference, runs a fixed dataset through a model as one job, with nobody waiting on any single answer. A support team changes its ticket taxonomy and needs two million old tickets re-labeled. Looping over a real-time chat API works, but the backfill competes with production traffic for the same rate limits and pays interactive prices for answers nobody reads until next week.
This article separates batch jobs from engine batching, then covers when batch wins, what it costs, how a job runs, and how to divide traffic between the two modes. For the model itself, see how large language models work.
Two kinds of batching
Three terms get mixed up in LLM serving:
- The batch workload: You score a fixed dataset ahead of need and store the results. Classic ML does it with nightly Spark jobs or SageMaker batch transform. The LLM version is a provider batch API that accepts a file of requests and returns a file of results within a window.
- Batching inside the engine: The server groups concurrent requests into shared forward passes, first as static batches and now mostly through continuous batching. It runs in real-time serving too, and how LLM inference works covers the scheduler.
- Offline inference: Usually a synonym for the batch workload. In self-hosted stacks it also means running the engine as a library over a prompt list with no server in front, like vLLM's offline inference API.
A batch job changes when you get your answers; engine batching changes how many requests share each GPU step.
When batch beats real time
Four conditions make a workload a batch candidate:
- Nobody is waiting: No person or downstream service blocks on the answer.
- Requests are independent: No request needs another's output.
- Volume is large: Per-token price or rate limits actually bite.
- Results are stored: You read them later from a table or file.
Workloads that pass all four tend to fall into five groups:
- Evals: A benchmark or regression suite run across several candidate models, part of evaluating LLM quality before a switch.
- Classification and labeling: One short label per item. Use structured outputs with an
othervalue for items the taxonomy misses, and capmax_tokens(4 tokens fits a bare label; with a JSON schema, size the cap to the longest valid output). - Synthetic data and distillation: Training or eval sets generated by a larger model.
- Backfills: Extraction or summarization rerun over an archive after a prompt or schema change.
- Corpus embeddings: The same shape, though not every provider's batch endpoint accepts embedding requests.
Interactive chat, streaming, and agent loops where step N needs step N−1's output fail the test, because each line runs in isolation and nothing streams back. So does any deadline measured in minutes, since the completion window is a best-effort ceiling.
The cost and latency trade
You give up latency and control over timing. Results arrive when the job finishes, against a completion window of 24 hours on the major provider APIs. Together AI's are a best-effort target that complex or popular models can occasionally exceed, though jobs under 1,000 requests typically finish in minutes. Nothing streams, and results arrive in arbitrary order.
In return you get a rate-limit pool separate from real-time traffic, so a backfill can't throttle production, plus a deeper queue (Together allows up to 30B tokens enqueued per model). Many providers also price batch below real time, often at half, but discounts vary by model, so check which models carry a discount in the batch API overview.
Take the ticket backfill at illustrative rates (not a price quote) of \$0.20 per 1M input tokens and \$0.60 per 1M output tokens. Two million tickets at ~600 tokens each is 1.2B input tokens, and 1,200M × \$0.20 per 1M = \$240. Capped at 4 output tokens, the labels add at most 8M tokens and under \$5, for ~\$245 in total. The same overview recommends that cap for labels, with temperature 0.
Let the model explain each label in ~200 tokens and output grows to 400M tokens and \$240, so the bill roughly doubles to ~\$480. A 50% batch discount, where one applies, halves either total. The output cap saves about as much as the discount does, and the two stack.
How a batch job runs
The lifecycle below follows Together's step-by-step batch tutorial, which has the SDK, CLI, and REST code; other providers use similar steps under different field names.
- Write a JSONL file with one request per line, each holding a
custom_idyou choose (up to 64 characters) and abodyin the endpoint's normal request schema - Upload it as a file with purpose
batch-api - Create the job against an endpoint, like
/v1/chat/completionsfor chat - Poll every 30 to 60 seconds while the status moves through
VALIDATINGandIN_PROGRESStoCOMPLETED,FAILED,EXPIRED, orCANCELLED - Download the output file and the error file, then join both to your inputs on
custom_id
Two lines of the ticket job's input file look like this:
{"custom_id": "ticket-48213", "body": {"model": "<serverless-model-id>", "messages": [{"role": "system", "content": "Reply with one label: billing, login, bug, other."}, {"role": "user", "content": "I was charged twice this month."}], "max_tokens": 4, "temperature": 0}}{"custom_id": "ticket-48214", "body": {"model": "<serverless-model-id>", "messages": [{"role": "system", "content": "Reply with one label: billing, login, bug, other."}, {"role": "user", "content": "The reset link never arrives."}], "max_tokens": 4, "temperature": 0}}The docs bury a few failure modes:
- A malformed file: Invalid JSONL fails the entire job in
VALIDATING, so validate the file locally before uploading. - An oversized line: A line over 10 MB, like one carrying an inline base64 image, is not caught during validation and fails later with
error reading input file. Reference images by URL. - Partial failure: A
COMPLETEDjob can still contain failed requests, because per-request errors don't change the job status. Always read the error file. - Billing: Only successful responses are billed, and cancelling doesn't refund lines that finished before the cancel landed.
- Retention: Input, output, and error files stop being accessible after 7 days.
Each job takes up to 50,000 requests from an input file of up to 100 MB.
Splitting the workload
Route each request by its latency budget. A waiting user goes to the real-time API. A result that can wait hours goes to batch. Steady, high volume around the clock belongs on a dedicated endpoint, because past a certain throughput a flat GPU-hour beats any per-token price. In the illustrative example from choosing a deployment option, an H100 at ~\$3/hour (\$72/day) matches serverless at \$1 per 1M tokens at ~72M tokens/day. Extending that example, a batch discount that halves the per-token rate puts the crossover at ~144M tokens/day, which keeps serverless AI inference competitive for longer.
Three habits save rework in the batch lane:
- Shard the file: The docs recommend 1,000 to 10,000 requests per job, so 2M tickets become at least 200 jobs of 10,000. At roughly 4 characters per token, a ~600-token line is ~2.5 KB, so the 100 MB cap binds near 40,000 lines, before the 50,000-request cap.
- Chain dependent steps: "Summarize, then classify the summary" is two jobs in sequence, because no line sees another's output.
- Retry by ID: Resubmit only the
custom_ids from the error file, and encode each record's key in its ID so a rerun overwrites its own row.
Self-hosted offline inference is the last option, for custom engine settings, data that stays in your cluster, or volume beyond an API queue. You then own retries and checkpointing. Checkpointed work suits preemptible GPU nodes (in public preview as of October 2026), which drain for at most 5 minutes before reclamation.
Conclusion
Run the dependency test before moving anything off the real-time API. Cap output tokens before you look for a discount. Treat the error file as part of every result set, and size jobs in the thousands of requests so a file that fails validation only sinks its own shard. When you're ready to run one, Together AI's batch inference API accepts the JSONL format shown above.
FAQ
What is the difference between batch inference and real-time inference? The model is the same, and delivery is what changes. Real time answers each request while a client waits; batch takes a file and returns results within a window, often at a lower price.
Is batch inference the same as offline inference? Mostly. The term also covers running a self-hosted engine, like vLLM's LLM class, over a prompt list.
Is a batch job the same as continuous batching? No. Continuous batching is the server's scheduler, used for real-time traffic too, and a batch job is a delivery mode on top of it.
How long does a batch job take? It depends on file size and model demand. A few hundred requests can clear in minutes, while the 24-hour window is a soft ceiling that jobs on in-demand models occasionally pass, so watch the job status, which stays IN_PROGRESS while work continues.
Do batch results differ from real-time results? Not by design. Determinism isn't guaranteed even at temperature 0, because outputs can shift across replicas, model versions, and load conditions, and seed is best-effort, so don't expect byte-identical reruns.

.png)







.png)



.png)
.png)




































