OpenAI
OP
Data Labeling Task Scheduler
Coding
Problem
Problem Overview
This OpenAI Machine Learning Engineer question was reported as a multi-part coding problem about constructing a schedule for data labeling work.
- Part 1 is the easy version: build any valid schedule.
- Part 2 adds stronger fairness constraints that must hold at every prefix of the returned list.
- Part 3 is a streaming followup: tasks arrive in daily batches and the scheduler must update incrementally.
Problem Statement
You are given:
ttasks, indexed0..t-1mmodels, indexed0..m-1hhuman labelers, indexed0..h-1- a target
k
Return a scheduling, represented as a list of tuples:
(task, model, human)
Each tuple means:
- human
humanworks on tasktask - that assignment is paired with model
model
Your schedule must satisfy:
- Every human labeler participates in at least
kassignments total. - Every
(task, human)pair appears at most once. - For every task
x, and for every prefix of the schedule, the counts across models stay balanced:
max_i count_prefix(x, model=i) - min_i count_prefix(x, model=i) <= 1
- For every task
x, and for every prefix of the schedule, the counts across humans also stay balanced:
max_j count_prefix(x, human=j) - min_j count_prefix(x, human=j) <= 1
If no valid schedule exists, return failure in whatever form your language uses (None, empty list, exception, etc.).
Part 1: Build Any Valid Schedule
Ignore the prefix-balance constraints for now. Just return any schedule such that:
- each human appears at least
ktimes - each human works on a given task at most once
Part 2: Prefix-Balanced Schedule
Now add the stronger requirement that the schedule must remain balanced at every intermediate point, not just at the end.
This sounds more complicated than it is. The clean construction is:
- Schedule work in exactly
krounds. - In each round, every human gets exactly one assignment.
- Rotate tasks cyclically so each human sees a new task each round.
- For each task, assign models in local round-robin order.
Solution
Loading editor…
Sign in to get AI feedback on your answer. Your work is saved while you do.
Sign in to evaluate