Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 175 additions & 0 deletions README_NEW.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
# AI-Scientist

<div align="center">
<a href="https://github.com/SakanaAI/AI-Scientist/blob/main/docs/logo_2.png">
<img src="docs/logo_2.png" width="215" alt="AI-Scientist Logo"/>
</a>
<h1>The AI Scientist: Towards Fully Automated</h1>
<h1>Open-Ended Scientific Discovery πŸ§‘β€πŸ”¬</h1>
</div>

<p align="center">
πŸ“š <a href="https://arxiv.org/abs/2408.06292">[Paper]</a> |
πŸ“ <a href="https://sakana.ai/ai-scientist/">[Blog Post]</a> |
πŸ“‚ <a href="https://drive.google.com/drive/folders/1G7A0wTqfXVa-cpexjk0oaXakaSJwffEt">[Drive Folder]</a>
</p>

One of the grand challenges of artificial intelligence is developing agents capable of conducting scientific research and discovering new knowledge. While frontier models have already been used to aid human scientists, they still require extensive manual supervision or are heavily constrained to specific tasks.

We introduce **The AI Scientist**, the first comprehensive system for fully automatic scientific discovery, enabling Foundation Models such as Large Language Models (LLMs) to perform research independently.

## Project Structure

The AI-Scientist project is organized as follows:

```
AI-Scientist/
β”œβ”€β”€ ai_scientist/ # Core AI-Scientist framework
β”‚ β”œβ”€β”€ generate_ideas.py # Idea generation module
β”‚ β”œβ”€β”€ perform_experiments.py # Experiment execution
β”‚ β”œβ”€β”€ perform_review.py # Paper review generation
β”‚ β”œβ”€β”€ perform_writeup.py # Paper writing module
β”‚ └── ...
β”œβ”€β”€ frontend/ # Web interface (React/TypeScript)
β”‚ β”œβ”€β”€ public/ # Static files
β”‚ β”œβ”€β”€ src/ # Source code
β”‚ β”‚ β”œβ”€β”€ components/ # UI components
β”‚ β”‚ β”œβ”€β”€ pages/ # Page components
β”‚ β”‚ β”œβ”€β”€ services/ # API services
β”‚ β”‚ └── ...
β”‚ β”œβ”€β”€ package.json # Frontend dependencies
β”‚ └── run-frontend.sh # Script to run the frontend
β”œβ”€β”€ templates/ # Experiment templates
β”‚ β”œβ”€β”€ nanoGPT/ # NanoGPT template
β”‚ β”œβ”€β”€ 2d_diffusion/ # 2D diffusion template
β”‚ β”œβ”€β”€ grokking/ # Grokking template
β”‚ └── ...
β”œβ”€β”€ output_science/ # Organized output directory
β”‚ β”œβ”€β”€ data/ # All datasets and processed data
β”‚ β”œβ”€β”€ experiments/ # Experiment outputs by template
β”‚ β”œβ”€β”€ papers/ # Generated papers
β”‚ β”œβ”€β”€ results/ # Result analysis
β”‚ └── ...
β”œβ”€β”€ launch_scientist.py # Original launch script
β”œβ”€β”€ run-scientist.sh # New script for using the custom structure
└── requirements.txt # Python dependencies
```

## New Features

This repository includes several enhancements to the original AI-Scientist:

1. **Web Interface**: A modern React/TypeScript frontend for managing and visualizing research
2. **Organized Output Structure**: All outputs now stored in a structured `output_science` directory
3. **Improved Scripts**: Shell scripts for common operations and better usability

## Installation

### Backend

```bash
# Create and activate conda environment
conda create -n ai_scientist python=3.11
conda activate ai_scientist

# Install dependencies
pip install -r requirements.txt
```

### Frontend

```bash
# Navigate to frontend directory
cd frontend

# Install dependencies
npm install

# Start development server
npm start
```

## Running AI-Scientist

You can use the provided shell scripts to interact with the AI-Scientist:

### Using the Web Interface

```bash
# Run the frontend development server
./run-scientist.sh --operation frontend

# Or directly from the frontend directory
cd frontend
./run-frontend.sh
```

### Running Experiments

