Stably sort requests by increasing token length (ties preserve original index), then partition this sorted order into contiguous batches of at most max_batch_size. A batch costs launch_overhead + batch_count * maximum_length_in_batch. Minimize total cost.
Among equal total costs, prefer fewer batches; if still tied, choose the lexicographically smaller sequence of batch sizes from first to last (a smaller first differing batch wins). Return {"cost": minimum integer cost, "batches": lists of original request indices in execution order}. Empty input has cost 0 and no batches. This additive padding/launch model is specified for optimization practice, not a measured GPU latency model.