egg

EGG: Emergence of lanGuage in Games

https://github.com/facebookresearch/egg

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    3 of 22 committers (13.6%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.5%) to scientific vocabulary
Last synced: 7 months ago · JSON representation ·

Repository

EGG: Emergence of lanGuage in Games

Basic Info
  • Host: GitHub
  • Owner: facebookresearch
  • License: mit
  • Language: Jupyter Notebook
  • Default Branch: main
  • Size: 103 MB
Statistics
  • Stars: 301
  • Watchers: 15
  • Forks: 107
  • Open Issues: 12
  • Releases: 0
Created about 7 years ago · Last pushed 11 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation

README.md

EGG : Emergence of lanGuage in Games

GitHub Python 3.6

Introduction

EGG is a toolkit that allows researchers to quickly implement multi-agent games with discrete channel communication. In such games, the agents are trained to communicate with each other and jointly solve a task. Often, the way they communicate is not explicitly determined, allowing agents to come up with their own 'language' in order to solve the task. Such setup opens a plethora of possibilities in studying emergent language and the impact of the nature of task being solved, the agents' models, etc. This subject is a vibrant area of research often considered as a prerequisite for general AI. The purpose of EGG is to offer researchers an easy and fast entry point into this research area.

EGG is based on PyTorch and provides: (a) simple, yet powerful components for implementing communication between agents, (b) a diverse set of pre-implemented games, (c) an interface to analyse the emergent communication protocols.

Key features: * Primitives for implementing a single-symbol or variable-length, discrete or continuous communication (with vanilla FFNs, RNNs, GRUs, LSTMs or Transformers); * Support for a single pair as well as a population of interacting agents; * Training with optimization of the communication channel with REINFORCE or Gumbel-Softmax relaxation via a common interface; * Simplified configuration of the general components, such as checkpointing, optimization, tensorboard support, etc; * Provides a simple CUDA-aware command-line tool for grid-search over parameters of the games.

To fully leverage EGG one would need at least a high-level familiarity with PyTorch. However, to get a taste of communication games without writing any code, you could try a dataset-based game, which allow you to experiment with different signaling games by simply editing input files.

List of implemented games

List of example and tutorial games