```bash
# Run with default settings (nanoGPT, Claude model, 5 ideas)
./run-scientist.sh

# Specify experiment type, model, and number of ideas
./run-scientist.sh --experiment 2d_diffusion --model "gpt-4o-2024-05-13" --num-ideas 3

# Process data for an experiment
./run-scientist.sh --operation process-data --experiment nanoGPT

# Visualize experiment results
./run-scientist.sh --operation visualize --experiment grokking
```

### Traditional Usage

You can also use the original launch script for backward compatibility:

```bash
python launch_scientist.py --model "claude-3-5-sonnet-20241022" --experiment nanoGPT --num-ideas 2
```

## Output Directory Structure

All outputs are organized in the `output_science` directory:

- `experiments/`: Contains experiment results by template and idea
- `papers/`: Contains generated papers (drafts and final versions)
- `data/`: Contains raw and processed data
- `logs/`: Contains logs from runs
- `reviews/`: Contains LLM-generated paper reviews

## Frontend Features

The web interface provides:

- **User Authentication**: Secure login and user management
- **Dashboard**: Overview of research activities
- **Project Management**: Create and manage research projects
- **Experiment Orchestration**: Design, run, and monitor experiments
- **Results Visualization**: Interactive charts and data exploration
- **Paper Generation**: Generate and edit scientific papers

## Contributing

We welcome contributions to the AI-Scientist project. Please feel free to submit issues and pull requests.

## License

This project is licensed under the terms in the LICENSE file.

## Citation

If you use the AI-Scientist in your research, please cite our paper:

```bibtex
@article{aiscientist2024,
title={The AI Scientist: Towards Fully Automated Open-Ended Scientific Discovery},
author={...},
journal={arXiv preprint arXiv:2408.06292},
year={2024}
}
```

## Disclaimer

This codebase will execute LLM-written code. There are various risks and challenges associated with this autonomy, including the use of potentially dangerous packages, web access, and potential spawning of processes. Use at your own discretion. Please make sure to containerize and restrict web access appropriately.
32 changes: 32 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Dependencies
/node_modules
/.pnp
.pnp.js

# Testing
/coverage

# Production
/dist
/build

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

# Logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
164 changes: 164 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# AI-Scientist Frontend

This is the frontend application for the AI-Scientist project, a comprehensive system for automated scientific discovery.

## Features

- **User Management**: Authentication and profile management
- **Dashboard**: Overview of research activities and progress
- **Experiment Management**: Create, run, and monitor scientific experiments
- **Paper Generation**: Create and edit scientific papers based on experiment results
- **Results Visualization**: Interactive visualization of experimental results

## Getting Started

### Prerequisites

- Node.js (v16 or later)
- npm (v8 or later)

### Installation

1. Navigate to the frontend directory:
```bash
cd frontend
```

2. Install dependencies:
```bash
npm install
```

3. Start the development server:
```bash
npm start
```
Alternatively, use the provided script:
```bash
./run-frontend.sh
```

