티스토리 뷰
Paper/TTS
[Paper 리뷰] EfficientTTS: An Efficient and High-Quality Text-to-Speech Architecture
feVeRin 2024. 2. 10. 13:21반응형
EfficientTTS: An Efficient and High-Quality Text-to-Speech Architecture
- Text-to-Speech를 위해 non-autoregressive architecture는 많은 이점을 가지고 있음
- EfficientTTS
- External aligner를 필요로 하는 autoregressive 모델과 달리, 안정적인 end-to-end 학습을 지원하여 효율적이면서 고품질의 음성 합성이 가능
- 연산량을 증가시키지 않고, sequence alignment에 monotonic constraint를 반영할 수 있는 monotonic alignment modeling을 제시
- EfficientTTS를 다양한 feed-forward network 구조와 결합하여 Text-to-Mel-spectrogram, Text-to-Waveform 모두를 지원
- 논문 (ICML 2021) : Paper Link
1. Introduction
- Text-to-Speech (TTS)는 encoder-decoder framework를 기반으로 하는 autoregressive 모델을 주로 활용함
- Autoregressive framework에서
- Encoder는 text sequence를 input으로 사용하여 hidden representation을 학습
- Decoder는 frame-by-frame과 같이 autoregressive 방식으로 output을 생성 - Autoregressive 모델은 합성 품질은 우수하지만 합성 속도가 느리다는 단점이 존재
- 이때 non-autoregressive TTS는 autoregressive 방식의 한계를 개선할 수 있음
-> BUT, 복잡한 학습 과정으로 실적용이 어렵다는 단점이 존재
- Autoregressive framework에서
-> 그래서 효율적이면서 고품질의 TTS 작업이 가능한 non-autoregressive 모델인 EfficientTTS를 제안
- EfficientTTS
- Fully parallel하고, end-to-end로 학습되는 non-autoregressive TTS 모델
- 결과적으로 학습/추론 속도 모두를 향상 가능 - Soft/hard monotonic alignment를 통해 sequence alignment를 monotonic 하게 제한하고, 연산량의 증가 없이 vanilla attention mechanism을 확장
- Network 구조에 관계없이 모든 attention mechanism에 통합 가능
- Fully parallel하고, end-to-end로 학습되는 non-autoregressive TTS 모델
< Overall of EfficientTTS >
- Additional aligner 없이 text sequence로부터 고품질의 음성 합성을 수행하는 non-autoregressive arhictecture
- Sequence-to-Sequence 모델에 대한 새로운 soft/hard monotonic alignment를 제시
- Convolutional, Flow-based, End-to-End 방식으로 EfficientTTS를 확장하여, 품질 및 학습/추론 효율성 모두가 향상됨을 보임
2. Related Work
- Non-Autoregressive TTS Models
- TTS에서 input text sequence
은 encoder-decoder framework를 통해 output sequencex=[x0,x1,...,xT1−1] 로 변환됨y=[y0,y1,...,yT2−1] 는 encoderx 를 통해 hidden state sequencef:h=f(x) 로 변환된 다음, decoder를 통과하여 outputh=[h0,h1,...,hT1−1] 를 생성함y - 이때 각 output timestep에 대해 attention mechanism을 적용하여
의 모든 element를 search하고 context vectorh 를 생성할 수 있음:c
(Eq. 1)cj=∑Ti−1i=0αi,j∗hi
- : alignment matrixα∈R(T1,T2) - 이후
는 다른 networkc 에 공급되어 outputg 를 생성y:y=g(c)
- 여기서 network는 동일한 length의 input, output을 사용하기 때문에 parallel 구조로 쉽게 대체할 수 있음f,g
- 이때 각 output timestep에 대해 attention mechanism을 적용하여
- 따라서 non-autoregressive TTS 모델 구축을 위해서는 parallel alignment prediction이 가장 중요함
-> 이를 위해 EfficientTTS는 single network를 통해 안정적인 학습을 유지하면서 sequence alignment 및 음성 생성을 jointly learning
- Monotonic Alignment Modeling
- 일반적인 attention mechanism은 모든 output timestep에 대해 모든 input step을 inspect 함
- 이때 long sequence의 경우 학습하는데 비용이 많이 소모되고, misalignment가 자주 발생함
- 특히 alignment는 다음과 같은 strict criteria를 따라야 함
- Monotonicity : 각 output timestep에서 aligned position은 절대 rewind 되지 않음
- Continuity : 각 output timestep에서 aligned position은 one step forward로만 이동할 수 있음
- Completness : Aligned position은 input token의 모든 position을 cover 해야 함
- Monotonicity : 각 output timestep에서 aligned position은 절대 rewind 되지 않음
- Alignment를 위한 방법들이 제안되었지만, 대부분 sequential step을 필요로 하고 위의 조건을 충족시키지 못함
-> 따라서 EfficientTTS에서는 monotonic alignment를 위한 새로운 approach를 제시

