ROKO

[coursera] Sequence Models: Week 3 본문

Artificial Intelligence/Deep Learning

[coursera] Sequence Models: Week 3

RO_KO 2024. 7. 9. 17:40
728x90

Sequence to sequence model

decoder에서 막연히 전체 문장을 greedy decoding으로 생성하면 안될까라는 생각이 들 수 있다. 하지만 greedy decoding을 사용하면 전체 문맥을 고려하지않고 앞부분에서 생성된 출력만을 기준으로 찾게되어 부정확한 출력이 나올 수 있다. 또한 greedy search는 엄청나게 많은  search space를 소비한다.

Beam search & Length normalization

Beam search (B=2)

Beam search 과정에서 text length가 길어질수록 text token 수가 많아져 error값이 커지고 모델은 적은 loss를 얻기 위해 짧은 text 를 출력하는것을 선호하게 된다. 이를 방지하기 위해 loss function에 length normalization을 통해 문제를 완화한다. width B 개 만큼 후보를 유지하며 확률을 계산하고 <eos> 토큰을 만나 최종 후보 B개가 결정되는 그중 가장 높은 확률의 문장을 선택한다.

 

Bean width "B"

  • large B: better result, slower
  • small B: worse result, faster

beam search는 BFS, DFS와 같은 알고리즘보다 빠르지만 최적의 정답을 보장하진 않는다.

 

Error analysis in beam search

BLEU score

Attention model intuition

sequence-to-sequence, RNN 기반 모델들은 여전히 긴 sequence length를 잘 처리하지 못한다.

Computing attention \(\alpha^{<t,t'>}\)

\( \alpha^{<t,t'>}</t,t'> \) = amount of attention \(y^{<t>}\) should pay to \(a^{<t'>}\)

\(\alpha^{<t,t'>}=\frac{exp(e^{<t,t'>})}{\sum_{t'=1}^{T_x}exp(e^{<t,t'>})}\)

 

Speech recognition audio data

3,000 시간이면 충분히 학습하기에 충분한 양이고 더 많을수록 음성 인식 작업에 좋다.

 

CTC (Connectionist temporal classification) for speech recognition

Trigger word detection algorithm

RNN 모델에서  audio clip의 spectrogram feature가 trigger word에 해당하는 경우 1을 output으로 내보낸다. RNN 모델에서 대체로 잘 작동하지만 train set imbalance한 경우 single step만 1을 출력하는것이 아닌 어느 period동안 1을 출력하도록하여 모델이 쉽게 학습할 수 있다.

728x90
Comments