File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 55"""Task execution utilities for benchmark evaluation."""
66
77import asyncio
8+ import random
89from pathlib import Path
910from typing import List , Optional
1011
@@ -276,6 +277,11 @@ async def run_tasks(
276277 )
277278 print (f" pass@k={ pass_at_k } , max_retry={ max_retry } " )
278279
280+ # Shuffle tasks to avoid order bias and improve balancing
281+ # This prevents long-tail tasks from accumulating at the end
282+ shuffled_tasks = tasks .copy ()
283+ random .shuffle (shuffled_tasks )
284+
279285 semaphore = asyncio .Semaphore (max_concurrent )
280286
281287 async def run_with_semaphore (task : Task ) -> TaskResult :
@@ -292,7 +298,7 @@ async def run_with_semaphore(task: Task) -> TaskResult:
292298 )
293299
294300 results = await asyncio .gather (
295- * [run_with_semaphore (task ) for task in tasks ],
301+ * [run_with_semaphore (task ) for task in shuffled_tasks ],
296302 return_exceptions = True ,
297303 )
298304
You can’t perform that action at this time.
0 commit comments