Steering Through Time: How Recurrent Networks and LSTMs Learn from Sequences

Lex Fridman's MIT 6.S094 lecture walks from backpropagation basics to LSTMs and the way they are used to predict steering in self-driving cars.

LFLex FridmanAnime · Lex Fridman Podcast
Chaîne
Lex Fridman Podcast
Vidéo
1:15:59
Lecture
8 min
Original
anglais
Ouvrir sur YouTube
En faisant défiler, la vidéo se réduit en bas à droite et continue. Les sous-titres suivent votre langue de lecture.
Langue de lectureDisponible en 1 langues
Cet article n’est pas encore disponible en français ; il s’affiche dans l’original en anglais.
RÉSUMÉ

En 30 secondes

Fridman first rebuilds backpropagation from simple gates, then shows why vanishing gradients make training an art. He then introduces recurrent networks and LSTMs, surveys their applications from translation to medical diagnosis, and ends with how top Udacity self-driving competitors used them to map image sequences to steering angles.

  1. 1Recurrent networks are the right tool whenever the temporal dynamics of data matter more than any single frame, and they shine when input or output lengths vary.
  2. 2Backpropagation is just local gradients multiplied by the chain rule: an add gate passes the gradient through equally, a multiply gate swaps the forward values, and a max gate routes it to the largest input.
  3. 3Training a neural network is an optimization problem over a highly non-linear function, which is why choices like activation function and solver matter, and why practitioners call it an art.
  4. 4Plain RNNs share the same weights at every time step, but vanishing gradients make them forget what happened long agoLSTMs fix this with gates that decide what to forget, what to remember and what to output.
  5. 5Most data in the world is time series, so Fridman argues that anyone outside pure computer vision will likely end up using RNNs for their own research.
  6. 6Transfer learning lets you chop the last layer off a network trained on cats and dogsand teach it lanes, trucks or cancer, because it has already learned how to see.
TEXTE INTÉGRAL

Lire le texte remanié, chapitre par chapitre

Transcription seule
01

Recurrent networks handle sequences that vanilla networks cannot

Fridman opens by placing recurrent neural networks in the course so far: fully connected networks, convolutional networks for images, and deep reinforcement learning for systems that must act and collect reward. He calls RNNs perhaps the least understood but most exciting flavor of neural network. He also covers course logistics, including the requirement that DeepTraffic networks drive faster than 65 mph.

A vanilla network, he explains, approximates a function from one fixed-size input to one output. That holds even for a five-second audio clip, as long as the size is fixed and there is ground truth for the chunk. RNNs instead handle one-to-many, many-to-one and many-to-many mappings, including bidirectional ones.

They matter most when the connections across a sequence carry more information than each frame's spatial content, as in speech, language, audio and video. A clip of speech can map to a single label such as the speaker's gender, and Spanish can be translated into English with sequences of different lengths. When a student asks about feedback from output to input, Fridman says that loop is almost the definition of an RNN.

02

Backpropagation is simple gates and the chain rule, and every network is built from them

Fridman warns that leaning on TensorFlow tutorials while ignoring how backpropagation works is done at your peril. He frames it as comparing the network's output with ground truth and sending the error backward to reward or punish parameters. To make it concrete he uses a tiny circuit that adds x and y and multiplies the sum by z, with inputs of -2, 5 and -4 giving an output of -12.

In the backward pass he sets the output gradient to one, meaning he wants f to go up. A gradient is just how much the output changes when an input changes slightly. The add gate has slope one for both inputs, while the multiply gate flips the values, so the gradient on x depends on y and vice versa.

The chain rule is what makes this practical. Instead of writing down one giant derivative, you multiply local gradients step by step from output to input. In the example, x and y end up with a gradient of -4 and z with 3, so to raise f you decrease x and y and increase z.

Almost any operation in a network can be decomposed into three gates: add, multiply and max. Add distributes the gradient equally and ignores the forward value, multiply swaps the forward values, and max sends the gradient only to the larger input. A sigmoid neuron can be broken into the same kind of gates, plus an exponential and a division.

03

Learning is optimization, and vanishing gradients make it an art

