Git Product home page Git Product logo

othello_world's Introduction

Exploring the Limits of OthelloGPT's Emergent Representations

Overview

This repo contains code and data for my investigation of linear representations in OthelloGPT, a small transformer model trained to predict legal moves in the game Othello. This project follows up on the work by Li et al. and Neel Nanda.

The project investigates the emergent linear representations within transformer models, demonstrating that targeted interventions using directions learned by linear probes can achieve near-perfect edit performance. It also introduces a novel technique for "global intervention," where a full board state is substituted into the residual stream during inference. Linear probes are also used to extract and edit representations beyond the board state, with interventions on the next turn color coherently altering the model's board representation and outputs.

Full Report: Exploring the Limits of OthelloGPT's Emergent Representations

Table of Contents

Installation

conda env create -f environment.yml
conda activate othello
python -m ipykernel install --user --name othello --display-name "Othello"

Usage

Generating Synthetic Data

To use the original paper's datasets: download the championship dataset and the synthetic dataset and save them in data subfolder.

To generate new synthetic dataset, see data/othello.py. It contains code to generate synthetic games with a 'playertype' component that is biased in a particular cardinal direction (details in full report).

Training Othello-GPT

See train_othello_model.ipynb. For this project, training used 4 GPUs and took roughly 8 hours.

Probing Othello-GPT

See train_probe_othello.py. It contains flags to train probes for board state, current turn, or playertype (only valid on model trained with synthetic playertype data).

Interventions

See interventions.ipynb for Li et al's original intervention method which used non-linear probes and gradient descent.

See linear_board_probes.ipynb for interventions with linear probes, including 'global' intervention and interventions on next turn.

See probing_playertype.ipynb for intervention experiments using synthetic dataset with playertype.

Acknowledgements

I am deeply thankful to Kenneth Li and his colleagues for their pioneering work on OthelloGPT, and for making their code and datasets public. This project was initially forked from their repository, which can be found here.

othello_world's People

Contributors

icemoon97 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.