Spoken Language Processing

음성인식 기초개념

햇농nongnong 2023. 4. 19. 16:37

이 글은 <2023 서울대학교 사범대학 의료빅데이터연구센터 합동 콜로키엄> 에 참가하여 정리한 내용입니다.

 

 

 

Seq-to-Seq Models for Speech Recognition


1) RNN (Long Short-Term Memory)

Converting a fixed length vector to a sequence

  • forget, input, output gate 3개의 gate 사용
  • input cell의 dimension과 output dimension 같음
  • <sos> : start of sentence
  • 임의의 길이의 sequence input이 들어가도 output으로는 fixed length가 나옴.
  • 2014년 RNN기반 encoder-decoder 모델 나옴

Shared Encoder/Decoder model

  • 인코더 없이 디코더만도 가능

Issues with RNN encoder decoder

  • It has to remember the whole input
  • The performance of the RNN encoder-decoder drops as the input becomes longer.
  • Fixed size representatino can be the bottleneck.
  • attention의 Motivation이 됨.

 

ASR


1) Conventional ASR system vs Neural End-to-End ASR system

conventional ASR system --> E2E system

  • 예전에는 hand-crafted 기반 시스템
  • n개의 candidate 뽑은 후 그 중 best 를 다시 scoring 하는 방식
  • 여러 component 가 있고 아주 복잡했었음.
  • 이제는 엄청 단순 --> 최근에는 on-device E2E 까지
  • 오픈소스 이용도 가능하지만 full-scratch 로 엔진 구현하면 많은 공부가 됨.

acoustic한 sequence 를 text 로 바꾸는 과정

  • Feature extraction - Feature Seq to Tex Seq.
  • 처음에는 attention 기반 encoder-decoder
  • latency 해결 위해 RNN-T
  • conformer-T 로 바꿔서 on-device

Motivation of Attention

  • 인코더 디코더 내에서도 쿼리, 키, value 이용해서 self-attention 하면 성능 잘 나옴.
  • 쿼리 벡터 가지고 키 시퀀스 가지고 correlation 구함
  • Q, K 관계 구하고 합이 1이 되는 weight 구하고 value 와 곱해서 output
  • key, value 는 항상 값이 같고, Q, K, V 가 다 같으면 self-attention, q만 디코더면 attention
  • 인코더-디코더 approach는 speech의 경우에 language model 하나 더 붙여서 auto regressive 하게 transducer 구조 
    - lstm 대신에 self-attention
    - 트랜스포머에서 convolution 하면 conformer
  • 어텐션인코더디코더보다 트랜스포머가 레이턴시에서 더 좋음
  • 어텐션인코더디코더 - monotonic chunkwise attention
    • 어텐션을 두 단계로. 한단계에서는 어텐션이 하드하게 어텐딩하는 점을 찾고, 그 점 기준 chunk 가정하고
    • chunk 내에서는 soft attending 하는 두 단계로.
    • 전체 context 다 할 수는 없고, 특정 window 를 정해서 해당 부분만 attention
    • 그럼 먼 과거, 미래 정보 알 수 없어서, 그런 정보를 일종의 state 로 저장해서 그 state 와 self-attention

Large-scale Language Model

  • 언어모델을 이용한 zero/few-shot generative AI
  • GPT-3 공개 이후 기존 AI / NLP 패러다임 바뀜
  • 최소 설명과 예제로 추가학습 없이 text-in/text-out 형식의 어떤 task 도 모델링 가능.
  • 범용적 AI 활용 가능성 열림
  • generative AI 형성한 LM 이용할 경우, 특정 task에 대해서 in-context learning이 가능
    • fine-tuning 없이 prompt 로 가능.
    • 모델 자체가 여러 task 를 대용량 데이터로 학습했기 때문에, prompt 통해 간단하게만 설명해주면 바로 여러 task 가능.
    • prompt 로 삼행시가 뭔지 알려주고 예시 몇개 알려주면, 삼행시 짓는 task 가능
    • 학습도 기존의 BERT 는, pre-trained 에다가 task 별로 fine-tuning 했다면, 여기는 prompt로 in-context 가능.
    • 하지만 여기에 성능 더 잘 나오게 하기 위해 prompt tuning. 
    • text를 벡터 representation 으로 바꾸는 linear embedding 통해서 이 부분을 fine-tuning 해주거나 instruct GPT 는 모델 전체를 fine-tuning.
    • 아주 좋은 퍼포먼스를 위해서는 fine-tuning 필요하지만, 적당한 것들은 다 프롬프트 통해 가능.
  • ChatGPT history

  • 디코더 구조 기반 인코딩, 디코딩 다 함.
  • 코드 적용한 code 다빈치 나옴. (모델 가장 큰게 다빈치. 더 작으면 에이다.. 등등) - 텍스트 다빈치 - 코드 다빈치 업데이트
    • fine-tuning. 강화학습 통해서 성능 고도화 - chatGPT
    • 처음에는 pretraining 만 시켰음 (텍스트 기반 토큰으로 다음 토큰 prediction

 

  • instruct GPT

 

  • 데이터가 중요 -domain specific

 

 

 Reference

  • 2023.04.19 <2023 서울대학교 사범대학 의료빅데이터연구센터 합동 콜로키엄>
    Sequence-to-Sequence Models for Machine Translation, Speech Recognition, and Large-Scale Generative Language Model - 삼성리서치 김찬우 부사장님