In a real network the inputs and target outputs are fixed, so what gets adjusted are the weights and biases. After a forward pass computes the loss, gradients flow backward and the weights move opposite the gradient by an amount set by the learning rate. Fridman stresses that learning is an optimization problem: minimize an objective whose variables are possibly millions of parameters.

Gradient descent, he says, is easy to picture on a convex bowl and hard on rugged terrain full of crevices and saddle points. Stochastic gradient descent can oscillate in a saddle, and optimizers such as Adam were designed to cope. Asked how to ensure convergence on a non-convex function, he answers plainly that you cannot, and that nobody even knows the global optimum for something like driving.

The practical danger is vanishing or exploding gradients. Sigmoid derivatives go to zero at the tails, so the backpropagated signal shrinks and the network stops learning. ReLU is popular but can leave dead neurons that never fire if initialization is poor, and he mentions that 40 or 50 percent of neurons can end up dead. Telling these failures apart from a bad loss function is hard, which is why he says picking solver and activation carefully is part of the art.

He closes the topic by asking whether adjusting parameters to minimize one objective is really how human-level intelligence is achieved. The architecture itself is never evolved in this process. He shows evolutionary robotics and notes that nature-inspired algorithms for tuning weights do not currently work as well, calling backpropagation simple, even a bit dumb.

04

Unrolling an RNN reveals shared weights and the same gradient problem

Fridman draws the basic RNN: an input with weights, a hidden state that acts as memory and is connected to itself across time, and an output. Because of that loop the network can keep consuming inputs one at a time. Unrolled, it looks like a regular network repeated an arbitrary number of times.

Just as convolutional networks assume spatial consistency, RNNs assume temporal consistency and use the same weights at every step. This lets them process very long sequences without an explosion of parameters. Training uses backpropagation through time, which is ordinary backpropagation over the unrolled network.

Unrolling also inherits the old problem: if the gradient saturates anywhere along a long sequence, it drives all earlier steps toward zero, so the network effectively ignores most of the sequence. Bidirectional variants fill in missing elements of images, words or audio, and stacking layers helps but demands more data. In theory RNNs can learn any sequence, yet in practice they struggle with long-term dependencies, as in remembering that a story is about Bob and apples across several sentences.

05

LSTMs work by deciding what to forget, what to remember and what to output

When people praise recent results on time series, audio and video, Fridman says they almost always mean LSTMs, long short-term memory networks. An LSTM cell looks more complicated than a vanilla RNN cell but is more intuitive. It has gates built from sigmoid layers, which squash values between zero and one, and tanh layers, which squash between negative one and one.

He describes a conveyor belt of state running through the cell. A first sigmoid gate looks at the new input and the previous output and decides what to forget or ignore. A second step decides which part of the state to update and with what values, and a third performs the update by multiplying: zero forgets, one lets information through.

His example is a sentence about Bob and Alice having lunch, where the cell must track gender so it can generate who eats what. It has to forget that Bob likes apples while remembering that Alice likes oranges. Asked what the state actually is, he says it is a vector of numbers produced by the activations, modified by the weights and biases.

06

The same sequence machinery drives translation, captioning, audio and diagnosis

Fridman surveys applications that all share one construct: some input, a state carried along, and an output. Machine translation reads a sentence in one language and, once it ends, starts producing words in another, which he says is what Google's translator is supposedly using. Other examples include LSTMs generating handwriting from text and character-by-character text generation that predicts the next character each step.

Several systems combine vision and language in one network. A convolutional net can feed an LSTM to answer questions such as how many chairs are in an image, or to caption images and video, with markers for the start and end of sentences. Visual attention uses an RNN to steer a sliding window over an image, for example to read house numbers, and can also steer generation, such as drawing digits.

He also covers a model that watches silent video of a person hitting objects with a drumstick and generates the sound. In medicine, sparse and variable-length electronic health records can be fed in to predict diagnoses such as diabetes, scoliosis and asthma with fairly good accuracy. Stock prediction from financial data and news is something everyone wishes worked, he says, but nobody has done it convincingly, though crashes seem easier to predict.