3. Monotonic Alignment Modeling Using IMV
- Monotonic alignment modeling을 위해 Index Mapping Vector (IMV)를 제안
- Definition of IMV
를 input sequenceα∈R(T1,T2) 과 output sequencex∈RT1 사이의 alignment라 하자y∈RT2 - Index Mapping Vector (IMV)
는π 로 weighting 된 index vectorα 의 sum으로:p=[0,1,...,T1−1]
(Eq. 2)πj=∑Ti−1i=0αi,j∗pi
- ,0≤j≤T2−1 ,π∈RT2 ∑Ti−1i=0αi,j=1 - IMV는 각 output timestep의 expected location으로 볼 수 있음
- 이때 expectation은 에서0 까지의 가능한 모든 input locationT1−1
- Index Mapping Vector (IMV)
- Monotonic Alignment Modeling Using IMV
- Continuity and Monotonicity
- 주어진 alignment matrix
가 continuity와 monotonicity ciriteria를 충족한다고 하면:α
(Eq. 3)0≤Δπi≤1 ,Δπi=πi−πi−1 1≤i≤T2−1
- 주어진 alignment matrix
- Completeness
가 timestep 전반에 대해 continuous하고 montonic하다면, completeness criteria는 아래 boundary constraint와 동치:π
(Eq. 4)π0=0
(Eq. 5)πT2−1=T1−1 로부터 deduce 될 수 있음α0=[1,0,...,0],αT2−1=[0,0,...,1]
- Incorporate IMV into Network
- IMV를 sequence-to-sequence network에 incorporate 하기 위해 아래 2가지 방식을 제시
- Soft Montonic Alignment (SMA)
- Sequence-to-Sequence 모델을 (Eq. 3~5)의 constraint하에서 학습하기 위해, 해당 constraint를 training objective로 고려
- 따라서 constraint를 다음과 같은 SMA loss로 표현하면:
(Eq. 6)LSMA=λ0|||Δπ|−Δπ||1+λ1|||Δπ−1|+(Δπ−1)||1+λ2(π0T1−1)2+λ3(πT2−1T1−1−1)2
- :||⋅||1 normℓ1
- : positive coefficientλ0,λ1,λ2,λ3
- 는 non-negative이고,LSMA 가 모든 constraint를 충족하는 경우에만 0π - 이때 index vector
는 always known이므로,p 계산에는 alignment matrixLSMA 만 필요α
- 결과적으로 network의 구조 변경 없이도 SMA loss를 sequence-to-sequence network에 incorporate 할 수 있음 - 일반적으로 SMA는 Guided Attention과 유사한 역할을 수행함
- BUT, SMA는 alignment에 대해 더 엄밀한 constraint를 제공하므로 Guided Attention보다 뛰어난 성능을 보임
- Hard Monotonic Alignment (HMA)
- SMA를 사용하면 network가 monotonic alignment를 학습할 수 있지만, 학습 초기에서 monotonic alignment를 생성할 수 없기 때문에 많은 비용이 필요함
- 따라서 Hard Montonic Alignment (HMA)를 통해 supervision 없이 monotonic alignment를 생성 - 먼저 (Eq. 2)에 따라 alignment matrix
로부터 IMVα 를 계산하자π′
- 이렇게 얻어진 는 monontonic 하지 않지만, ReLU activation을 통해π′ 을 적용하면 strictly monotonic IMVΔπ≥0 로 변환됨:π
(Eq. 7)Δπ′j=π′j−π′j−1,0<j≤T2−1
(Eq. 8)Δπj=ReLU(Δπ′j),0<j≤T2−1
(Eq. 9)πj=∑jm=0Δπm,0≤j≤T2−1,Δπ0=0 의 domain을 (Eq. 4~5)에서 주어진 intervalπ 로 restrict 하고,[0,T1−1] 에 positive scalar를 multiply 하면:π
(Eq. 10)π∗j=πj∗T1−1max(π)=πj∗T1−1πT2−1
- 의 최대값은 timestep에 걸쳐 monotonic 하게 증가하므로π πT2−1 - 이후 monotonic alignment를 구성하기 위해,
로 centered 된 Gaussian kernel을 적용하여 alignment를 reconstruction 하는 transformation을 얻음:π∗
(Eq. 11)α′i,j=exp(−σ−2(pi−π∗j)2)∑T1−1m=0exp(−σ−2(pm−π∗j)2)
- : alignment variation을 나타내는 hyperparameterσ2
- : 기존 alignmentα′ 를 대체α
- 이때 과α′ 의 차이점은,α 은 monotonicity가 보장되지만α′ 는 monotonicity에 대한 constraint가 없다는 것α - HMA는 monotonic alignment 학습의 어려움을 줄여 학습 효율성을 향상할 수 있음
- SMA와 마찬가지로 HMA도 sequence-to-sequence network에 incorporate 가능함
-> 결과적으로 EfficientTTS는, 이러한 HMA 기반의 internal aligner를 통해 strict monotonic constraint 하에서 빠르고 효율적인 network 학습이 가능
- SMA를 사용하면 network가 monotonic alignment를 학습할 수 있지만, 학습 초기에서 monotonic alignment를 생성할 수 없기 때문에 많은 비용이 필요함
- Soft Montonic Alignment (SMA)
4. EfficientTTS Architecture
- EfficientTTS의 동작과정을 요약하면
- 학습 단계에서는
- IMV generator를 통해 text sequence와 mel-spectrogram의 hidden representation으로부터 IMV를 계산
- 이때 Text sequence와 mel-spectrogram의 hidden representation은 각각 text-encoder와 mel-encoder로 얻어짐 - 이후 IMV는 alignment reconstruction layer를 통해 time-aligned representation을 생성하기 위한 2-dimensional alignment matrix로 변환됨
- 마지막으로 time-aligned representation은 output mel-spectorgram/waveform을 생성하는 decoder로 전달됨
- 이 과정에서 각 input text token에 대한 aligned position을 예측하는 aligned position predictor를 cocurrently train 함
- IMV generator를 통해 text sequence와 mel-spectrogram의 hidden representation으로부터 IMV를 계산
- 추론 단계에서는, 예측된 aligned position으로부터 alignment를 reconstruct
- 학습 단계에서는

