avatarShalise S. Ayromloo, PhD

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

2633

Abstract

and use this memory to inform the processing of new inputs. This makes them excellent at handling tasks that involve sequences, where the order of inputs — like the words in a sentence or notes in a melody — crucially impacts the outcome.</p><p id="791a"><b>The Feedback Loop: RNNs’ Unique Feature</b></p><p id="b984">The memory of RNNs is possible because, unlike <a href="https://readmedium.com/introduction-to-feedforward-neural-networks-77635b08dcf2">a Feedforward Neural Network</a> where information flows in only the forward direction, in RNNs, the information can cycle through the network in a loop. Like any other neural network, RNNs receive data in the input layer, but not the entire sequence all at once. In the ice breaker example, when the first person, let’s say me, says “My name is Shalise Ayromloo” (I might have never gone first in the ice breaker, but I’m authoring this blog, so I get to set the scene!), the sentence isn’t input all at once. Instead, the words “My”, “name”, “is” etc., are processed sequentially.</p><figure id="3411"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*7x95dL8fQomrVVRBTFkubQ.png"><figcaption>Author’s own simple illustration of a Recurrent Neural Network architecture. It shows three layers: an input layer, a hidden layer, and an output layer. The input layer is composed of three timesteps; each timestep contains five neurons. The hidden layer, which is parallel to the input layer, also has three timesteps, each consisting of seven neurons that are depicted as slightly larger to signify the computational processing that occurs at this stage. Lastly, the output layer comprises three neurons. In terms of connectivity, each neuron in the first timestep of the input layer is connected to every neuron in the first timestep of the hidden layer, with these connections highlighted in yellow. Neurons in the second timestep of the input layer are similarly connected to those in the second timestep of the hidden layer, with these connections depicted in green. The neurons in the third timestep of the input layer are connected to those in the third timestep of the hidden layer, and these connections are indicated by purple lines. Additionally, each neuron in the hidden layer is part of a feedback loop, represented by red arrows, which connects it back to itself, indicating the recurrent nature of this layer. Only the neurons in the third timestep of the hidden layer are connected to the neurons of the output layer, demonstrating that the final output is a function of the processed information from the last timestep. This characteristic is central

Options

to the RNN’s ability to process sequences of data for tasks such as time series prediction, natural language processing, and more.</figcaption></figure><p id="1cd6"><b>Contextual Data Processing in RNNs: An Interactive Example</b></p><p id="5648">Each word is processed and passed to a hidden layer. This is where the “loop” part of an RNN comes into play. Unlike in other neural networks we’ve discussed, where neurons in a hidden layer are only connected to neurons in the preceding and following layers, in an RNN, each neuron in the hidden layer is also connected to itself through a mechanism known as a feedback loop. This loop enables the neuron to retain a form of memory, much like our brains do when trying to remember a series of names.</p><p id="9b53">When the network processes the first input, it generates a hidden state in the hidden layer based on that input. When it moves on to the next input, it doesn’t just use that next input. It also uses the hidden state from the previous input, which acts as a form of short-term memory. This allows the network to maintain a context over time.</p><p id="689c">The hidden state is like the neuron’s memory. It remembers what happened with the previous input. This memory gets updated each time a new input comes in, allowing the RNN to “learn” from the sequence of data it’s processing.</p><p id="d1c6">So, when the second person in our ice breaker introduces themselves and says, “My name is John Doe”, the network doesn’t just process this information on its own, but it also considers the information stored in the hidden state, which is the memory of the first person’s introduction. In this way, the network “remembers” the first person’s introduction when processing the second person’s introduction.</p><p id="0dcb">When the second person repeats the first person’s name (“Her name is Shalise Ayromloo”), this is part of the new input being processed, but the network is also using its “memory” (the information in the hidden state) to understand this new input in the context of the previous input.</p><p id="83e4">Finally, based on the information processed in the hidden layers, the output layer generates the final output. It’s worth mentioning that the memory of RNNs are not as perfect as I made it out to be and RNNs do struggle with long sequences of data, known as the “long-term dependency” problem. This is where more advanced RNNs like LSTM (Long Short-Term Memory) and GRU (Gated Recurrent Units) networks come in, offering more sophisticated mechanisms for managing memory over longer sequences. But that’s a topic for another day!</p></article></body>

Introduction to Recurrent Neural Networks

Exploring the Intricacies of Recurrent Neural Networks: From Voice Assistant Technologies to Advanced AI Memory Processing

The Role of RNNs in Modern AI Applications

Siri, look up “Recurrent Neural Networks.” Alexa, play “Memories” by Maroon 5. Have you ever wondered how these virtual voice assistants respond to such varied commands? They operate using an advanced form of AI technology known as Recurrent Neural Networks. But there’s more than just technological wizardry at play here. Have you considered how the default female voice and persona of these assistants might reinforce certain gender biases? For an intriguing exploration of this topic, be sure to check out “Echoes of Yesterday: AI’s Unchanged Gender Dynamics”. If you’re new to the world of neural networks, I recommend beginning your journey with my comprehensive two-part introduction to neural networks (Part 1 and Part 2).