Audio is another area: an LSTM trained on a single speaker's raw audio starts producing something that sounds like words after only a few epochs. Going the other way, audio can be mapped to a classification, such as whether a road is wet or dry from its sound, the speaker's gender, or the words spoken in speech recognition.

07

Sequences of images beat single frames for predicting steering

Turning to driving, Fridman recalls the NVIDIA-style network behind DeepTeslaJS: five convolutional layers and three fully connected layers. It takes a single image with no temporal information and regresses the steering angle. He then describes the Udacity self-driving competition, where the winners went beyond that and used sequences of images.

The first- and third-place teams used LSTMs to map image sequences to sequences of steering angles, while he says the second-place team used 3D convolutions. A convolutional network extracts a representation of each frame, and that becomes the LSTM's input at every time step. The first-place team also predicted vehicle speed and torque, using sequences of length 10 and supervised learning with no reinforcement.

Fridman says most people who are not computer vision specialists will want RNNs, because very few of us work on data without a time dimension. On the question of why a length of 10 if RNNs are arbitrary, he says it is only the training chunk, and the structure is still a single looping cell. He encourages Kaggle-style competitions, where the work is months of tuning parameters, preprocessing, learning rates and optimizers.

Team Chauffeur, the third-place winner, used transfer learning. Take a network trained on a huge dataset such as ImageNet, chop off the final layer and retrain it for a new task like cancer or no cancer. They took a giant convolutional net, used its roughly 3,000 features per frame as input to an LSTM, and used a sequence length of 50.

Fridman ends by saying the art of neural networks lies in parameter tuning, which experience teaches and lectures cannot. He repeats Geoffrey Hinton's joke about "Stochastic Graduate Student Descent", where you keep hiring graduate students to tweak hyperparameters until the problem is solved. He then previews the next lecture on driver state, his own passion, and a guest from the White House on AI policy.

Sur la même chaîne

3:36:56EN
Lex Fridman· 16 sept. 2026PodcastPsychiatry Has Never Found Its PenicillinAnime : Lex FridmanHistorian Andrew Scull tells Lex Fridman why the field can ease symptoms, has never cured a major mental illness, and keeps paying for overconfidence with patients' lives.Mental HealthPublic HealthNeuroscience
5:15:51EN
Lex Fridman· 26 août 2026Podcast · 2 voixDHH Did Not Write a Line of Omarchy QuattroInvité : DHH · Anime : Lex FridmanThirteen months after a skeptical conversation with Lex Fridman, the Rails creator describes how Opus 4.5, a swarm of coding agents, and a one-minute Linux installer ended his era of hand-chiseled Ruby.Agents de codeVibe CodingIngénierie d’agents+3
3:12:58EN
Lex Fridman· 12 août 2026Podcast · 2 voixOne Cold Shower, Twenty Champions: How Khabib Nurmagomedov Was ForgedInvité : Khabib Nurmagomedov · Anime : Lex FridmanIn a Makhachkala school gym, seventy men shared one shower, and the water was only cold.Martial ArtsCombat SportsCoaching+3
3:46:18EN
Lex Fridman· 28 juil. 2026Podcast · 2 voixIf You Take Slavery Out of the Picture, There Is No Civil WarInvité : Gary Gallagher · Anime : Lex FridmanIn 1860, enslaved people were worth more than every railroad and factory in the United States combined.Political PhilosophyLeadershipHistory
3:51:47EN
Lex Fridman· 30 juin 2026Podcast · 2 voixForty-Six Percent of Emperors Were Overthrown. The Empire Lasted AnywayInvité : Anthony Kaldellis · Anime : Lex FridmanHistorian Anthony Kaldellis walks Lex Fridman through 2,200 years of Roman history and argues that what we call Byzantium was Rome itself.Political PhilosophyGeopoliticsLeadership
2:53:42EN
Lex Fridman· 29 mai 2026Podcast · 2 voixThe Moon Is Falling. It Just Keeps Missing.Invité : Biggest Mysteries in Physics · Anime : Lex FridmanFermilab physicist Don Lincoln tells Lex Fridman that the history of physics is a history of unification, and that antimatter, dark energy, and a theory of everything still sit far beyond the experiments we can run.Quantum MechanicsScience CommunicationPhilosophy of Science