- Text-Encoder and Mel-Encoder
- Text-encoder와 Mel-encoder를 사용하여 text symbol과 mel-spectrogram을 각각 hidden representation으로 변환
- Text-encoder는 FastSpeech의 구조를 채택
- Text embedding layer와 transformer FFT block stack으로 구성
- 특히 transformer FFT block을 사용하면 text encoder가 local/global information을 모두 학습할 수 있어 alignment prediction에 유용함 - Mel-encoder는
- Linear projection을 통해 mel-spectrogram을 high-dimensional vector로 변환
- 이후 weight normalization, Leaky ReLU, reisdual connection을 포함한 convolution stack을 적용
- Mel-encoder는 학습 단계에서만 사용됨
- Text-encoder는 FastSpeech의 구조를 채택
- IMV Generator
- Monotonic IMV를 생성하기 위해, 아래 (Eq. 12)와 같이 scaled dot-product attention으로 input과 output 간의 alignment
를 학습α - 즉,
로부터 IMV의 계산은:α
(Eq. 12)αi,j=exp(−D−0.5(qj⋅ki))∑T1−1m=0exp(−D−0.5(qj⋅km))
- : mel-encoder output,q : text-encoder outputk
- :D 의 dimensionalityq,k - 이때 각 timestep
에서j 를 forward/backward direction으로 아래와 같이 accumulate 할 수 있음:Δπ
(Eq. 13)πfj=∑jm=0Δπm,πbj=∑T2−1m=jΔπm
(Eq. 14)πj=πfj−πbj
- (Eq. 14)에 따라 는 timestep 전반에 걸쳐 monotonic 하게 증가하므로π 의 최소값은π 이고 최대값은π0 πT2−1 - 따라서 linear transformation을 통해
를 intervalπ 로 restrict 하면:[0,T1−1]
(Eq. 15)π∗j=πj−π0πT2−1−π0∗(T1−1)
- 즉,
- Aligned Position Predictor
- 추론 단계에서 모델이 text sequence의 hidden representation
로부터 IMVh 를 직접 예측하는 것은 어려움π - 아래 2가지의 한계 때문:
는 time-aligned이고, high-resolution인 반면,π 는 low-resolution임h 의 각 예측은 (Eq. 9)의 cumulative sum operation으로 인해 이후πi 예측에 영향을 미치므로,πj(j>i) 를 parallel 하게 예측하기 어려움π
- 이때 각 input token의 aligned position
를 대신 예측하는 것으로 위의 한계점을 극복할 수 있음e - 이를 위해
을q=[0,1,...,T2−1] 의 index vector라고 하자π - 그러면 transformation
을m(⋅) 사이의 mappingπ,q 으로 정의할 수 있음π=m(q) - 이때
는π 에 대해 monotonic 하게 증가하므로,q 은 monotonic transformation이고, invertible 함:m(⋅)
(Eq. 16)q=m−1(π) - 따라서 각 input token의 output timestep에서 aligned position
는:e
(Eq. 17)e=m−1(p),p=[0,1,...,T1−1] - 이후
를 계산하기 위해 (Eq. 11)과 유사한 transformation을 사용하여 probability density matrixe 를 계산:γ
(Eq. 18)γi,j=exp(−σ−2(pi−πj)2)∑T2−1n=0exp(−σ−2(pi−πn)2) - 결과적으로 aligned position
는e 로 weighted 된 output index vectorγ 의 weighted sum:q
(Eq. 19)ei=∑T2−1n=0γi,n∗qn
- 이를 위해
- 위와 같이
의 계산은 differentiable 하기 때문에 gradient를 통해 학습할 수 있음e
- 이때 는 predictable 함e
1. 와e 의 resolution이 동일하기 때문h
2. 를 직접 학습하지 않고 relative positione 을 학습할 수 있기 때문Δe(Δei=ei−ei−1,1≤i≤T1−1)
- 아래 2가지의 한계 때문:
- Aligned position predictor는
- 2개의 convolution으로 구성되고 각 convolution은 layer noramlization과 ReLU activation을 포함
- 이때
로부터 계산된π 를 training target으로 하고, 추정된 positionΔe 와 targetΔˆe 사이의 loss function은:Δe
(Eq. 19)Lap=||log(Δˆe+ϵ)−log(Δe+ϵ)||1
- : numerical instability를 해결하기 위한 small numberϵ - Aligned position predictor는 모델의 나머지 부분들과 함께 jointly learning 됨
- 결과적으로 EfficientTTS는 aligend position을 통해 alignment를 생성하기 때문에 duration-based non-autoregressive TTS 모델과 같은 speech rate 제어가 가능

