From 2201a4762343f2cc2deb3dff2b70baf99f102292 Mon Sep 17 00:00:00 2001 From: amstrongzyf <201840057@smail.nju.edu.cn> Date: Thu, 11 Sep 2025 16:14:48 +0800 Subject: [PATCH] fix: revert 2 commits (#1239) * revert commit:c51a3008f897416a7416f92d1286cbbf6a2291ae. PR 1179 * Revert "fix: change runner prompts (#1223)" This reverts commit db2ebc27d70663d6aa85e0b05d9b81f5f6443c17. * fix ruff check error * fix: change switch place for fix_seed_and_data_split --- .../coder/data_science/pipeline/prompts.yaml | 6 +- rdagent/core/experiment.py | 4 +- .../scenarios/data_science/dev/feedback.py | 2 +- .../data_science/dev/runner/prompts.yaml | 6 +- rdagent/scenarios/data_science/loop.py | 6 +- .../data_science/proposal/exp_gen/__init__.py | 3 + .../proposal/exp_gen/package_info.py | 90 ++++--------------- .../proposal/exp_gen/prompts_v2.yaml | 38 +++----- .../data_science/proposal/exp_gen/proposal.py | 24 +---- .../data_science/proposal/exp_gen/utils.py | 13 --- .../scenarios/data_science/scen/__init__.py | 4 - .../scenarios/data_science/scen/prompts.yaml | 5 -- rdagent/scenarios/data_science/share.yaml | 16 ++-- 13 files changed, 53 insertions(+), 164 deletions(-) diff --git a/rdagent/components/coder/data_science/pipeline/prompts.yaml b/rdagent/components/coder/data_science/pipeline/prompts.yaml index bc2146d2..d376db30 100644 --- a/rdagent/components/coder/data_science/pipeline/prompts.yaml +++ b/rdagent/components/coder/data_science/pipeline/prompts.yaml @@ -13,9 +13,9 @@ pipeline_coder: {{ runtime_environment }} {% if package_info is not none %} - - To help you write the runnable code, the user has provided the package information which contains the package names and versions. - - You should be careful about the package versions, as the code will be executed in the environment with the specified version and the api might be different from the latest version. - - While the environment is fixed, you should not limit yourself to only the provided packages - feel free to explore other libraries that might better suit the task. However, prioritize using the available packages first, and only suggest alternatives when they would provide significant improvements or are more appropriate for the specific problem. + To help you write the runnable code, the user has provided the package information which contains the package names and versions. + You should be careful about the package versions, as the code will be executed in the environment with the specified version and the api might be different from the latest version. + The user might provide the packages the environment doesn't have, you should avoid using any of them. ## Package Information {{ package_info }} {% endif %} diff --git a/rdagent/core/experiment.py b/rdagent/core/experiment.py index e2f48aa9..43c79dc6 100644 --- a/rdagent/core/experiment.py +++ b/rdagent/core/experiment.py @@ -200,7 +200,7 @@ class FBWorkspace(Workspace): if workspace_data_file_path.exists(): workspace_data_file_path.unlink() if platform.system() in ("Linux", "Darwin"): - os.symlink(data_file_path, workspace_data_file_path) + workspace_data_file_path.symlink_to(data_file_path) if platform.system() == "Windows": os.link(data_file_path, workspace_data_file_path) @@ -336,7 +336,7 @@ class FBWorkspace(Workspace): if mode == symlink_mode: # Symlink dest_path.parent.mkdir(parents=True, exist_ok=True) link_target = zf.read(info).decode() - os.symlink(link_target, dest_path) + dest_path.symlink_to(link_target) elif info.is_dir(): dest_path.mkdir(parents=True, exist_ok=True) else: diff --git a/rdagent/scenarios/data_science/dev/feedback.py b/rdagent/scenarios/data_science/dev/feedback.py index aee557ea..8c9ca109 100644 --- a/rdagent/scenarios/data_science/dev/feedback.py +++ b/rdagent/scenarios/data_science/dev/feedback.py @@ -13,7 +13,7 @@ from rdagent.core.scenario import Scenario from rdagent.log.utils import dict_get_with_warning from rdagent.oai.llm_utils import APIBackend from rdagent.scenarios.data_science.experiment.experiment import DSExperiment -from rdagent.scenarios.data_science.proposal.exp_gen.base import DSTrace +from rdagent.scenarios.data_science.proposal.exp_gen import DSTrace from rdagent.scenarios.data_science.proposal.exp_gen.idea_pool import DSIdea from rdagent.utils import convert2bool from rdagent.utils.agent.tpl import T diff --git a/rdagent/scenarios/data_science/dev/runner/prompts.yaml b/rdagent/scenarios/data_science/dev/runner/prompts.yaml index d6a0c1e2..dabc4665 100644 --- a/rdagent/scenarios/data_science/dev/runner/prompts.yaml +++ b/rdagent/scenarios/data_science/dev/runner/prompts.yaml @@ -34,18 +34,16 @@ DSCoSTEER_eval: For example, if the code uses only a very small portion of the allowed time, and hyperparameters like `n_estimators` or `epochs` have low values, with early stopping not being triggered and possible signs of underfitting, you should suggest increasing these hyperparameters. You should also notice other resources utilization hyper-parameters. For example, if you are using a GPU with large memory, and the batch size is set very low, you should suggest increasing the batch size if it is not reasonable. - For example, prioritize adjustments to batch size and number of epochs. If further tuning is needed, consider parameters with significant impact on performance such as learning rate and the number of model folds. For CV competitions, also consider image size (imgsize), and for NLP competitions, consider maximum sequence length (maxlen), as these can have a substantial impact on results. + ## Evaluation Guidelines 1. The code execution time or resource utilization suggest that there is room for improvement in the hyperparameters. 2. The code must apply early stopping strategy already (in order to prevent overfitting). 3. Your suggestion should have a strong chance of improving the model's performance. Focus on the most obvious and impactful opportunities for quick improvement by leveraging more training time. Don't explore hyperparameters with low confidence. If there are no obvious and impactful opportunities and the code runs well, please accept it. 4. Only include the suggestions in your response without leak any time limit information because the user might over-fit the model to the time limit. 5. Never make your judgment only based on the time spent, you should also consider the code and the stdout. - If the code satisfy the requirements: - Set "hyperparameter_tuning_decision" to true. - - In "hyperparameter_tuning_suggestion", provide a clear, specific, and actionable suggestion. Begin with a concrete observation, then state a direct action to take. Do not use vague language, options, or uncertainty (avoid words like "A or B"). For example: "[Observation] Training stopped due to early stopping while the validation loss was still decreasing. This suggests the patience parameter may be too small. - [Suggestion] Increase the early stopping patience to allow more training epochs before stopping, which can further improve model performance." + - In "hyperparameter_tuning_suggestion", provide a clear, specific, and actionable suggestion. Begin with a concrete observation, then state a direct action to take. Do not use vague language, options, or uncertainty (avoid words like "A or B"). For example: "[Observation] The maximum number of epochs was reached, but the validation loss is still decreasing and early stopping was not activated. Only small portion of the allowed time was used. [Suggestion] Increase epochs to 100 to avoid underfitting and further improve model performance." If the code does not satisfy the requirements: - Set "hyperparameter_tuning_decision" to false. - Set "hyperparameter_tuning_suggestion" to an empty string. diff --git a/rdagent/scenarios/data_science/loop.py b/rdagent/scenarios/data_science/loop.py index 4738996f..7dfcb830 100644 --- a/rdagent/scenarios/data_science/loop.py +++ b/rdagent/scenarios/data_science/loop.py @@ -30,10 +30,8 @@ from rdagent.log import rdagent_logger as logger from rdagent.scenarios.data_science.dev.feedback import DSExperiment2Feedback from rdagent.scenarios.data_science.dev.runner import DSCoSTEERRunner from rdagent.scenarios.data_science.experiment.experiment import DSExperiment -from rdagent.scenarios.data_science.proposal.exp_gen.base import ( - DataScienceScen, - DSTrace, -) +from rdagent.scenarios.data_science.proposal.exp_gen import DSTrace +from rdagent.scenarios.data_science.proposal.exp_gen.base import DataScienceScen from rdagent.scenarios.data_science.proposal.exp_gen.idea_pool import DSKnowledgeBase from rdagent.scenarios.data_science.proposal.exp_gen.proposal import DSProposalV2ExpGen from rdagent.utils.workflow.misc import wait_retry diff --git a/rdagent/scenarios/data_science/proposal/exp_gen/__init__.py b/rdagent/scenarios/data_science/proposal/exp_gen/__init__.py index e69de29b..8744c943 100644 --- a/rdagent/scenarios/data_science/proposal/exp_gen/__init__.py +++ b/rdagent/scenarios/data_science/proposal/exp_gen/__init__.py @@ -0,0 +1,3 @@ +from rdagent.scenarios.data_science.proposal.exp_gen.base import DSTrace + +__all__ = ["DSTrace"] diff --git a/rdagent/scenarios/data_science/proposal/exp_gen/package_info.py b/rdagent/scenarios/data_science/proposal/exp_gen/package_info.py index 85ab8867..27f95eb2 100644 --- a/rdagent/scenarios/data_science/proposal/exp_gen/package_info.py +++ b/rdagent/scenarios/data_science/proposal/exp_gen/package_info.py @@ -1,71 +1,6 @@ import sys from importlib.metadata import distributions -# Kaggle competition packages - based on usage frequency -PYTHON_BASE_PACKAGES = ["catboost", "lightgbm", "numpy", "optuna", "pandas", "scikit-learn", "scipy", "shap", "xgboost"] - -PYTHON_ADVANCED_PACKAGES = [ - "accelerate", - "albumentations", - "bayesian-optimization", - "category_encoders", - "datasets", - "featuretools", - "imbalanced-learn", - "nltk", - "opencv-python", - "pillow", - "polars", - "sentence-transformers", - "spacy", - "tensorflow", - "timm", - "tokenizers", - "torch", - "torchvision", - "transformers", -] - - -def get_all_excepted_packages(): - """Get flattened list of all packages""" - all_packages = PYTHON_BASE_PACKAGES + PYTHON_ADVANCED_PACKAGES - return sorted(set(all_packages)) - - -def get_available_recommended_packages_prompt(): - """Generate prompt template for dynamically detected available packages""" - installed_packages = get_installed_packages() - - # Check which packages are actually installed - base_available = [pkg for pkg in PYTHON_BASE_PACKAGES if pkg.lower() in installed_packages] - advanced_available = [pkg for pkg in PYTHON_ADVANCED_PACKAGES if pkg.lower() in installed_packages] - - # Build prompt - prompt_parts = ["# Available packages in environment:\n"] - - if base_available: - prompt_parts.append("## [Basic Libraries] (general tools for data science tasks):") - prompt_parts.append(f"- {', '.join(base_available)}") - prompt_parts.append("") - - if advanced_available: - prompt_parts.append("## [Advanced Tools] (specialized for specific domains):") - prompt_parts.append(f"- {', '.join(advanced_available)}") - prompt_parts.append("") - - prompt_parts.append( - "You should choose appropriate tool combinations based on the specific context and current situation. Feel free to use any other packages you think are necessary to achieve the best performance." - ) - - return "\n".join(prompt_parts).strip() - - -def print_available_packages_prompt(): - """Print the available packages prompt to stdout for external consumption""" - prompt = get_available_recommended_packages_prompt() - print(prompt) - def get_installed_packages(): return {dist.metadata["Name"].lower(): dist.version for dist in distributions()} @@ -91,7 +26,24 @@ def get_python_packages(): # Example: `python package_info.py pandas torch scikit-learn` # If no extra arguments are provided we fall back to the original default list # to keep full backward-compatibility. - packages_list = get_all_excepted_packages() + packages_list = [ # default packages + "transformers", + "accelerate", + "torch", + "tensorflow", + "pandas", + "numpy", + "scikit-learn", + "scipy", + "xgboost", + "sklearn", + "lightgbm", + "vtk", + "opencv-python", + "keras", + "matplotlib", + "pydicom", + ] if len(sys.argv) > 1: packages_list = list(set(packages_list) | set(sys.argv[1:])) @@ -109,8 +61,4 @@ def get_python_packages(): if __name__ == "__main__": - # Check if we should print available packages prompt - if len(sys.argv) > 1 and sys.argv[1] == "--packages-prompt": - print_available_packages_prompt() - else: - get_python_packages() + get_python_packages() diff --git a/rdagent/scenarios/data_science/proposal/exp_gen/prompts_v2.yaml b/rdagent/scenarios/data_science/proposal/exp_gen/prompts_v2.yaml index 452bb125..6a0347e4 100644 --- a/rdagent/scenarios/data_science/proposal/exp_gen/prompts_v2.yaml +++ b/rdagent/scenarios/data_science/proposal/exp_gen/prompts_v2.yaml @@ -301,7 +301,6 @@ hypothesis_critique: - **Metric Impact**: Will this meaningfully improve the competition's evaluation metric? - **Historical Context**: Has similar approaches been tried? Key learnings from past attempts? - **Innovation vs History Balance**: Distinguish between implementation failures (worth retrying with improvements) vs fundamental approach failures (multiple attempts failed due to core unsuitability - should avoid) - - **Tool Selection Appropriateness**: Are the suggested tools/packages well-suited for the problem? Consider both modern capabilities and traditional reliability ### 3. Improvement Direction - **Clarity Issues**: If vague, identify specific methods or strategies that address the core problem @@ -320,13 +319,11 @@ hypothesis_critique: **Good Critiques:** - "The hypothesis lacks specificity about which ensemble method to use. Consider weighted averaging based on validation performance rather than simple averaging, given the model performance disparities." - "This hypothesis proposes LSTM for tabular data. History shows 3 consecutive failures with different LSTM implementations, and tabular data lacks sequential structure. Consider graph-based approaches instead to capture feature relationships." - - "The hypothesis jumps to LightGBM without establishing a baseline. Consider starting with XGBoost to ensure a working solution, then explore LightGBM for potential improvements if the baseline performs adequately." **Poor Critiques:** - "Set max_depth=10, learning_rate=0.05, and use 500 trees." (too specific) - "This might not work." (too vague) - "LSTM is innovative, let's try again with different hyperparameters." (ignores fundamental mismatch) - - "Use the latest deep learning model because it's new." (ignores problem-solution fit) {% if critique_output_format is not none %} ## Output Format @@ -374,12 +371,6 @@ hypothesis_rewrite: {% endif %} ## Guidelines for Writing Rewritten Hypotheses - - ### Available Tools Consideration - - When rewriting, consider if the hypothesis leverages appropriate tools from the available packages - - Balance innovation with practical tool selection - prefer modern packages when they offer clear advantages - - Ensure tool choices align with the problem requirements and constraints - - Be pragmatic: use whatever works best for the task - whether it's a cutting-edge transformer or traditional logistic regression 1. **Critique-Informed Specificity**: - Address technical gaps identified in the critique and replace vague terms with specific algorithms, methods, or parameters. @@ -449,9 +440,6 @@ hypothesis_rewrite: {{ time_status }} {% endif %} - {% if packages_prompt is not none %} - {{ packages_prompt }} - {% endif %} hypothesis_select: system: |- @@ -551,19 +539,14 @@ hypothesis_select: ### Ensemble Model Core Principle in Low Runtime Case Your goal is not just to tune individual models, but to build an **effective ensemble**. Make design decisions that lead to **strong overall ensemble performance**, not just strong base models. - These are examples: - - Example 1: + Please note: you are operating under a time budget dedicated to ensemble training of {{res_time}} hours, and the maximum allowed time is {{full_time}} hours. + + Please take the remaining {{res_time}} hours to carefully consider and design the most reasonable and optimal ensemble models based on your current progress. Assume training a single model takes about 1 hour. For example, if you have roughly twice that time left, you can try training multiple models with different random seeds or data splits to reuse time effectively. If you have more time, you might consider training a multi-fold ensemble. Use your judgment to decide how many folds or seeds fit within your remaining time budget. - - Example 2: - Assume training a single fold of a model takes at most {{ time_max }} hours. Within your remaining time budget, prioritize training multiple folds of the same model rather than trying many different models. - For instance, if you have roughly 2 × {{ time_max }} hours left, you could train 2 folds of the same model with different data splits or random seeds. - If more time is available, you might consider increasing the number of folds further. Use your judgment to decide how many folds fit within the remaining time budget while respecting the time_max constraint for a single fold. ### 2. Training-Time Resource Allocation - - You may use **multiple folds** if justified, but you must **ensure the full pipeline completes within remaining time budget**. + - You may use **multiple folds** if justified, but you must **ensure the full pipeline completes within runtime limits**. - Avoid reducing base model quality just to save time. For example: - Freezing large parts of the model (e.g., embeddings) - Using only embedding-level regression instead of full modeling @@ -639,6 +622,7 @@ hypothesis_select: # Current SOTA Implementation {{ sota_exp_desc }} + task_gen: system: |- {% include "scenarios.data_science.share:scen.role" %} @@ -699,16 +683,18 @@ task_gen: - Ensure validation metrics and processes are consistent across all parts of the pipeline. Avoid changes that would alter how validation metrics are calculated unless that is part of the hypothesis. 8. **Submission File (`submission.csv`)**: Generate `submission.csv` in the **exact format** required (column names, order, data types), as detailed in the '====== Submission Format ======' section of the Competition Scenario Description (DO NOT read the sample_submission.csv file directly in the code). This is a critical step. 9. **Preferred Packages Notes**: - {% include "scenarios.data_science.share:guidelines.package_selection" %} - - {%if fix_seed_and_data_split %} + - You can choose the most proper packages for the task to best achieve the hypothesis. + - When facing a choice between two packages which both can achieve the same goal, you should choose the one which is more commonly used and less likely to cause bugs in coding. Especially those you are not familiar with. + - For GBDT models, prefer XGBoost or RandomForest over LightGBM unless the SOTA or hypothesis dictates otherwise. Prefer not using GPU for GBDT models unless the SOTA or hypothesis dictates otherwise. + - For neural networks, prefer PyTorch or PyTorch based library (over TensorFlow) unless the SOTA or hypothesis dictates otherwise. + - For neural networks, prefer fine-tuning pre-trained models over training from scratch. 10. File Handling & DataFrame Generation: Generate a pandas DataFrame with columns [“id”, “path”, “fold”]. - id: a unique identifier for each sample. - path: the file path of the corresponding sample. - 11. Hypothesis Handling: At the initial stage, multiple hypotheses may be proposed simultaneously. If some hypotheses overlap, select the most promising one for implementation and ignore redundant overlapping hypotheses. Each implemented hypothesis should remain an independent task. + {%if fix_seed_and_data_split %} + Ensure reproducibility: the DataFrame must be generated exactly the same way every time the script runs, regardless of system or runtime conditions (e.g., by fixing the random seed). {% endif %} - ## Package Declaration At the end of your design, **you MUST** provide a key `packages` in the final JSON output. It should be an **array of PyPI package names** (strings) that you expect to `import` in the forthcoming implementation. diff --git a/rdagent/scenarios/data_science/proposal/exp_gen/proposal.py b/rdagent/scenarios/data_science/proposal/exp_gen/proposal.py index 5621d811..46514a0e 100644 --- a/rdagent/scenarios/data_science/proposal/exp_gen/proposal.py +++ b/rdagent/scenarios/data_science/proposal/exp_gen/proposal.py @@ -34,10 +34,7 @@ from rdagent.scenarios.data_science.proposal.exp_gen.planner import ( from rdagent.scenarios.data_science.proposal.exp_gen.select.submit import ( BestValidSelector, ) -from rdagent.scenarios.data_science.proposal.exp_gen.utils import ( - get_available_packages_prompt, - get_packages, -) +from rdagent.scenarios.data_science.proposal.exp_gen.utils import get_packages from rdagent.scenarios.kaggle.kaggle_crawler import get_metric_direction from rdagent.utils.agent.tpl import T from rdagent.utils.repo.diff import generate_diff_from_dict @@ -619,28 +616,18 @@ class DSProposalV2ExpGen(ExpGen): is_new_tree: bool, inject_diverse: bool = False, exp_gen_plan: Optional[Dict] = None, - packages_prompt: str = "", sibling_exp: List[DSExperiment] | None = None, ) -> Dict: problem_formatted_str = "" for i, (problem_name, problem_dict) in enumerate(problems.items()): problem_formatted_str += f"## {i+1}. {problem_name}\n" - problem_formatted_str += f"Statement: {problem_dict['problem']}\n" - problem_formatted_str += f"Reason: {problem_dict['reason']}\n" + problem_formatted_str += f"{problem_dict['problem']}\n" if "idea" in problem_dict: idea_formatted_str = DSIdea(problem_dict["idea"]).to_formatted_str() problem_formatted_str += f"Sampled Idea by user: \n{idea_formatted_str}\n" problem_formatted_str += "\n\n" sibling_hypotheses = [exp.hypothesis for exp in sibling_exp] if sibling_exp else None - # add available packages prompt - if packages_prompt: - problem_formatted_str += f"\n{packages_prompt}\n" - - # add available packages prompt - if packages_prompt: - problem_formatted_str += f"\n{packages_prompt}\n" - sys_prompt = T(".prompts_v2:hypothesis_gen.system").r( hypothesis_output_format=( T(".prompts_v2:output_format.hypothesis").r(pipeline=pipeline, enable_idea_pool=enable_idea_pool) @@ -777,7 +764,6 @@ class DSProposalV2ExpGen(ExpGen): scenario_desc: str, sota_exp_desc: str, exp_feedback_list_desc: str, - packages_prompt: str = "", sibling_exp: List[DSExperiment] | None = None, ) -> Dict: """ @@ -820,7 +806,6 @@ class DSProposalV2ExpGen(ExpGen): sota_exp_desc=sota_exp_desc, hypothesis_critique_pairs=hypothesis_critique_pairs, time_status=time_status, - packages_prompt=packages_prompt, ) response = APIBackend().build_messages_and_create_chat_completion( @@ -1347,9 +1332,6 @@ class DSProposalV2ExpGen(ExpGen): else: inject_diverse = False - # add available packages prompt - packages_prompt = get_available_packages_prompt() - sibling_exp = trace.get_sibling_exps() if trace.should_inject_diversity() else None # Step 1: Identify problems @@ -1388,7 +1370,6 @@ class DSProposalV2ExpGen(ExpGen): inject_diverse=inject_diverse, exp_gen_plan=plan.get("exp_gen") if plan else None, is_new_tree=is_new_tree, - packages_prompt=packages_prompt, sibling_exp=sibling_exp, ) if not pipeline: @@ -1433,7 +1414,6 @@ class DSProposalV2ExpGen(ExpGen): scenario_desc=scenario_desc, sota_exp_desc=sota_exp_desc, exp_feedback_list_desc=exp_feedback_list_desc, - packages_prompt=packages_prompt, sibling_exp=sibling_exp, ) logger.info(f"Successfully completed hypothesis critique and rewrite process") diff --git a/rdagent/scenarios/data_science/proposal/exp_gen/utils.py b/rdagent/scenarios/data_science/proposal/exp_gen/utils.py index bad6c881..6e2a2e06 100644 --- a/rdagent/scenarios/data_science/proposal/exp_gen/utils.py +++ b/rdagent/scenarios/data_science/proposal/exp_gen/utils.py @@ -103,16 +103,3 @@ def get_packages(pkgs: list[str] | None = None) -> str: pkg_args = " ".join(pkgs) if pkgs else "" stdout = implementation.execute(env=env, entry=f"python {fname} {pkg_args}") return stdout - - -def get_available_packages_prompt() -> str: - """Generate prompt template for dynamically detected available packages.""" - # Use the same approach as get_packages but call the packages prompt functionality - - env = get_ds_env() - implementation = FBWorkspace() - fname = "package_info.py" - implementation.inject_files(**{fname: (Path(__file__).absolute().resolve().parent / "package_info.py").read_text()}) - - stdout = implementation.execute(env=env, entry=f"python {fname} --packages-prompt") - return stdout.strip() diff --git a/rdagent/scenarios/data_science/scen/__init__.py b/rdagent/scenarios/data_science/scen/__init__.py index e1b4b806..b6f60a3a 100644 --- a/rdagent/scenarios/data_science/scen/__init__.py +++ b/rdagent/scenarios/data_science/scen/__init__.py @@ -11,9 +11,6 @@ from rdagent.log import rdagent_logger as logger from rdagent.log.timer import RD_Agent_TIMER_wrapper from rdagent.oai.llm_utils import APIBackend from rdagent.scenarios.data_science.debug.data import create_debug_data -from rdagent.scenarios.data_science.proposal.exp_gen.utils import ( - get_available_packages_prompt, -) from rdagent.scenarios.data_science.scen.utils import describe_data_folder_v2 from rdagent.scenarios.kaggle.kaggle_crawler import ( crawl_descriptions, @@ -244,7 +241,6 @@ class DataScienceScen(Scenario): f"{self.recommend_debug_timeout() / 60 : .2f} minutes" if DS_RD_SETTING.sample_data_by_LLM else None ), runtime_environment=self.get_runtime_environment(), - available_packages_prompt=get_available_packages_prompt(), ) def get_runtime_environment(self) -> str: diff --git a/rdagent/scenarios/data_science/scen/prompts.yaml b/rdagent/scenarios/data_science/scen/prompts.yaml index 925e7590..77e926f6 100644 --- a/rdagent/scenarios/data_science/scen/prompts.yaml +++ b/rdagent/scenarios/data_science/scen/prompts.yaml @@ -54,11 +54,6 @@ scenario_description: |- {{ runtime_environment }} {% endif %} - {% if available_packages_prompt is not none %} - ====== Available Packages ====== - {{ available_packages_prompt }} - {% endif %} - competition_description_template: system: |- You are a data science assistant that extracts structured information from unstructured text. diff --git a/rdagent/scenarios/data_science/share.yaml b/rdagent/scenarios/data_science/share.yaml index 346b85a1..5b9978e9 100644 --- a/rdagent/scenarios/data_science/share.yaml +++ b/rdagent/scenarios/data_science/share.yaml @@ -349,19 +349,17 @@ component_spec: - Present the required submission format explicitly and ensure the output adheres to it. 10. Preferred Packages: - {% include "scenarios.data_science.share:guidelines.package_selection" %} + - You can choose the most proper packages to achieve the task. + - When facing a choice between two packages which both can achieve the same goal, you should choose the one which is more commonly used and less likely to cause bugs in coding. Especially those you are not familiar with. + - For GBDT models, prefer XGBoost or RandomForest over LightGBM unless the SOTA or hypothesis dictates otherwise. + - To use GPU in training, always implement a check to ensure that the GPU is available and use it if possible. Fallback to CPU if GPU is not available. Especially in GBDT models, you might get error when you call `fit` method without checking the GPU availability. Add a try except block to handle this case. + - For neural networks, prefer PyTorch or PyTorch based library (over TensorFlow) unless the SOTA or hypothesis dictates otherwise. + - For neural networks, prefer fine-tuning pre-trained models over training from scratch. guidelines: coding: |- You might receive exploratory data analysis (EDA) details about the source data. **Do not use this EDA information to create assertions, hard-coded values, or raise errors.** We might generate sample data for quick coding (so your code may run on sample data which is part of the full-size data), but remember that the EDA details are based on the full-size data. - package_selection: |- - - The `Available Packages` section in the Competition Scenario Description includes general and specific recommendations. Choose packages that best support the hypothesis and constraints; you may deviate with clear justification grounded in data, code reuse, and efficiency. - - Do not select packages solely because you are familiar with them. - - When facing a choice between two packages which both can achieve the same goal, you should choose the one which is more commonly used and less likely to cause bugs in coding. - - For GBDT, prefer CPU. Enable GPU for GBDT if profiling on this environment shows clear, reproducible speedups without stability regressions; document the versions and settings used. - - For deep learning frameworks, align with the current codebase and available pretrained assets. If unconstrained, prefer PyTorch or PyTorch‑based libraries given ecosystem and template support; prioritize consistency and reuse over brand preferences. - - For neural networks, favor fine-tuning well‑validated pretrained models over training from scratch when applicable to the task. - + spec: hyperparameter: |- 1. Hyperparameters Requiring Tuning (e.g., learning rate, weight decay, optimizer, etc.)