improvement for examples/mnist_forward_forward
Author: whubaichuanCreated Aug 30, 2026Updated Aug 30, 2026
Context
Hi, I am running the examples/mnist_forward_forward, which is based on https://github.com/mohammadpz/pytorch_forward_forward as described in main.py. This example can be improved a lot.
Your Environment
- Installed using source? [yes]:
- Are you planning to deploy it using docker container? [no]:
- Is it a CPU or GPU environment?: GPU
- Which example are you using:
examples/mnist_forward_forward - Link to code or data to repro: https://github.com/pytorch/examples/blob/main/mnist_forward_forward/main.py
Expected Behavior
The test error is so high, not matching the results in FF paper. The lower the test error, the best the results, because test error is 100%-test accuracy.
Current Behavior
- This code (
examples/mnist_forward_forward) cannot produce the expect results as in Hinton's FF paper. I am using thetorch==2.13.0andtorchvision==0.28.0and get around 7% test error while in hinton' paper this should be around 1%-2% test error. - The base https://github.com/mohammadpz/pytorch_forward_forward shows that the test error is around 7%, which is not good.
Possible Solution
This repository can make the test error to 1% to 2 %, which is acknowledged by hinton in his previous homepge.
Steps to Reproduce
- Just run https://github.com/pytorch/examples/blob/main/mnist_forward_forward/main.py, and the high test error would be reproduced.
Failure Logs [if any]
Source: pytorch/examples