https://github.com/alignmentresearch/go_attack
Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.2%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: AlignmentResearch
- License: mit
- Language: Python
- Default Branch: main
- Size: 26.6 MB
Statistics
- Stars: 75
- Watchers: 8
- Forks: 7
- Open Issues: 18
- Releases: 0
Metadata Files
README.md
Go Attack
This repository contains code for studying the adversarial robustness of KataGo.
Read about our research: - Adversarial Policies Beat Superhuman Go AIs - Can Go AIs Be Adversarially Robust?
View our website here: https://goattack.far.ai/.
Our models and training data are available on our Google Drive. To run our adversaries with Sabaki, see this guide.
Development / testing information
To clone this repository, run one of the following commands: ```
Via HTTPS
git clone --recurse-submodules https://github.com/AlignmentResearch/go_attack.git
Via SSH
git clone --recurse-submodules git@github.com:AlignmentResearch/go_attack.git ```
Run pip install -e '.[dev]' inside the project root directory to install all necessary dependencies.
To run a pre-commit script before each commit, run pre-commit install (pre-commit should already have been installed in the previous step).
You may also want to run pre-commit install from engines/KataGo-custom to install that repository's respective commit hook.
Git submodules
Modifications to KataGo are not tracked in this repository and should instead be made to the AlignmentResearch/KataGo-custom repository. We use code from KataGo-custom in this repository via a Git submodule.
- engines/KataGo-custom tracks the
stablebranch of theKataGo-customrepository. - engines/KataGo-raw tracks the
masterbranch of https://github.com/lightvector/KataGo. - engines/KataGo-tensorflow is a version of KataGo-custom prior to merging KataGo version v1.12, which switched the training code from TensorFlow to PyTorch. We use KataGo-tensorflow to fine-tune our existing TensorFlow adversaries that pre-dated v1.12.
Individual containers
We run KataGo within Docker containers. More specifically: 1. The C++ portion of KataGo runs in the container defined by compose/cpp/Dockerfile. 2. The Python training portion of KataGo runs in the container defined at compose/python/Dockerfile.
The Dockerfiles contain instructions for how to build them.
After building a container, you run it with a command like
docker run --gpus all -v ~/go_attack:/go_attack -v DATA_DIR:/shared -it humancompatibleai/goattack:cpp
where DATA_DIR is a directory, shared among all containers, in which to save the
results of training runs.
A KataGo executable can be found in the /engines/KataGo-custom/cpp directory inside the C++ container.
Launching victim-play training runs
In order to launch training runs, run several containers simultaneously:
- One or more 1-GPU C++ containers executing victim-play games to generate data. Example
command to run in each container:
/go_attack/kubernetes/victimplay.sh [--warmstart] EXPERIMENT-NAME /shared/, where the optional--warmstartflag should be set for warmstarted runs. - One 1-GPU Python container for training. Example command:
/go_attack/kubernetes/train.sh [--initial-weights WARMSTART-MODEL-DIR] EXPERIMENT-NAME /shared/ 1.0where the optional--initial-weights WARMSTART-MODEL-DIRflag should be set for warmstarted runs. - One Python container for shuffling data. Example command:
/go_attack/kubernetes/shuffle-and-export.sh [--preseed WARMSTART-SELFPLAY-DIR] EXPERIMENT-NAME /sharedwhere the optional--preseedflag should be set for warmstarted runs. - One Python container for running the curriculum. Example command:
/go_attack/kubernetes/curriculum.sh EXPERIMENT-NAME /shared/ /go_attack/configs/examples/cyclic-adversary-curriculum.json -harden-below-visits 100.- The victims listed in the curriculum
.jsonfile are assumed to exist in/shared/victims. They can be symlinks.
- The victims listed in the curriculum
- Optionally, one 1-GPU C++ container for evaluating models. Example command:
/go_attack/kubernetes/evaluate-loop.sh /shared/victimplay/EXPERIMENT-NAME/ /shared/victimplay/EXPERIMENT-NAME/eval.
See configs/examples for example experiment configurations and example values for the warmstart flags.
For these wrapper scripts in kubernetes/, optional flags for the wrapper come
before any positional arguments, but optional flags for the underlying command
the wrapper calls go after any positional arguments. For example, in the command
/go_attack/kubernetes/shuffle-and-export.sh --preseed WARMSTART-SELFPLAY-DIR
EXPERIMENT-NAME /shared -add-to-window 100000000, --preseed is a flag for the
wrapper whereas -add-to-window is a flag to be passed to
/engines/KataGo-tensorflow/python/selfplay/shuffle_and_export_loop.sh.
Docker compose
Within the compose directory of this repo are a few docker-compose .yml files
that automate the process of spinning up the various components of training.
Each .yml file also has a corresponding .env that configures more specific
parameters of the run (
e.g. what directory to write to,
how many threads to use,
batch size,
where to look for other config files
).
(Note: we stopped using these in October 2022, so they are no longer maintained.)
Website and analysis notebooks
See AlignmentResearch/KataGoVisualizer.
Baseline attacks
In addition to the learned attacks, we also implement 5 baseline, hardcoded attacks: - Edge attack, which plays random vertices in the outermost available ring of the board - Random attack, which simply plays random legal moves - Pass attack, which always passes at every turn - Spiral attack, which deterministically plays the "largest" legal move in lexicographical order in polar coordinates (going counterclockwise starting from the outermost ring) - Mirror Go, which plays the opponent's last move reflected about the y = x diagonal, or the y = -x diagonal if they play on y = x. If the mirrored vertex is taken, then the policy plays the "closest" legal vertex by L1 distance.
You can test these attacks by running baseline_attacks.py with the appropriate --strategy flag (edge, random, pass, spiral, or mirror). Run python scripts/baseline_attacks.py --help for more information about all the available flags.
Owner
- Name: FAR AI
- Login: AlignmentResearch
- Kind: organization
- Email: hello@far.ai
- Website: https://far.ai
- Repositories: 16
- Profile: https://github.com/AlignmentResearch
FAR AI is an alignment research non-profit working to ensure AI systems are trustworthy and beneficial to society.
GitHub Events
Total
- Watch event: 8
- Delete event: 86
- Push event: 2
- Pull request review event: 2
- Pull request review comment event: 1
- Pull request event: 2
- Create event: 1
Last Year
- Watch event: 8
- Delete event: 86
- Push event: 2
- Pull request review event: 2
- Pull request review comment event: 1
- Pull request event: 2
- Create event: 1
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 0
- Total pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: 2 days
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: 2 days
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- SodiumJu (1)
- Dreamkeeper66666 (1)
Pull Request Authors
- tomtseng (20)
- ed1d1a8d (2)
- UFO-101 (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- black *
- codespell *
- darglint *
- flake8 *
- flake8-blind-except *
- flake8-builtins *
- flake8-commas *
- flake8-debugger *
- flake8-docstrings *
- flake8-isort *
- gpustat *
- matplotlib *
- pandas *
- psutil *
- pytype *
- scipy *
- docker *
- matplotlib *
- numpy *
- pandas *
- pynvml *
- scipy *
- seaborn *
- sgfmill *
- simple-parsing *
- tqdm *
- circleci/runner launch-agent build
- humancompatibleai/goattack cpp-build-deps build
- build-deps latest build
- nvidia/cuda 11.1.1-cudnn8-devel-ubuntu20.04 build
- nvidia/cuda 11.1.1-cudnn8-runtime-ubuntu20.04 build
- runtime-deps latest build
- humancompatibleai/goattack cpp build
- build-deps latest build
- nvcr.io/nvidia/tensorflow 22.01-tf1-py3 build
- python-deps latest build
- ubuntu 20.04 build
- nvidia/cuda 11.6.2-cudnn8-devel-ubuntu18.04 build
- nvidia/cuda 11.6.2-cudnn8-runtime-ubuntu18.04 build
- humancompatibleai/goattack cpp build
- nvidia/opencl devel-ubuntu18.04 build
- nvidia/opencl runtime-ubuntu18.04 build