4. The application will be available at [http://localhost:3000](http://localhost:3000)

## Build for Production

To create a production build:

```bash
npm run build
```

The build files will be generated in the `dist` directory.

## Project Structure

```
frontend/
β”œβ”€β”€ public/ # Static files
β”œβ”€β”€ src/ # Source code
β”‚ β”œβ”€β”€ components/ # UI components
β”‚ β”‚ β”œβ”€β”€ layout/ # Layout components (e.g., MainLayout, AuthLayout)
β”‚ β”‚ β”œβ”€β”€ dashboard/ # Dashboard-specific components
β”‚ β”‚ β”œβ”€β”€ experiments/ # Experiment-related components
β”‚ β”‚ β”‚ β”œβ”€β”€ ExperimentCard.tsx # Card component for displaying experiment info
β”‚ β”‚ β”‚ β”œβ”€β”€ ExperimentFilter.tsx # Filter component for experiments list
β”‚ β”‚ β”‚ β”œβ”€β”€ ExperimentProgressTracker.tsx # Component for tracking experiment progress
β”‚ β”‚ β”‚ β”œβ”€β”€ ExperimentLogViewer.tsx # Component for displaying experiment logs
β”‚ β”‚ β”‚ └── README.md # Documentation for experiment components
β”‚ β”‚ β”œβ”€β”€ papers/ # Paper-related components
β”‚ β”‚ β”œβ”€β”€ auth/ # Authentication components
β”‚ β”‚ β”œβ”€β”€ common/ # Common/shared components
β”‚ β”‚ └── results/ # Result visualization components
β”‚ β”œβ”€β”€ pages/ # Page components
β”‚ β”‚ β”œβ”€β”€ experiments/ # Experiment pages
β”‚ β”‚ β”‚ β”œβ”€β”€ ExperimentsList.tsx # Page for listing all experiments
β”‚ β”‚ β”‚ β”œβ”€β”€ ExperimentDetail.tsx # Page for viewing experiment details
β”‚ β”‚ β”‚ └── CreateExperiment.tsx # Page for creating new experiments
β”‚ β”œβ”€β”€ services/ # API services and data fetching
β”‚ β”‚ β”œβ”€β”€ experimentService.ts # Service for experiment-related API operations
β”‚ β”‚ └── README.md # Documentation for API services
β”‚ β”œβ”€β”€ context/ # React context providers
β”‚ β”œβ”€β”€ hooks/ # Custom React hooks
β”‚ β”‚ β”œβ”€β”€ useExperiments.ts # Hook for managing experiment data
β”‚ β”‚ β”œβ”€β”€ useExperimentLogs.ts # Hook for handling experiment logs
β”‚ β”‚ └── README.md # Documentation for custom hooks
β”‚ β”œβ”€β”€ utils/ # Utility functions
β”‚ └── assets/ # Static assets like images and styles
β”œβ”€β”€ dist/ # Production build output
└── package.json # NPM dependencies and scripts
```

## Technologies Used

- **React**: Frontend library for building user interfaces
- **TypeScript**: Type-safe JavaScript
- **Material UI**: React UI framework for faster and easier web development
- **React Router**: Declarative routing for React
- **Axios**: Promise-based HTTP client for making API requests
- **Chart.js**: Charting library for data visualization

## Authentication

For demo purposes, the frontend uses a mock authentication service. In a production environment, this would be replaced with a real authentication API.

Demo credentials:
- Email: [email protected]
- Password: password

## Connected Backend

The frontend is designed to communicate with the AI-Scientist backend. By default, it connects to `http://localhost:5000/api`. You can configure the API endpoint by setting the `REACT_APP_API_URL` environment variable.

## Contributing

Contributions to the AI-Scientist frontend are welcome. Please follow these steps:

1. Fork the repository
2. Create a new branch
3. Implement your changes
4. Submit a pull request

## License

This project is licensed under the terms specified in the LICENSE file at the root of the repository.

## Experiments Module

The Experiments module allows researchers to create, manage, and monitor scientific experiments. It includes the following key features:

### Experiment Management

- **Create Experiments**: Set up new experiments with custom parameters, tags, and descriptions
- **List View**: View all experiments with filtering, sorting, and pagination
- **Detail View**: Detailed view of individual experiments with progress tracking
- **Controls**: Start, pause, stop, and delete experiments

### Experiment Monitoring

- **Real-time Progress Tracking**: Visual representation of experiment progress
- **Step-by-Step Tracking**: Track each step of the experiment with status indicators
- **Live Logs**: Real-time log viewing with filtering and search capabilities
- **Resource Monitoring**: View CPU, memory, and GPU usage for experiments

### Data Organization

- **Tagging System**: Organize experiments using tags
- **Filtering & Search**: Find experiments by status, date, tags, or search terms
- **Results Integration**: Seamless connection between experiments and their results

### User Interface

- **Card View**: Visual card representation of experiments in list view
- **Progress Visualization**: Visual progress indicators for each experiment
- **Log Management**: Advanced log viewer with filtering by log level and source

### Technical Implementation

The Experiments module uses a layered architecture:

1. **UI Components**: Reusable components in `src/components/experiments/`
2. **Page Components**: Full pages in `src/pages/experiments/`
3. **API Service**: Data fetching and mutation in `src/services/experimentService.ts`
4. **Custom Hooks**: Reusable logic in `src/hooks/useExperiments.ts` and `src/hooks/useExperimentLogs.ts`

This separation of concerns makes the code more maintainable and allows for easier testing.
Loading