- Aligned Reconstruction
- Hidden representation
를 time-aligned representation에 mapping 하기 위해서는 학습과 추론 모두에서 alignment matrix가 필요함h - 이때 IMV
나 aligned positionπ 로부터 alignment를 구성할 수 있음e
- (Eq. 11)은 로부터 alignment matrix를 효과적으로 reconstruction 할 수 있지만, 추론 중에는π 대신 aligned positionπ 를 사용해야 하기 때문e
- 따라서 학습과 추론의 consistency를 위해 aligned position 에서 aligned matrix를 reconstruct 해야 함e - 이를 위해 학습 과정에서는 (Eq. 18)에서 계산된 aligned position
를 사용하고, 추론 시에는 aligned position predictor에서 예측된 position을 사용e - 따라서 aligned position
로 centered 된 Gaussian kernel을 도입하여 alignment matrixe 을 reconstruct 하면:α′
(Eq. 20)α′i,j=exp(−σ−2(ei−qj)2)∑T1−1m=0exp(−σ−2(em−qj)2)
- : output sequence의 index vectorq - 이때 output sequence length
는 학습 시에서는 알려져 있고, 추론 시에는T2 로부터 계산됨:e
(Eq. 21)T2=eT1−1+η∗ΔeT1−1
- : hyperparameter (논문에서는 1.2로 설정)η
- 따라서 aligned position
- 이렇게 reconsturct 된 alignment는
의 low-resolution으로 인해 (Eq. 11)로 계산된 것만큼 accurate하지는 않음e
- BUT, network를 통해 compensate 될 수 있을 만큼 output에 미치는 영향은 적음
- 결과적으로 학습/추론 과정에서 consistency가 향상되어 음성 품질을 향상할 수 있음 - 최종적으로 EfficientTTS는
- (Eq. 1)에 따라 을 사용하여 text-encoder outputα′ 를 time-aligned representation으로 mapping 한 다음,h
- Time-aligned representation이 decoder의 input으로 전달됨
- 이때 IMV
- Decoder
- Decoder의 input/output은 모두 time-aligned 되어 있으므로 parallel structure decoder를 구성할 수 있음
- EFTS-CNN
- Convolution stack을 통해 decoder를 parameterize 함
- Mean Squared Error (MSE)를 reconstruction loss로 사용 - EFTS-Flow
- TTS 모델이 생성된 음성의 variation을 제어할 수 있도록 flow-based decoder를 활용
- 학습 단계에서는, likelihood를 최대화하여 mel-spectrogram에서 Gaussian 분포 로의 transformationN(0,I) 를 학습f
- 추론 단계에서는, Gaussian 분포 에서 latent variabelN(0,I) 를 sampling 하고 temperature factorz 를 통해 zero vectort 를o 로 interpret 하여 새로운 latent vectorz 을 얻음z′
- 결과적으로 을 input으로 사용하고 transformationz′ 를 inverse 하여 mel-spectrogram을 생성f
- 구조적으로는 Flow-TTS의 decoder를 활용 - EFTS-Wav
- TTS 모델을 end-to-end 방식으로 학습하기 위해 EfficientTTS와 dilated convolutional adversarial decoder를 결합
- 구조적으로는 MelGAN을 활용
- EFTS-CNN

