# Learning without Backpropagation: Intuition and Ideas (Part 2)

In part one, we peeked into the rabbit hole of backprop-free network training with asymmetric random feedback. In this post, we’ll jump into the rabbit hole with both feet. First I’ll demonstrate how it is possible to learn by “gradient” descent with **zero-derivative activations**, where **learning by backpropagation is impossible**. The technique is a modification of Direct Feedback Alignment. Then I’ll review several different (but unexpectedly related) research directions: targetprop, e-prop, and synthetic gradients, which set up my ultimate goal: efficient training of arbitrary recurrent networks.

## Direct Feedback Alignment

In recent research from Arild Nøkland, he explores extensions to random feedback (see part one) that avoid backpropagating error signals sequentially through the network. Instead, he proposes Direct Feedback Alignment (DFA) and Indirect Feedback Alignment (IFA) which connect the final error layer directly to earlier hidden layers through random feedback connections. Not only are they more convenient for error distribution, but they are more biologically plausible as there is no need for weight symmetry **or** feedback paths that match forward connectivity. A quick tutorial on the method:

## Learning through flat activations

In this post, we’re curious whether we can use a surrogate gradient algorithm that will handle threshold activations. Nøkland connects the direct feedback connections from the transformation output error gradient to the “layer output”, which in this case is the **output of the activation functions**. However, we want to use activation functions with zero derivative, so even with direct feedback the gradients would be zeroed during propagation through the activations.

To get around this issue, we modify DFA to instead connect the error layer directly to the **inputs of the activations**, instead of the outputs. The result is that we have affine transformations which can learn to connect latent input ($h_{i-1}$ from earlier layers) to a projection of output error ($B_i \nabla y$) into the space of $h_i$, **before** applying the threshold nonlinearity. The effect of the application of a nonlinear activation is “handled” by the progressive re-learning of later network layers. Effectively, each layer **learns how to align their inputs with a fixed projection of the error**. The hope is that, by aligning layer input with final error gradients, we can **project the inputs to a space that is useful for later layers**. Learning happens in parallel, and later layers eventually learn to adjust to the learning that happens in the earlier layers.

## MNIST with Modified DFA

Reusing the approach in an earlier post on JuliaML, we will attempt to learn neural network parameters both with backpropagation and our modified DFA method. The combination of Plots and JuliaML makes digging into network internals and building custom learning algorithms super-simple, and the DFA learning algorithm was fairly quick to implement. The full notebook can be found here. To ease understanding, I’ve created a video to review the notebook, method, and preliminary results:

Nice animations can be built using the super-convenient animation facilities of Plots:

## Target Propagation

The concept of Target Propagation (targetprop) goes back to LeCun 1987, but has recently been explored in depth in Bengio 2014, Lee et al 2014, and Bengio et al 2015. The intuition is simple: instead of focusing solely on the “forward-direction” model ($y = f(x)$), we also try to fit the “backward-direction” model ($x = g(y)$). $f$ and $g$ form an auto-encoding relationship; $f$ is the **encoder**, creating a latent representation and predicted outputs given inputs $x$, and $g$ is the **decoder**, generating input representations/samples from latent/output variables.

Bengio 2014 iteratively adjusts weights to push latent outputs $h_i$ towards the **targets**. The final layer adjusts towards useful final targets using the output gradients as a guide:

Difference Target Propagation makes a slight adjustment to the update, and attempts to learn auto-encoders which fulfill:

\[\begin{align} \hat{h}_i - h_i &= g_i (\hat{h}_{i+1}) - g_i (h_{i+1}) \nonumber \end{align}\]Finally, Bengio et al 2015 extend targetprop to a Bayesian/generative setting, in which they attempt to reduce divergence between generating distributions p and q, such that the pair of conditionals form a denoising auto-encoder:

\[\begin{align} h_i &\sim p (h_i | \hat{h}_{i+1}) \nonumber \\ h_i &\sim q (h_i | \hat{h}_{i-1}) \nonumber \end{align}\]Targetprop (and its variants/extensions) is a nice alternative to backpropagation. There is still sequential forwards and backwards passes through the layers, however we:

- avoid the issues of vanishing and exploding gradients, and
- focus on the role of intermediate layers: creating latent representations of the input which are useful in the context of the target values.

## Equilibrium Propagation

Equilibrium Propagation (e-prop) is a relatively new approach which (I’m not shy to admit) I’m still trying to get my head around. As I understand, it uses an iterative process of perturbing components towards improved values and allowing the network dynamics to settle into a new equilibrium. The proposed algorithm alternates between phases of “learning” in a forward and backward direction, though it is a departure from the simplicity of backprop and optimization.

The concepts are elegant, and it offers many potential advantages for efficient learning of very complex networks. However it will be a long time before those efficiencies are realized, given the trend towards massively parallel GPU computations. I’ll follow this line of research with great interest, but I don’t expect it to be used in a production setting in the near future.

## Synthetic Gradients

A recent paper from DeepMind takes an interesting approach. What if we use complex models to estimate useful surrogate gradients for our layers? Their focus is primarily from the perspective of “unlocking” (i.e. parallelizing) the forward, backward, and update steps of a typical backpropagation algorithm. However they also offer the possibility of estimating (un-truncated) Backpropagation Through Time (BPTT) gradients, which would be a big win.

Layers output to a local model, called a Decoupled Neural Interface. This local model estimates the value of the backpropagated gradient that would be used for updating the parameters of that layer, estimated using only the layer outputs and target vectors. If you’re like me, you noticed the similarity to DFA in modeling the relationship of the local layer and final targets in order to choose a search direction which is useful for improving the final network output.

## What next?

I think the path forward will be combinations and extensions of the ideas presented here. Like synthetic gradients and direct feedback, I think we should be attempting to find reliable alternatives to backpropagation which are:

- Highly parallel
- Asymmetric
- Local in time and space

Obviously they must still enable learning, and efficient/simple solutions are preferred. I like the concept of synthetic gradients, but wonder if they are optimizing the wrong objective. I like direct feedback, but wonder if there are alternate ways to initialize or update the projection matrices ($B_1, B_2, …$). Combining the concepts, can we add non-linearities to the error projections (direct feedback) and learn a more complex (and hopefully more useful) layer?

There is a lot to explore, and I think we’re just at the beginning. I, for one, am happy that I chose the red pill.