An Analogy for Understanding RNNs: The College Ice Breaker

Do you recall your freshman year in college? If you’re a freshman now, beware of this ice breaker! Our dorm resident advisor subjected everyone on our floor to a dreadful ice breaker. We sat in a circle and each had to introduce ourselves, but with a twist: each person also had to reintroduce every person who came before them. So, the first lucky soul introduced themselves with ease, the second person introduced person 1 and themselves, the third person introduced persons 2, 1, and themselves, and so forth. This cumulative memory task is analogous to how RNNs operate, with each new piece of information (or person introduced) being considered in the context of what has already been processed.

How RNNs Process Information: The Power of Sequential Memory

Just like this anxiety-inducing icebreaker, RNNs pass information from one step to the next in a sequence. Each word, like each person’s name in our game, is a timestep in the sequence the RNN processes. But unlike us mere mortals who might falter in our recollection, RNNs have a form of ‘perfect memory.’ Through hidden states — think of these as sticky notes where essential bits are jotted down — RNNs remember the inputs they process and use this memory to inform the processing of new inputs. This makes them excellent at handling tasks that involve sequences, where the order of inputs — like the words in a sentence or notes in a melody — crucially impacts the outcome.

The Feedback Loop: RNNs’ Unique Feature

The memory of RNNs is possible because, unlike a Feedforward Neural Network where information flows in only the forward direction, in RNNs, the information can cycle through the network in a loop. Like any other neural network, RNNs receive data in the input layer, but not the entire sequence all at once. In the ice breaker example, when the first person, let’s say me, says “My name is Shalise Ayromloo” (I might have never gone first in the ice breaker, but I’m authoring this blog, so I get to set the scene!), the sentence isn’t input all at once. Instead, the words “My”, “name”, “is” etc., are processed sequentially.

Author’s own simple illustration of a Recurrent Neural Network architecture. It shows three layers: an input layer, a hidden layer, and an output layer. The input layer is composed of three timesteps; each timestep contains five neurons. The hidden layer, which is parallel to the input layer, also has three timesteps, each consisting of seven neurons that are depicted as slightly larger to signify the computational processing that occurs at this stage. Lastly, the output layer comprises three neurons. In terms of connectivity, each neuron in the first timestep of the input layer is connected to every neuron in the first timestep of the hidden layer, with these connections highlighted in yellow. Neurons in the second timestep of the input layer are similarly connected to those in the second timestep of the hidden layer, with these connections depicted in green. The neurons in the third timestep of the input layer are connected to those in the third timestep of the hidden layer, and these connections are indicated by purple lines. Additionally, each neuron in the hidden layer is part of a feedback loop, represented by red arrows, which connects it back to itself, indicating the recurrent nature of this layer. Only the neurons in the third timestep of the hidden layer are connected to the neurons of the output layer, demonstrating that the final output is a function of the processed information from the last timestep. This characteristic is central to the RNN’s ability to process sequences of data for tasks such as time series prediction, natural language processing, and more.

Contextual Data Processing in RNNs: An Interactive Example

Each word is processed and passed to a hidden layer. This is where the “loop” part of an RNN comes into play. Unlike in other neural networks we’ve discussed, where neurons in a hidden layer are only connected to neurons in the preceding and following layers, in an RNN, each neuron in the hidden layer is also connected to itself through a mechanism known as a feedback loop. This loop enables the neuron to retain a form of memory, much like our brains do when trying to remember a series of names.

When the network processes the first input, it generates a hidden state in the hidden layer based on that input. When it moves on to the next input, it doesn’t just use that next input. It also uses the hidden state from the previous input, which acts as a form of short-term memory. This allows the network to maintain a context over time.

The hidden state is like the neuron’s memory. It remembers what happened with the previous input. This memory gets updated each time a new input comes in, allowing the RNN to “learn” from the sequence of data it’s processing.

So, when the second person in our ice breaker introduces themselves and says, “My name is John Doe”, the network doesn’t just process this information on its own, but it also considers the information stored in the hidden state, which is the memory of the first person’s introduction. In this way, the network “remembers” the first person’s introduction when processing the second person’s introduction.

When the second person repeats the first person’s name (“Her name is Shalise Ayromloo”), this is part of the new input being processed, but the network is also using its “memory” (the information in the hidden state) to understand this new input in the context of the previous input.

Finally, based on the information processed in the hidden layers, the output layer generates the final output. It’s worth mentioning that the memory of RNNs are not as perfect as I made it out to be and RNNs do struggle with long sequences of data, known as the “long-term dependency” problem. This is where more advanced RNNs like LSTM (Long Short-Term Memory) and GRU (Gated Recurrent Units) networks come in, offering more sophisticated mechanisms for managing memory over longer sequences. But that’s a topic for another day!

Neural Networks
Recurrent Neural Network
Machine Learning
Data Science
Recommended from ReadMedium