SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]
Enh(reviewer): Take shortest solution if multiple max scores
Kilian Lieretdab9ca4651a1
diff --git a/sweagent/agent/reviewer.py b/sweagent/agent/reviewer.pyindex 07ba80d1..41892236 100644--- a/sweagent/agent/reviewer.py+++ b/sweagent/agent/reviewer.py@@ -400,7 +400,11 @@ class ScoreRetryLoop(AbstractRetryLoop):return Nonescores = [r.accept for r in self._reviews]self.logger.debug(f"Scores: {scores}")- chosen_idx = max(range(len(scores)), key=scores.__getitem__)+ max_score = np.max(scores)+ max_indices = [i for i, s in enumerate(scores) if np.isclose(s, max_score)]+ # If there are multiple submissions with the same score, choose the shortest one+ max_indices = sorted(max_indices, key=lambda i: self._submissions[i].model_stats.api_calls or float("inf"))+ chosen_idx = max_indices[0]self.logger.info(f"Best submission: {chosen_idx}")return chosen_idx