Design a Third-Party LLM Batch Job Orchestrator
Accept durable LLM jobs asynchronously, split submitted inputs into stable tasks, and deliver completion notifications after bounded synchronous provider execution.
Problem statement
For this exercise, assume operators can submit either an immutable input payload or an ordered list of existing task IDs.
For a submitted payload, accept the job asynchronously, split the input into hundreds of pieces, and store an immutable ordered task manifest before executing those pieces through a synchronous black-box LLM. Keep the original task-ID intake as an alternative path into the same job pipeline.
Each task is a JSON blob stored in MongoDB, a job contains at most 5,000 tasks, and a rate-limited provider request may contain at most 10 tasks. Operators can observe durable per-task progress and retrieve one terminal job result.
When the job reaches a terminal outcome, send its summary and result reference through the operator's configured notification channel. Define crash-safe segmentation, batching, admission, idempotency, retries, partial failures, result retention, and notification recovery.
For this exercise, the segmentation policy and notification transport are design choices: pin the segmentation version for repeatable recovery, and tolerate duplicate notification delivery using a stable event identity without recomputing completed LLM work. Model training and prompt authoring are out of scope.
What to build
- An operator can submit an immutable input payload or up to 5,000 existing task IDs, receive a durable job ID asynchronously, and have submitted input split into hundreds of stable ordered task pieces.
- The system schedules pending tasks into provider requests of at most 10 tasks while respecting tenant and provider limits.
- An operator can read job and per-task state, including queued, running, succeeded, failed, and retryable outcomes.
- An operator can retrieve durable per-task outputs and a terminal summary, and receive that summary plus its result reference through a completion notification. Preserve one authoritative result; provider execution and notification delivery may be at least once after ambiguous timeouts.
At scale
- Assume peaks of 100 new jobs per second and at most 5,000 tasks per job.
- Assume each tenant may have at most 200 concurrent provider requests and every request contains at most 10 tasks.
- Assume provider latency ranges from seconds to two minutes, and calls can time out after the provider accepted work.
- Status reads should complete within 500 milliseconds at p95; terminal task results are retained for 30 days.