3. Experiments
- Settings
- Dataset : DataBaker, LJSpeech
- Comparisons : Glow-TTS, Tacotron2
- Results
- Speech Quality
- MOS 측면에서 DataBaker dataset에 대한 합성 품질을 평가
- 결과적으로 EfficientTTS의 합성 품질이 가장 우수한 것으로 나타남
- Tacotron2의 낮은 품질은 teacher forcing training과 autoregressive 추론 간의 inconsistency 때문
- Glow-TTS은 hidden representation의 continuity를 corrupt 하는 text sequence의 hidden representation을 replicate 하기 때문 - EfficientTTS는 token duration보다 expressive 한 IMV를 사용하여 alignment를 reconstruct 하기 때문에 더 나은 품질을 얻을 수 있음
- MOS 측면에서 DataBaker dataset에 대한 합성 품질을 평가

- 마찬가지로 LJSpeech dataset에 대해서도 EfficientTTS가 가장 우수한 합성 품질을 보임

- Training and Inference Speed
- 추론, 학습 속도 측면에서도 EfficientTTS는 가장 효율적인 것으로 나타남
- 특히 EFTS-CNN의 경우 추론 latency가 8ms로 Tacotron2 보다 97.5배 빠름

- Monotonic Alignment의 효과를 알아보기 위해 EFTS-CNN에 대한 실험을 수행
- Variations
- EFTS-HMA : hard monotonic IMV generator를 사용하는 기본 EFTS-CNN
- EFTS-SMA : soft monotonic IMV generator를 사용하는 EFTS-CNN
- EFTS-NM : monotonicity constraint를 사용하지 않는 EFTS-CNN - 각 variation들에 대한 학습 결과를 비교해 보면,
- EFTS-HMA는 EFTS-SMA에 비해 상당한 학습 가속 효과가 있음
- EFTS-NM은 monotonicity를 학습하지 못해 전혀 수렴되지 않음
- Variations

- EFTS-CNN variation들의 IMV와 mel-spectrogram을 비교해보면,
- Monotonicity를 고려하지 않는 EFTS-NM에 비해 EFTS-HMA, EFTS-SMA는 alignment를 학습할 수 있음
- 특히 hard monotonicity를 고려하는 EFTS-HMA의 성능이 가장 우수함
- 결과적으로 monotonic alignment를 합성 품질 향상에 중요

- EfficientTTS의 attention error 발생을 분석해 보면
- Word reapeating, Word skipping, Mispronunciation은 TTS 모델의 대표적인 attention error
- EfficientTTS는 Tacotron2에 비해 더 적은 attention error가 발생함
- 특히 SMA, HMA를 Tacotron2에 적용하면, 기존 Tacotron2 보다 더 적은 attention error가 발생하는 것으로 나타남
- Monotonic alignment가 TTS 모델의 robustness를 향상하기 때문

반응형