The optimal batch size is calculated using the formula:
Optimal Batch Size = (Desired Throughput / Token Processing Rate) * Max Tokens Per Batch