* [`MNIST autoencoder tutorial`](/tutorials/EGG%20walkthrough%20with%20a%20MNIST%20autoencoder.ipynb): A Jupyter tutorial that implements a MNIST discrete auto-encoder step-by-step, covering the basic concepts of EGG. The tutorial starts with pre-training a "vision" module and builds single- and multiple symbol auto-encoder communication games with channel optimization done by Reinforce and Gumbel-Softmax relaxation ([notebook](/tutorials/EGG%20walkthrough%20with%20a%20MNIST%20autoencoder.ipynb) / [colab](https://colab.research.google.com/github/facebookresearch/EGG/blob/main/tutorials/EGG%20walkthrough%20with%20a%20MNIST%20autoencoder.ipynb)). * [`egg/zoo/basic_games`](/egg/zoo/basic_games): Simple implementations of reconstruction and discrimination games, taking their inputs from text files, and with thoroughly annotated code. These might be a good starting point to learn to play with EGG. * [`egg/zoo/signal_game`](/egg/zoo/signal_game): Modern version of a Lewis' signaling game. In this game, Sender is presented with a target image and with one or more distractor images. Then all images are shuffled and Receiver has to point to the target image based on a message from Sender. This implementation is based on Diane Bouchacourt's code. * [`egg/zoo/simple_autoenc`](/egg/zoo/simple_autoenc): Discrete auto-encoder Sender/Receiver game that auto-encodes one-hot vectors using variable-length messages. * [`egg/zoo/mnist_autoenc`](/egg/zoo/mnist_autoenc): Discrete MNIST auto-encoder game. In this Sender/Receiver game, Sender looks onto a MNIST image and sends a single symbol to Receiver, who tries to recover the image. * [`egg/zoo/mnist_vae`](/egg/zoo/mnist_vae): Continuous-message VAE cast as an auto-encoder game. In this Sender/Receiver (Encoder/Decoder) game, Sender looks onto a MNIST image and sends a multi-dimensional vector to Receiver, who tries to recover the image. * [`egg/zoo/summation`](/egg/zoo/summation): Sender and Receiver are jointly trained to recognize the `a^nb^n` grammar: Sender reads an input sequence and Receiver answers if the sequence belongs to the grammar. Which agent actually counts, Sender or Receiver? Does Sender make the decision and send it to Receiver? Or does Sender encode the incoming sequence in the message and it is Receiver that make the decision? Or something in-between? * [`egg/zoo/external_game`](/egg/zoo/external_game): A signaling game that takes inputs and ground-truth outputs from CSV files.

Games used in published work

  • egg/zoo/channel: Anti-efficient encoding in emergent communication. Rahma Chaabouni, Eugene Kharitonov, Emmanuel Dupoux, Marco Baroni. NeurIPS 2019.

  • egg/zoo/objects_game: Focus on Whats Informative and Ignore Whats not: Communication Strategies in a Referential Game. Roberto Dess, Diane Bouchacourt, Davide Crepaldi, Marco Baroni. NeurIPS Workshop on Emergent Communication 2019. A Sender/Receiver game where the Sender sees a target as a vector of discrete properties (e.g. [2, 4, 3, 1] for a game with 4 dimensions) and the Receiver has to recognize the target among a lineup of target+distractor(s).

  • egg/zoo/compo_vs_generalization Compositionality and Generalization in Emergent Languages. Rahma Chaabouni, Eugene Kharitonov, Diane Bouchacourt, Emmanuel Dupoux, Marco Baroni. ACL 2020.

  • egg/zoo/compo_vs_generalization_ood Defending Compositionality in Emergent Languages. Michal Auersperger, Pavel Pecina. NAACL SRW 2022.

  • egg/zoo/language_bottleneck Entropy Minimization In Emergent Languages. Eugene Kharitonov, Rahma Chaabouni, Diane Bouchacourt, Marco Baroni. ICML 2020. egg/zoo/language_bottleneck contains a set of games that study the information bottleneck property of the discrete communication channel. This poperty is illustrated in an EGG-based example of MNIST-based style transfer without an adversary (notebook / colab).

We are adding games all the time: please look at the egg/zoo directory to see what is available right now. Submit an issue if there is something you want to have implemented and included.

More details on each game's command line parameters are provided in the games' directories.

An important technical point

EGG supports Reinforce and Gumbel-Softmax optimization of the communication channel. Currently, Gumbel-Softmax-based optimization is only supported if the game loss is differentiable. The MNIST autoencoder game tutorial illustrates both Reinforce and Gumbel-Softmax channel optimization when using a differentiable game loss. The signaling game has a non-differentiable game loss, and the communication channel is optimized with Reinforce.

Installing EGG

Generally, we assume that you use PyTorch 1.1.0 or newer and Python 3.6 or newer.

  1. (optional) It is a good idea to develop in a new conda environment, e.g. like this: conda create --name egg36 python=3.6 conda activate egg36
  2. EGG can be installed as a package to be used as a library pip install git+ssh://git@github.com/facebookresearch/EGG.git or via https pip install git+https://github.com/facebookresearch/EGG.git Alternatively, EGG can be cloned and installed in editable mode, so that the copy can be changed: git clone git@github.com:facebookresearch/EGG.git && cd EGG pip install --editable . 3. Then, we can run a game, e.g. the MNIST auto-encoding game: bash python -m egg.zoo.mnist_autoenc.train --vocab=10 --n_epochs=50

EGG structure

The repo is organised as follows: - tests # tests for the common components - docs # documentation for EGG - egg -- core # common components: trainer, wrappers, games, utilities, ... -- zoo # pre-implemented games -- nest # a tool for hyperparameter grid search

How-to-Start and Learning more

  • Our EMNLP'19 Demo paper provides a high-level view of the toolkit and points to further resources.
  • The step-by-step MNIST autoencoder tutorial goes over all essential steps to create a full-featured communication game with variable length messages between the agents. NB: depending on your computational resources, this might take a while to run! (open in colab)
  • The simplest starter code is in egg/zoo/basic_games, providing implementations of basic reconstruction and discrimination games. Input can be provided through text files, and the code is thoroughly commented.
  • Another good starting point to implement a Sender/Receiver game is the MNIST autoencoder game, MNIST auto-encoder game. The game features both Gumbel-Softmax and Reinforce-based implementations.
  • A template for a game is provided in egg/zoo/template.
  • EGG can be used for autoencoder-based experiments or even self-supervised learning. An implementation of SimCLR introduce in Chen et al. 2020 can be found in egg/zoo/simclr.
  • EGG provides some utility boilerplate around commonly used command line parameters. Documentation about using it can be found here.
  • A brief how-to for tensorboard is here.
  • To learn more about the provided hyperparameter search tool, read this doc.

Citation

If you find EGG useful in your research, please cite this repository: @misc{kharitonov:etal:2021, author = "Kharitonov, Eugene and Dess{\`i}, Roberto and Chaabouni, Rahma and Bouchacourt, Diane and Baroni, Marco", title = "{EGG}: a toolkit for research on {E}mergence of lan{G}uage in {G}ames", howpublished = {\url{https://github.com/facebookresearch/EGG}}, year = {2021} }

Contributing

Please read the contribution guide.

Testing

Run pytest:

python -m pytest

All tests should pass.

Licence

The majority of EGG is licensed under MIT, however portions of the project are available under separate license terms: LARC is licensed under the BSD 3-Clause license.

The text of the license for EGG can be found here.

Owner

  • Name: Meta Research
  • Login: facebookresearch
  • Kind: organization
  • Location: Menlo Park, California

Citation (CITATION.bib)

@misc{kharitonov:etal:2021,
  author = "Kharitonov, Eugene  and Dess{\`i}, Roberto and Chaabouni, Rahma  and Bouchacourt, Diane  and Baroni, Marco",
  title = "{EGG}: a toolkit for research on {E}mergence of lan{G}uage in {G}ames",
  howpublished = {\url{https://github.com/facebookresearch/EGG}},
  year = {2021}
}

GitHub Events

Total
  • Watch event: 17
  • Issue comment event: 6
  • Push event: 1
  • Pull request review event: 1
  • Pull request event: 7
  • Fork event: 9
Last Year
  • Watch event: 17
  • Issue comment event: 6
  • Push event: 1
  • Pull request review event: 1
  • Pull request event: 7
  • Fork event: 9

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 1,341
  • Total Committers: 22
  • Avg Commits per committer: 60.955
  • Development Distribution Score (DDS): 0.23
Past Year
  • Commits: 11
  • Committers: 1
  • Avg Commits per committer: 11.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
mahautm m****t@u****u 1,032
eugene-kharitonov k****v@f****m 101
Roberto r****1@g****m 97
mbaroni m****i@f****m 41
mahautm m****t@g****m 18
Evgeny Kharitonov k****v@d****r 9
rahmacha c****a@g****m 9
Nicolo n****1@g****m 7
Mateo MAHAUT m****t@o****u 5
Aga Slowik a****k@f****m 4
Marco Baroni m****i@d****r 3
u203445 u****5@u****u 3
Tomek Korbak t****k@g****m 2
DianeBouchacourt d****b@f****m 2
Gabriele Gennaro 6****n 1
Etiene Dalcol E****e 1
Davide Locatelli 5****t 1
Jon Janzen j****n@m****m 1
Michael m****v@g****m 1
Rotem-BZ 9****Z 1
Shawn Guo s****n@g****m 1
michal-au m****u 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 41
  • Total pull requests: 73
  • Average time to close issues: 6 months
  • Average time to close pull requests: 23 days
  • Total issue authors: 15
  • Total pull request authors: 17
  • Average comments per issue: 2.41
  • Average comments per pull request: 1.14
  • Merged pull requests: 47
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 8
  • Average time to close issues: N/A
  • Average time to close pull requests: 11 days
  • Issue authors: 0
  • Pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 1.38
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • mbaroni (15)
  • robertodessi (7)
  • nicofirst1 (4)
  • mitjanikolaus (2)
  • SZW-zjbd (2)
  • eugene-kharitonov (1)
  • dmitrySorokin (1)
  • Rotem-BZ (1)
  • leonl42 (1)
  • Shubham0209 (1)
  • DominikKuenkele (1)
  • dereyly (1)
  • zongzi3zz (1)
  • tomekkorbak (1)
  • vrmer (1)
Pull Request Authors
  • robertodessi (32)
  • nicofirst1 (17)
  • cklamra (6)
  • Slowika (2)
  • mbaroni (2)
  • mahautm (2)
  • michal-au (1)
  • mnoukhov (1)
  • DominikKuenkele (1)
  • Etiene (1)
  • mitjanikolaus (1)
  • kaulson (1)
  • davidelct (1)
  • gabgen (1)
  • eugene-kharitonov (1)
Top Labels
Issue Labels
enhancement (21) bug (12) help wanted (9) major-new-functionality (4) good first issue (4) low-priority (3) upcoming (3)
Pull Request Labels
CLA Signed (62)

Dependencies

requirements.txt pypi
  • dataclasses *
  • editdistance *
  • numpy *
  • pytest *
  • rich *
  • scikit-learn *
  • scipy *
  • submitit *
  • torch >=1.1.0
  • torchvision *
  • wandb *