Skip to content

Commit f461356

Browse files
committed
fix:give rewrite the authority to delete hypo
1 parent 697bf4a commit f461356

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

rdagent/scenarios/data_science/proposal/exp_gen/prompts_v2.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,16 @@ hypothesis_rewrite:
300300
## Task
301301
Transform each **original hypothesis and its critique** into a **single, specific, testable technical hypothesis** that can be implemented immediately.
302302
303+
You have the authority to delete hypotheses that you judge to be completely infeasible or unsuitable. Use this authority carefully and judiciously and ensure at least one hypothesis remains in your output.
304+
303305
## Core Principles
304306
1. **Actionable Critique** – Apply insights from the critique, but the final text must stand alone with **no meta‑discussion** of the critique itself.
305307
2. **Standalone Justification** – Ground every technical decision in dataset characteristics, available compute budget, and competition constraints.
306308
3. **Decisive Specificity** – Remove all ambiguity; propose one clear action.
307309
4. **Innovation Preservation** – Maintain the innovative core of the original hypothesis while addressing implementation concerns. Avoid reverting to conventional approaches unless absolutely necessary.
308310
5. **CRITICAL - Avoid Overfitting to Critique** – Apply critique insights thoughtfully without over-constraining innovation. Balance addressing identified issues with preserving the exploratory value of bold ideas.
309-
{% if enable_scale_check %}6. The user is currently working on a continuous exploration on the task. It's typical that we first try in small scale and in some certain point we will scale up the solution.
311+
6. **Hypothesis Deletion Authority** – You have the authority to delete hypotheses that you judge to be completely infeasible or unsuitable. Use your judgment, but ensure at least one hypothesis remains.
312+
{% if enable_scale_check %}7. The user is currently working on a continuous exploration on the task. It's typical that we first try in small scale and in some certain point we will scale up the solution.
310313
The user will tell you how much time have they spent on the task so far and all the former trials. You should consider whether to scale up the solution based on the current situation. You should put this conclusion in each hypothesis's appendix section.
311314
Typical scaling method includes:
312315
- Increasing the model architecture complexity.

rdagent/scenarios/data_science/proposal/exp_gen/proposal.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -780,19 +780,25 @@ def hypothesis_rewrite(
780780

781781
improved_hypotheses_dict = json.loads(response)
782782

783-
# Validate that we have rewritten hypotheses for all original hypotheses
783+
# Validate rewritten hypotheses (now allows deletion of hypotheses)
784784
expected_problems = set(hypothesis_dict.keys())
785-
available_problems = set( # The code snippet provided is a comment in Python. It appears to be
786-
# a placeholder for a function or variable named
787-
# `improved_hypotheses_dict`. The actual implementation of this
788-
# function or variable is not provided in the code snippet.
789-
improved_hypotheses_dict.keys()
790-
)
785+
available_problems = set(improved_hypotheses_dict.keys())
786+
787+
# Check if all available problems are valid (subset of expected)
788+
if not available_problems.issubset(expected_problems):
789+
unexpected_problems = available_problems - expected_problems
790+
# Raise exception to trigger retry mechanism
791+
raise ValueError(f"Rewrite response contains unexpected problems. Unexpected: {unexpected_problems}")
791792

792-
if not expected_problems.issubset(available_problems):
793-
missing_problems = expected_problems - available_problems
793+
# Check if at least one hypothesis remains
794+
if len(available_problems) == 0:
794795
# Raise exception to trigger retry mechanism
795-
raise ValueError(f"Rewrite response missing expected problems. Missing: {missing_problems}")
796+
raise ValueError("Rewrite response deleted all hypotheses. At least one hypothesis must remain.")
797+
798+
# Log deleted hypotheses if any
799+
deleted_problems = expected_problems - available_problems
800+
if deleted_problems:
801+
logger.info(f"Deleted {len(deleted_problems)} hypotheses during rewrite: {deleted_problems}")
796802

797803
# Note: We don't preserve 'inspired' field from original hypotheses
798804
# because after critique and rewrite, the hypothesis may have changed significantly

0 commit comments

Comments
 (0)