/ForwardForward

Explorations with Geoffrey Hinton's Forward Forward algoithm

Primary LanguagePythonMIT LicenseMIT

Reimplementation of the Forward-Forward Algorithm

Our Paper: https://arxiv.org/abs/2307.04205

This is a reimplementation of Geoffrey Hinton's Forward-Forward Algorithm in Python/Pytorch. Majority of the code in the folder official_python_implementation is taken from here.

Original Paper

This code covers the experiments described in section 3.3 ("A simple supervised example of FF") of the paper and achieves roughly the same performance as the official Matlab implementation (see Results section).

In addition to a re-implementation of section 3.3 ("A simple supervised example of FF") of the paper, we have extended the forward-forward algorithm to a sentiment analysis task. We have also performed explorations with thresholds and different activation functions. Our findings have been summarized here: Report and Video

How to Use

  • Install required dependencies from requirements.txt
  • update config.py with the required parameters for choosing a dataset (MNIST/CIFAR10/Sentiment) and model architecture
  • From the official_python_implementation folder, run the following command:
python main.py