4646 COVERAGE_THRESHOLD ,
4747 INDIVIDUAL_TESTCASE_TIMEOUT ,
4848 MAX_REPAIRS_PER_TRACE ,
49+ MODEL_DISTRIBUTION_EFFECTIVE ,
50+ MODEL_DISTRIBUTION_LP_EFFECTIVE ,
4951 N_CANDIDATES_EFFECTIVE ,
5052 N_CANDIDATES_LP_EFFECTIVE ,
5153 N_TESTS_TO_GENERATE_EFFECTIVE ,
@@ -921,18 +923,20 @@ def determine_best_candidate(
921923 ai_service_client = self .aiservice_client if exp_type == "EXP0" else self .local_aiservice_client
922924 assert ai_service_client is not None , "AI service client must be set for optimization"
923925
926+ # Use multi-model approach for line profiler optimization
924927 future_line_profile_results = self .executor .submit (
925- ai_service_client .optimize_python_code_line_profiler ,
928+ ai_service_client .optimize_python_code_line_profiler_multi_model ,
926929 source_code = code_context .read_writable_code .markdown ,
927930 dependency_code = code_context .read_only_context_code ,
928- trace_id = self .get_trace_id (exp_type ),
931+ base_trace_id = self .get_trace_id (exp_type ),
929932 line_profiler_results = original_code_baseline .line_profile_results ["str_out" ],
930- num_candidates = N_CANDIDATES_LP_EFFECTIVE ,
933+ model_distribution = MODEL_DISTRIBUTION_LP_EFFECTIVE ,
931934 experiment_metadata = ExperimentMetadata (
932935 id = self .experiment_id , group = "control" if exp_type == "EXP0" else "experiment"
933936 )
934937 if self .experiment_id
935938 else None ,
939+ executor = self .executor ,
936940 )
937941
938942 processor = CandidateProcessor (
@@ -1353,17 +1357,17 @@ def generate_optimizations(
13531357 read_only_context_code : str ,
13541358 run_experiment : bool = False , # noqa: FBT001, FBT002
13551359 ) -> Result [tuple [OptimizationSet , str ], str ]:
1356- """Generate optimization candidates for the function."""
1357- n_candidates = N_CANDIDATES_EFFECTIVE
1358-
1360+ """Generate optimization candidates for the function using multiple models in parallel."""
1361+ # Use multi-model approach for diversity
13591362 future_optimization_candidates = self .executor .submit (
1360- self .aiservice_client .optimize_python_code ,
1363+ self .aiservice_client .optimize_python_code_multi_model ,
13611364 read_writable_code .markdown ,
13621365 read_only_context_code ,
13631366 self .function_trace_id [:- 4 ] + "EXP0" if run_experiment else self .function_trace_id ,
1364- n_candidates ,
1367+ MODEL_DISTRIBUTION_EFFECTIVE ,
13651368 ExperimentMetadata (id = self .experiment_id , group = "control" ) if run_experiment else None ,
13661369 is_async = self .function_to_optimize .is_async ,
1370+ executor = self .executor ,
13671371 )
13681372
13691373 future_references = self .executor .submit (
@@ -1380,13 +1384,14 @@ def generate_optimizations(
13801384
13811385 if run_experiment :
13821386 future_candidates_exp = self .executor .submit (
1383- self .local_aiservice_client .optimize_python_code ,
1387+ self .local_aiservice_client .optimize_python_code_multi_model ,
13841388 read_writable_code .markdown ,
13851389 read_only_context_code ,
13861390 self .function_trace_id [:- 4 ] + "EXP1" ,
1387- n_candidates ,
1391+ MODEL_DISTRIBUTION_EFFECTIVE ,
13881392 ExperimentMetadata (id = self .experiment_id , group = "experiment" ),
13891393 is_async = self .function_to_optimize .is_async ,
1394+ executor = self .executor ,
13901395 )
13911396 futures .append (future_candidates_exp )
13921397
@@ -1395,7 +1400,7 @@ def generate_optimizations(
13951400
13961401 # Retrieve results
13971402 candidates : list [OptimizedCandidate ] = future_optimization_candidates .result ()
1398- logger .info (f"!lsp|Generated '{ len (candidates )} ' candidate optimizations." )
1403+ logger .info (f"!lsp|Generated '{ len (candidates )} ' candidate optimizations from multiple models ." )
13991404
14001405 if not candidates :
14011406 return Failure (f"/!\\ NO OPTIMIZATIONS GENERATED for { self .function_to_optimize .function_name } " )
0 commit comments