34 min total

Deep Learning

Sequence generation & attention

Sequence generation & attention

Image captioning

Sequence generation & attention — diagram

Used in machine translation example by Andrew NG

This approach just picks the next word that is most likely at each step. However, by making local “best” choices, it might miss globally optimal sequences. For instance, the phrase “Jane is going” might seem likely initially, but it can lead to less fluent translations.

Instead of relying on pure greedy tactics, beam search keeps track of several possible sequences (beams) and tries to find the best among them. It’s a compromise between pure greedy search and exhaustive search, making it both efficient and more accurate than just greedy search.

Sets a hyperparameter B (beam width)

Beam search picks top 'B' words based on their probablilities

It calculates probability of each new sequence by multiplying probaility of previous sequence with probability of new word, then selects top B most likely sequences to continue to the next step

Uses NN to evaluate probabilities at each step

  1. Log probability stabilization
Sequence generation & attention — diagram

The probabilities are very small (less than 1) tou multiplying these small numbers can results in tiny product, leading to numerical underflow

To avoid underflow, we take log of probabilities

  1. Length normalization

Maximizing log probabilities tends to favour shorter sequences, as they involve fewer multiplications of numbers less than one

We normalize the log probability by length of sequence, objective becomes average log probability per word, reducing penalty for longer sequences

  1. Soft normalization
Sequence generation & attention — diagram

Adjust sum of log probabilities by dividing by term

a is a hyperparameter

Typical values are 0.7

Sequence generation & attention — diagram

BLEU score

(Bilingual evaluation understudy) is used to evaluate quality of machine translation

Since Machine translations can have multiple valid translations, bleu score helps address this by comparing machine generated translations to translations provided by humans

Sequence generation & attention — diagram

Bigram precision

Sequence generation & attention — diagram

Combined BLEU score

= bleu score on n-grams only

Sequence generation & attention — diagram
Sequence generation & attention — diagram

Attention for sequence generation

Sequence generation & attention — diagram
Sequence generation & attention — diagram
Sequence generation & attention — diagram

Speech recognition

Sequence generation & attention — diagram

process of converting audio clips into text transcripts. It begins with microphones capturing changes in air pressure, which are then represented as audio clips over time. These clips undergo a pre-processing step where they're converted into spectrograms, displaying frequency versus time. Traditionally, speech recognition relied on phonemes, which are basic hand-engineered units of sound. However, modern approaches use end-to-end deep learning, directly converting audio to text without an intermediate phoneme representation. The effectiveness of these systems heavily depends on large datasets, with the best models training on over 10,000 hours of transcribed audio. Two prominent models in this field are the Attention Model, which focuses on different parts of the audio for accurate transcription, and the Connectionist Temporal Classification (CTC) model, which allows for alignment of audio with shorter text by using blank characters. The continued advancement in speech recognition is primarily driven by the availability of large datasets and the development of sophisticated deep learning algorithms.

Trigger word detection

Sequence generation & attention — diagram