This project was created by Etiene Dalcol as part of the application process for a PhD position supervised by Dr. Marco Baroni at University Pompeu Fabra.

Introduction

The aim of this project is to create a multi-agent model to investigate the emergence of language using the EGG toolkit. The model must have two agents, a sender and a receiver, where each of them is a neural network, which are trained to communicate in order to complete a task. The task which they have to solve is adding two whole numbers ranging from 0 to N. The sender receives the pair of numbers as an input and sends a discrete message to the receiver, which then must give us the sum.

Input ([11,45]) —> Agent 1 ("Sender") - - - message - - - > Agent 2 ("Receiver") —> Output (56)

With the exception of the restriction on the length of the exchanges and other similar hyperparameters such as the size of the vocabulary, the agents have the freedom to come up with the best way to communicate so they coordinate for the solution of the task. As they come up with their messages, it is possible to investigate what these messages correspond to and conduct an analysis of the emergence of language.

Implementation

The implementation of this model uses the EGG (Emergence of lanGuage in Games) toolkit, a toolkit for emergence analysis created by Facebook Research. This toolkit is written in Python 3.6, and is based on PyTorch. Through EGG, it is possible to create several kinds of agents, by wrapping a neural network architecture in one of its ready components that handle the communication between agents. The version of EGG used for this project was a fresh installation off the main branch of its GitHub repository, with some modifications since its version 2.0 release.

The EGG toolkit repository has several usage examples, contained at the sub-directory egg/zoo. One of the examples, basic_games, implements models for two types of tasks and was used as a base for the implementation of this project's model. The final implementation of this project's code can be found at its GitHub repository, and is licensed under an MIT license.

Data Preparation

The first implementation step was to adapt the code that reads the data for digestion by the model. The dataset is created through a function that generates random numbers that sum up to a specified integer, capped on the maximum amount of samples that can be generated or a specified number of samples. The samples are then split into two text files, a training and a validation set, containing 3 numbers separated by a space per line. The first two numbers are wrapped in a vector to be sent as the input to te Sender, and the last number, the sum of the previous numbers, is used as the label.