Configure AWS credentials for Bedrock
mainIf you are using Amazon Bedrock as your model provider, you must set the following environment variables in your terminal:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_REGION_NAME
repository·main·Indexed 27 days ago
https://github.com/sakanaai/ai-scientist-v2An autonomous scientific research system by Sakana AI that utilizes agentic tree search to generate hypotheses, conduct experiments, analyze data, and write scientific manuscripts. Designed for open-ended exploration in Machine Learning domains, it supports integration with OpenAI, Gemini, and Claude (via AWS Bedrock) models, and utilizes the Semantic Scholar API for literature search and novelty checking.
If you are using Amazon Bedrock as your model provider, you must set the following environment variables in your terminal:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_REGION_NAMELaunch the main pipeline using the JSON file generated during the ideation step. This uses agentic tree search to run experiments and generate a paper.
Key Arguments:
--load_ideas: Path to the generated JSON idea file.--load_code: Initialize experimentation with a code snippet (omit if not desired).--add_dataset_ref: Adds dataset references.--model_writeup: LLM for the write-up phase.--model_citation: LLM for the citation phase.--model_review: LLM for the review phase.--model_agg_plots: LLM for aggregating plots.--num_cite_rounds: Number of citation rounds.Configuration:
Tree search parameters (like num_workers, steps, max_debug_depth, etc.) are managed in bfts_config.yaml.
Outputs:
experiments/<timestamp_ideaname>/logs/0-run/unified_tree_viz.html.<timestamp_ideaname>.pdf located in the experiment folder.python launch_scientist_bfts.py \
--load_ideas "ai_scientist/ideas/my_research_topic.json" \
--load_code \
--add_dataset_ref \
--model_writeup o1-preview-2024-09-12 \
--model_citation gpt-4o-2024-11-20 \
--model_review gpt-4o-2024-11-20 \
--model_agg_plots o3-mini-2025-01-31 \
--num_cite_rounds 20Before running experiments, use the ideation script to brainstorm and refine research ideas based on a topic description.
my_research_topic.md) containing Title, Keywords, TL;DR, and Abstract. Place it in a directory like ai_scientist/ideas/.ai_scientist/perform_ideation_temp_free.py with the following arguments:--workshop-file: Path to your topic Markdown file.--model: The LLM to use (e.g., gpt-4o-2024-05-13).--max-num-generations: Number of distinct ideas to attempt.--num-reflections: Number of refinement steps per idea.ai_research_topic.json) containing structured hypotheses and proposed experiments.python ai_scientist/perform_ideation_temp_free.py \
--workshop-file "ai_scientist/ideas/my_research_topic.md" \
--model gpt-4o-2024-05-13 \
--max-num-generations 20 \
--num-reflections 5The AI Scientist-v2 is designed for Linux with NVIDIA GPUs using CUDA and PyTorch. Follow these steps to set up the environment:
pytorch-cuda version matches your system setup).poppler and chktex.requirements.txt.Caution: This codebase executes LLM-written code. Run it within a controlled sandbox environment (e.g., a Docker container) to mitigate risks like uncontrolled web access or unintended processes.
# Create a new conda environment
conda create -n ai_scientist python=3.11
conda activate ai_scientist
# Install PyTorch with CUDA support (adjust pytorch-cuda version for your setup)
conda install pytorch torchvision torchaudio pytorch-cuda=12.4 -c pytorch -c nvidia
# Install PDF and LaTeX tools
conda install anaconda::poppler
conda install conda-forge::chktex
# Install Python package requirements
pip install -r requirements.txtThe system requires environment variables for the LLMs and services you intend to use:
OPENAI_API_KEY.GEMINI_API_KEY (accessed via OpenAI API).pip install anthropic[bedrock].AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_REGION_NAME.S2_API_KEY for higher throughput and better novelty checking. The system can function without it, but you may encounter rate limits.export OPENAI_API_KEY="YOUR_OPENAI_KEY_HERE"
export S2_API_KEY="YOUR_S2_KEY_HERE"
# Set AWS credentials if using Bedrock
# export AWS_ACCESS_KEY_ID="YOUR_AWS_ACCESS_KEY_ID"
# export AWS_SECRET_ACCESS_KEY="YOUR_AWS_SECRET_KEY"
# export AWS_REGION_NAME="your-aws-region"This project is licensed under The AI Scientist Source Code License. Use of this code requires mandatory disclosure of AI involvement in any resulting scientific manuscripts.
Recommended Attribution:
"This manuscript was autonomously generated using The AI Scientist."
To run experiments on a specific topic or subject field, follow these steps:
ai_scientist/ideas/i_cant_believe_its_not_better.md.perform_ideation_temp_free.py script using your Markdown file as input to generate a JSON idea file.launch_scientist_bfts.py script to run the paper generation experiments, passing the generated JSON file via the --load_ideas argument.If you encounter a CUDA Out of Memory error, it means the model being loaded or run exceeds your available GPU memory.
Solution: Update your ideation prompt file (e.g., ai_scientist/ideas/my_research_topic.md) to explicitly instruct the agent to suggest using smaller models for the experiments.