# How do neural networks learn?

Neural networks are generating a lot of excitement, as they are quickly proving to be a promising and practical form of machine intelligence. At Fast Forward Labs, we just finished a project researching and building systems that use neural networks for image analysis, as shown in our toy application Pictograph. Our companion deep learning report explains this technology in depth and explores applications and opportunities across industries.

As we built Pictograph, we came to appreciate just how challenging it is to understand how neural networks work. Even research teams at large companies like Google and Facebook are struggling to understand how neural network layers interact and how the algorithms “learn,” or improve their performance on a task over time. You can learn more about this on their research blog and explanatory videos.

To help understand how neural networks learn, I built a visualization of a network at the neuron level, including animations that show how it learns. If you’re familiar with neural networks or want to follow the rest of the post with a visual cue, please see the interactive visualization here.

Neural Network Basics

First, some deep learning basics. Neural networks are composed of layers of computational units (neurons), with connections among the neurons in different layers. These networks transform data – like the pixels in an image or the words in a document – until they can classify it as an output, such as naming an object in an image or tagging unstructured text data.

Each neuron in a network transforms data using a series of computations: a neuron multiplies an initial value by some weight, sums results with other values coming into the same neuron, adjusts the resulting number by the neuron’s bias, and then normalizes the output with an activation function. The bias is a neuron-specific number that adjusts the neuron’s value once all the connections are processed, and the activation function ensures values that are passed on lie within a tunable, expected range. This process is repeated until the final output layer can provide scores or predictions related to the classification task at hand, e.g., the likelihood that a dog is in an image.

Neural networks generally perform supervised learning tasks, building knowledge from data sets where the right answer is provided in advance. The networks then learn by tuning themselves to find the right answer on their own, increasing the accuracy of their predictions.

To do this, the network compares initial outputs with a provided correct answer, or target. A technique called a cost function is used to modify initial outputs based on the degree to which they differed from the target values. Finally, cost function results are then pushed back across all neurons and connections to adjust the biases and weights.

This push-back method is called backpropagation - and it is the key to how a neural network learns a particular task.

Details of the Visualization

Play with the visualization to see how these components work. Notice how you can adjust the inputs. Each connection has the value of its weight hovering nearby; each neuron has its bias (b) below and the result of its activation function (σ) above.

Click forward to compare the final layer’s guesses with the target values. Click backprop to watch the values adjust. Click forward again to see the output layer improve slightly in comparison to the targets.

This visualization is designed to be as simple as possible to highlight the fundamentals. It uses a softmax function to compute cost and a sigmoid function for activation. Other aspects of normal training, like regularization, dropout, and mini-batching, are ignored.

Interpreting Learning

One powerful idea this visualization communicates is that, even in this simple network, changes made to a single value do not tell us much about the behavior of the network. This is one reason why neural networks are hard to interpret: discrete points provide little to no insight into the overall dynamics, even though backpropagation technically can be reduced down to tweaking individual parameters.

For this reason, we must think about neural networks as complex systems that exhibit emergent behavior: it is the interactions among the neurons, rather than the neurons themselves, that enable the network to learn. In a prior post, we visualized this with the metaphor of a bee swarm. Conway’s Game of Life provides another illustration, where complicated structures emerge from turning cells in a grid on and off according to a few basic rules.

As thinkers dating back to John Stuart Mill have hypothesized that consciousness emerges from brain matter, we may be tempted to infer another reason why neural networks function like brains. But brains are much more plastic and flexible than artificial neural networks. Neural networks are trained to perform a specific singular task; humans learn by switching contexts and redefining tasks as they encounter new information.

Still, the brain metaphor can help conceptualize how neural networks learn. Like brains, neural networks accept and process new input (“feed information forward”), determine the correct response to new input (“evaluate a cost function”), and reflect on errors to improve future performance (“backpropagate”).

It’s still unclear what kind of intelligence will emerge from neural networks in the coming years, but it’s important we understand how learning actually works to refine our conceptions of what’s possible. Hopefully our visualization helps to explain what learning means in this context. Grasping new AI systems is a difficult task, but an important for one for education, public communication, and choices about how to engineer systems with realistic expectations.

–Mike
homepage: http://mwskirpan.com
visualization: http://mwskirpan.com/NN_viz
viz code:https://github.com/wannabeCitizen/NN_viz/tree/gh-pages

Newer
Older

## Latest posts

