### Installing AI Scientist-v2 Dependencies via Conda Source: https://github.com/sakanaai/ai-scientist-v2/blob/main/README.md This script creates a new conda environment, activates it, installs PyTorch with CUDA support, and then installs PDF/LaTeX tools and Python package requirements from `requirements.txt`. It outlines the necessary steps to set up the execution environment. ```bash # 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.txt ``` -------------------------------- ### Installing Packages for Claude via AWS Bedrock Source: https://github.com/sakanaai/ai-scientist-v2/blob/main/README.md This command installs the necessary Python package `anthropic[bedrock]` required to use Claude models through the Amazon Bedrock service. This is an optional step for users who wish to utilize Bedrock for LLM access. ```bash pip install anthropic[bedrock] ``` -------------------------------- ### Run AI Scientist-v2 Experiments (Bash) Source: https://github.com/sakanaai/ai-scientist-v2/blob/main/README.md Launch the main AI Scientist-v2 pipeline using the `launch_scientist_bfts.py` script. This command takes the JSON file containing generated research ideas as input and allows specifying models for different stages (write-up, citation, review, plots) and other parameters like citation rounds. Tree search configuration is managed via `bfts_config.yaml`. ```Bash 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 20 ``` -------------------------------- ### Meta-Training Process of ARML (Algorithm 1) Source: https://github.com/sakanaai/ai-scientist-v2/blob/main/ai_scientist/fewshot_examples/132_automated_relational.txt Outlines the steps for the meta-training process of the ARML model. It involves sampling tasks, constructing graphs, applying GNN, computing task representations and reconstruction losses, updating task-specific parameters via inner loop gradient descent, and performing meta-optimization on global parameters using outer loop gradient descent and combined losses. ```Pseudocode Algorithm 1 Meta-Training Process of ARML Require: p(T ): distribution over tasks; K: Number of vertices in meta-knowledge graph; α: stepsize for gradient descent of each task (i.e., inner loop stepsize); β: stepsize for meta-optimization (i.e., outer loop stepsize); µ1, µ2: balancing factors in loss function 1: Randomly initialize all learnable parameters Φ 2: while not done do 3: Sample a batch of tasks {Ti|i ∈ [1, I]} from p(T ) 4: for all Ti do 5: Sample training set Ditr and testing set Dits 6: Construct the prototype-based relational graph Ri by computing prototype in equation 2 and weight in equation 4 7: Compute the similarity between each prototype and meta-knowledge vertex in equation 6 and construct the super-graph Si 8: Apply GNN on super-graph Si and get the information-propagated representation CˆRi 9: Aggregate CRi in equation 8 and CˆRi in equation 9 to get the representations qi, ti and reconstruction loss Lq, Lt 10: Compute the task-specific initialization θ0i in equation 10 and update parameters θi = θ0i − α∇θL(fθ, Ditr) 11: end for 12: Update Φ ← Φ − β∇Φ 1/I ∑Ii=1 L(fθi, Dits) + µ1Lt + µ2Lq 13: end while ``` -------------------------------- ### Setting Environment Variables for API Keys Source: https://github.com/sakanaai/ai-scientist-v2/blob/main/README.md These commands demonstrate how to set environment variables for various API keys required by the AI Scientist-v2, including OpenAI, Semantic Scholar, and AWS credentials for Bedrock. Users should replace the placeholder values with their actual keys. ```bash 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" ``` -------------------------------- ### Generate Research Ideas with AI Scientist-v2 (Bash) Source: https://github.com/sakanaai/ai-scientist-v2/blob/main/README.md Execute the `perform_ideation_temp_free.py` script to brainstorm and refine research ideas using an LLM. This command requires a Markdown file describing the research topic and specifies the LLM model, maximum number of generations, and number of reflection steps. ```Bash 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 5 ``` -------------------------------- ### Modulating Initialization with Task Representations (Eq 10) Source: https://github.com/sakanaai/ai-scientist-v2/blob/main/ai_scientist/fewshot_examples/132_automated_relational.txt Shows how the task-specific initialization `θ0i` is computed by modulating a global initialization `θ0` with a function of the concatenated task representations `ti` and `qi`. A sigmoid gate (σ) and learnable parameters (Wg, bg) are used in a fully connected layer. ```Math \theta_i^0 = \sigma(W_g(t_i \oplus q_i) + b_g) \circ \theta^0 ``` -------------------------------- ### BibTeX Citation for AI Scientist-v2 Source: https://github.com/sakanaai/ai-scientist-v2/blob/main/README.md Provides the standard BibTeX entry for citing The AI Scientist-v2 research paper in academic work. ```BibTeX @article{aiscientist_v2, title={The AI Scientist-v2: Workshop-Level Automated Scientific Discovery via Agentic Tree Search}, author={Yamada, Yutaro and Lange, Robert Tjarko and Lu, Cong and Hu, Shengran and Lu, Chris and Foerster, Jakob and Clune, Jeff and Ha, David}, journal={arXiv preprint arXiv:2504.08066}, year={2025} } ``` -------------------------------- ### Computing Task Representation qi and Reconstruction Loss Lq (Eq 8) Source: https://github.com/sakanaai/ai-scientist-v2/blob/main/ai_scientist/fewshot_examples/132_automated_relational.txt Defines the task representation `qi` derived from raw prototype information `CRi` using an aggregator (AG_q) and mean pooling. It also introduces the reconstruction loss `Lq` based on auto-encoding `CRi` using AG_q and its decoder AG_q^dec, measured by the squared Frobenius norm. ```Math q_i = \text{MeanPool}(\text{AG}_q(\text{CR}_i)) = \frac{1}{N_{tr}} \sum_{j=1}^{N_{tr}} (\text{AG}_q(c_i^j)), L_q = \|\text{CR}_i - \text{AG}_{q}^{\text{dec}}(\text{AG}_q(\text{CR}_i))\|_F^2 ``` -------------------------------- ### Return Parameters (Pseudocode) Source: https://github.com/sakanaai/ai-scientist-v2/blob/main/ai_scientist/fewshot_examples/2_carpe_diem.txt Returns the updated model parameters θt after the current iteration or epoch of the algorithm is complete. ```Pseudocode return θt; ``` -------------------------------- ### Computing Task Representation ti and Reconstruction Loss Lt (Eq 9) Source: https://github.com/sakanaai/ai-scientist-v2/blob/main/ai_scientist/fewshot_examples/132_automated_relational.txt Defines the task representation `ti` derived from meta-knowledge propagated prototype information `CˆRi` using an aggregator (AG_t) and mean pooling. It also introduces the reconstruction loss `Lt` based on auto-encoding `CˆRi` using AG_t and its decoder AG_t^dec, measured by the squared Frobenius norm. ```Math t_i = \text{MeanPool}(\text{AG}_t(\hat{\text{CR}}_i)) = \frac{1}{N_{tr}} \sum_{j=1}^{N_{tr}} (\text{AG}_t(\hat{c}_i^j)), L_t = \|\hat{\text{CR}}_i - \text{AG}_{t}^{\text{dec}}(\text{AG}_t(\hat{\text{CR}}_i))\|_F^2 ``` -------------------------------- ### Position-wise Feed-Forward Network Formula Source: https://github.com/sakanaai/ai-scientist-v2/blob/main/ai_scientist/fewshot_examples/attention.txt Defines the feed-forward network applied to each position separately. It consists of two linear transformations with a ReLU activation function applied after the first transformation. ```Math/Pseudocode FFN(x) = max(0, xW1 + b1)W2 + b2 (2) ``` -------------------------------- ### Message Passing in GNN Layer (Eq 7) Source: https://github.com/sakanaai/ai-scientist-v2/blob/main/ai_scientist/fewshot_examples/132_automated_relational.txt Defines how vertex embeddings are updated in a GNN layer using a message passing function (MP), the adjacency matrix (Ai), previous layer embeddings (H_i^(l)), and a learnable weight matrix (W^(l)). This is a standard GNN layer update rule. ```Math H_{i}^{(l+1)} = \text{MP}(A_i, H_{i}^{(l)}; W^{(l)}) ``` -------------------------------- ### Perform SGD Step (Pseudocode) Source: https://github.com/sakanaai/ai-scientist-v2/blob/main/ai_scientist/fewshot_examples/2_carpe_diem.txt Updates the model parameters θt using the Stochastic Gradient Descent step based on the calculated losses. This step corresponds to the backward pass in the training process. ```Pseudocode _θt+1 ←_ SGD_Step(losses, θt); /* Backward */ ``` -------------------------------- ### Multi-Head Attention Formula Source: https://github.com/sakanaai/ai-scientist-v2/blob/main/ai_scientist/fewshot_examples/attention.txt Defines the Multi-Head Attention mechanism as a concatenation of multiple attention heads followed by a linear projection. Each head applies the standard Attention function to linearly projected queries, keys, and values. ```Math/Pseudocode MultiHead(Q, K, V ) = Concat(head1, ..., headh)W _[O] where headi = Attention(QWi[Q][, KW][ K]i _[, V W][ V]i_ [)] ``` -------------------------------- ### Update Label History (Pseudocode) Source: https://github.com/sakanaai/ai-scientist-v2/blob/main/ai_scientist/fewshot_examples/2_carpe_diem.txt Updates the historical record of labels based on the current batch's labels. This update is performed according to Definition 3.1 of the algorithm. ```Pseudocode Update_Label_History(labels); /* By Definition 3.1 */ ``` -------------------------------- ### Increment Time Step (Pseudocode) Source: https://github.com/sakanaai/ai-scientist-v2/blob/main/ai_scientist/fewshot_examples/2_carpe_diem.txt Increments the time or iteration counter t by one, moving to the next step in the algorithm's execution. ```Pseudocode _t ←_ _t + 1; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.