##### Nov 15, 2022 · newsletter
November 2022 Perhaps November conjures thoughts of holiday feasts and festivities, but for us, it’s the perfect time to chew the fat about machine learning! Make room on your plate for a peek behind the scenes into our current research on harnessing synthetic image generation to improve classification tasks. And, as usual, we reflect on our favorite reads of the month. New Research! In the first half of this year, we focused on natural language processing with our Text Style Transfer blog series.
##### Nov 14, 2022 · post
by Introduction This post documents the first part of a research effort to quantify the impact of synthetic data augmentation in training a deep learning model for detecting manufacturing defects on steel surfaces. We chose to generate synthetic data using CycleGAN,1 an architecture involving several networks that jointly learn a mapping between two image domains from unpaired examples (I’ll elaborate below). Research from recent years has demonstrated improvement on tasks like defect detection2 and image segmentation3 by augmenting real image data sets with synthetic data, since deep learning algorithms require massive amounts of data, and data collection can easily become a bottleneck.
##### Oct 20, 2022 · newsletter
October 2022 We’ve got another action-packed newsletter for October! Highlights this month include the re-release of a classic CFFL research report, an example-heavy tutorial on Dask for distributed ML, and our picks for the best reads of the month. Open Data Science Conference Cloudera Fast Forward Labs will be at ODSC West near San Fransisco on November 1st-3rd, 2022! If you’ll be in the Bay Area, don’t miss Andrew and Melanie who will be presenting our recent research on Neutralizing Subjectivity Bias with HuggingFace Transformers.
##### Sep 21, 2022 · newsletter
September 2022 Welcome to the September edition of the Cloudera Fast Forward Labs newsletter. This month we’re talking about ethics and we have all kinds of goodies to share including the final installment of our Text Style Transfer series and a couple of offerings from our newest research engineer. Throw in some choice must-reads and an ASR demo, and you’ve got yourself an action-packed newsletter! New Research! Ethical Considerations When Designing an NLG System In the final post of our blog series on Text Style Transfer, we discuss some ethical considerations when working with natural language generation systems, and describe the design of our prototype application: Exploring Intelligent Writing Assistance.
##### Sep 8, 2022 · post
by This post has a companion piece: Ethics Sheet for AI-assisted Comic Book Art Generation I want to make a comic book. Actually, I want to make tools for making comic books. See, the problem is, I can’t draw too good. I mean, I’m working on it. Check out these self portraits drawn 6 months apart: Left: “Sad Face”. February 2022. Right: “Eyyyy”. August 2022. But I have a long way to go until my illustrations would be considered professional quality, notwithstanding the time it would take me to develop the many other skills needed for making comic books.
##### Aug 18, 2022 · newsletter
August 2022 Welcome to the August edition of the Cloudera Fast Forward Labs newsletter. This month we’re thrilled to introduce a new member of the FFL team, share TWO new applied machine learning prototypes we’ve built, and, as always, offer up some intriguing reads. New Research Engineer! If you’re a regular reader of our newsletter, you likely noticed that we’ve been searching for new research engineers to join the Cloudera Fast Forward Labs team.

### Popular posts

##### Oct 30, 2019 · newsletter
Exciting Applications of Graph Neural Networks
##### Nov 14, 2018 · post
Federated learning: distributed machine learning with data locality and privacy
##### Apr 10, 2018 · post
PyTorch for Recommenders 101
##### Oct 4, 2017 · post
First Look: Using Three.js for 2D Data Visualization
##### Aug 22, 2016 · whitepaper
Under the Hood of the Variational Autoencoder (in Prose and Code)
##### Feb 24, 2016 · post
"Hello world" in Keras (or, Scikit-learn versus Keras)

# Reports

In-depth guides to specific machine learning capabilities

# Prototypes

Machine learning prototypes and interactive notebooks

## ASR with Whisper

Explore the capabilities of OpenAI's Whisper for automatic speech recognition by creating your own voice recordings!
https://colab.research.google.com/github/fastforwardlabs/whisper-openai/blob/master/WhisperDemo.ipynb

## NeuralQA

A usable library for question answering on large datasets.
https://neuralqa.fastforwardlabs.com

## Explain BERT for Question Answering Models

Tensorflow 2.0 notebook to explain and visualize a HuggingFace BERT for Question Answering model.
https://colab.research.google.com/drive/1tTiOgJ7xvy3sjfiFC9OozbjAX1ho8WN9?usp=sharing

## NLP for Question Answering

Ongoing posts and code documenting the process of building a question answering model.
https://qa.fastforwardlabs.com

# Cloudera Fast Forward Labs

Making the recently possible useful.

Cloudera Fast Forward Labs is an applied machine learning research group. Our mission is to empower enterprise data science practitioners to apply emergent academic research to production machine learning use cases in practical and socially responsible ways, while also driving innovation through the Cloudera ecosystem. Our team brings thoughtful, creative, and diverse perspectives to deeply researched work. In this way, we strive to help organizations make the most of their ML investment as well as educate and inspire the broader machine learning and data science community.

Cloudera   Blog   Twitter

©2022 Cloudera, Inc. All rights reserved.