티스토리 뷰
Paper/TTS
[Paper 리뷰] Nix-TTS: Lightweight and End-to-End Text-to-Speech via Module-wise Distillation
feVeRin 2023. 7. 15. 16:30반응형
Nix-TTS: Lightweight and End-to-End Text-to-Speech via Module-wise Distillation
- Text-to-Speech (TTS) 모델은 최적화하기 어렵거나 많은 학습 비용이 발생함
- Nix-TTS
- Knowledge distillation을 활용한 non-autoregressive end-to-end 경량 TTS 모델 (Vocoder-free!)
- Encoder, Decoder 모듈에 대해 유연하고 독립적인 distillation을 가능하게 하는 Module-wise distillation 활용
- 논문 (SLT 2022) : Paper Link
1. Introduction
- 최근의 TTS 모델은 크기가 상당히 크고 CPU 추론 속도가 느림
- 저비용, 자원 제약 환경에서 음성 기반 interface를 배포하기 어렵게 만드는 주요한 원인
- 저비용 CPU bound device에 배포하기 위해서는 TTS 모델이 가볍고 빠르면서도 자연스러운 음성 합성이 가능해야함
- 경량 TTS 모델에 대한 연구가 꾸준히 제안되었지만 대부분 text-to-Mel에 초점을 맞추고 있음
- 음성 합성을 위해 추가적인 vocoder가 필요하기 때문에 vocoder에 따라 모델 크기가 가변적으로 변함
- 경량 TTS 모델을 위해서는 vocoder를 사용하지 않는 end-to-end 설계가 필요
- Neural compression을 활용하여 모델의 크기를 줄이는 방법도 있음
- Neural Architecture Search를 적용하는 방법 : 적합한 search space 정의하는 것이 어려울 수 있음
- Architecture pruning을 적용하는 방법 : 생성된 음성의 자연스러움이 떨어짐
-> 그래서 성능은 유지하면서 학습 비용이 낮은 경량 TTS 모델인 Nix-TTS를 제안
- Nix-TTS
- Knowledge distillation (KD)을 non-autoregressive end-to-end TTS teacher 모델에 적용
- Teacher network의 duration만을 distill 하는 것으로 KD를 수행
- Encoder, Decoder에 대한 module-wise distillation
< Overall of Nix-TTS >
- 추가적인 vocoder가 필요 없는 non-autoregressive end-to-end 특성을 상속한 TTS 모델
- 상당히 작은 크기와 추론 속도 향상을 달성
- 음성 합성의 자연스러움을 유지하고 teacher 모델과 비슷한 명료도를 달성
2. Method
- Problem Formulation
: end-to-end neural TTS 모델F(⋅;w)
- End-to-End : 외부 vocoder 없이 직접 text 에서 raw waveformc 의 음성 데이터xw 를 생성하는 것을 의미x - End-to-End TTS 모델의 architecture
: Encoder,E : DecoderD
- 는E 를 latent representation으로 encodingc
- 는D 를z 로 decodingxw - 모델에 따라
는 결정적이거나z 같은 분포를 따라 생성적일 수 있음z∼N(μ,σ)

- KD setting
- (목표) Loss function
,LE 가 주어졌을 때LD 를 학습시켜Fs ,Es 를 만족시키는 것Ds
- 는Fs 에 가깝게 대응시키는Ft 및ˆz 를ˆxw 를 통해 생성Es : teacher model,Ft : student modelFs ,{z,xw} : 각각 teacher, student model에 의해 생성된 output{ˆz,ˆxw}
- (목표) Loss function

- End-to-End TTS Teacher
- End-to-End non-autoregressive TTS 모델인 VITS를 teacher 모델
로 선택Ft
- VITS는 conditional Variational AutoEncoder (cVAE)로 공식화 가능
- VITS에서 제안된 cVAE를 따라
를qθ(z|x),pϕ(x|z) 로 parameterizedθ,ϕ
- : 사후 분포,qθ(z|x) : 데이터 분포pϕ(x|z)
- : 음성 데이터 변수,x : latent 변수z 의 사전 분포는z 로 정의pψ(z|c)
- latent는 input text 에 의해 condition 되고c 로 parameterizedpsi - (VITS의 목표)
가 주어졌을 때c 의 분포 하에서 evidence lower bound (ELBO)를 최대화하는 방향으로 학습x

- Reconstruction term은 Mel-spectrogram
을 이용xm
- Ground truth와 예측된 음성 사이의 L1 Loss로 구성
-ˆxm∼pϕ(x|z)

- Architecture 측면에서 VITS는
분포에 대응하는 3개의 모듈로 나눌 수 있음qθ(z|x),pϕ(x|z),pψ(z|c)
- Posterior Encoder
- Non-casual WaveNet residual block으로 구성
- Linear spectrogram 의xs 를x 의 parameter인qθ(z|x)=N(μq,σq) 로 encoding{μq,σq}
- Latent sample 를 추론한 다음 deccoder로 전달되어 raw waveformzq∼N(μq,σq) 에서xw 로 reconstructionx - Prior Encoder
- Transformer encoder 블록과 affine coupling layer가 있는 normalizing flow 로 구성f
- 를c 의 parameter인pψ(z|c)=N(μp,σp) 와 prior latent sample{μp,σp} 로 encodingzp=f(zq)
- 와{μp,σp} 은 Monotonic Alignment Search (MAS)로 정렬zp
- 추론과정에서 network는 aligned prior parameter 와{μ′p,σ′p} 을 사용해xs 으로부터f−1(μ′p,σ′p) 를 추론zq - Decoder
- HiFi-GAN v1의 generator architecture를 따름
- Multi-period discriminator를 사용하여 적대적인 방식으로 를zq 로 reconstructionxw
- Posterior Encoder
- Available Knowledge to be Distilled
- Teacher VITS가 이미 학습되어 있다고 가정하면, Encoder-Decoder 구조를 활용할 수 있음
- Prior Encoder는 latent 분포 를 모델링하는qθ(z|x) 의 역할Et
- Decoder는 latent sample 에서zq∼qθ(z|x) 를 decoding 하는xw 의 역할Dt - Prior Encoder와 Posterior Encoder는 모두 동일한 latent space를 encoding 하므로 모두
로 볼 수 있음Et
- 에 대한 stochastic sample만을 제공하는qθ(z|x) 로 인해 복잡한 Prior Encoder에서도 studentf 가 distill 될 수 있음Es
- Prior encoder은 복잡하기 때문에 쉬운 Posterior Encoder에서 를 distillqθ(z|x)
- Teacher VITS가 이미 학습되어 있다고 가정하면, Encoder-Decoder 구조를 활용할 수 있음
- End-to-End TTS Student
- Nix-TTS는 end-to-end TTS student 모델
의 역할을 함Fs
- End-to-End TTS teacher 모델 인 VITS로부터 distill 되어 얻어짐Ft - Encoder Architecture
- (Nix-TTS encoder의 목표) parameter
를 예측하여{μq,σq} 를 모델링qθ(z|x)=N(μq,σq)
- 대신c 를 condition으로 가짐xs
- 와 의미 있게 align 되도록xs 를 encodingc - Text Encoder, Text Aligner, Duration Predictor, Latent Encoder의 4가지 모듈로
구성Es
- (Nix-TTS encoder의 목표) parameter

- Text Encoder
를 text hidden representationc 으로 encodingchidden - Embedding layer, absolute positional encoding, stacked dilated residual 1D convolution block로
를 통과c - 각 convolution block에는 SiLU activation, layer normalization 사용
- Text Aligner
와c 의 alignment를 학습하기 위해 사용됨xs - Convolution layer를 사용해
를chidden,xs 로 encodingcenc,xenc - Soft alignment (
)Asoft
- 둘 사이의 normalized pairwise affinity를 취해 얻어짐 - Hard alignment (
)Ahard
- non-autoregressive TTS가 아닌 경우 token 당 hard duration을 정의해야 함
- MAS를 에 적용Asoft 과chidden 사이에 batch matrix-matrix product를 적용해 aligned text representationAhard 얻음caligned
- Soft alignment (

- Duration Predictor
- 추론 과정에서
없이xs 를 예측하는 역할Ahard 에서 추출한 per-token durationAhard 를 예측하기 위해 1D convolution을 stack 해서 구성dhard 이 주어졌을 때chidden 를 예측하는 회귀 모델dhard
- 추론 과정에서

- Latent Encoder
- Embedding layer가 없는 text encoder와 동일한 구조
는 latent encoder의 output을 single perceptron layer로 projection 하여 생성{μq,σq}
- Decoder Architecture
- (Nix-TTS Decoder의 목표) decoer
는 분포Ds 를 모델링pϕ(x|z)
- Latent variable 를 입력으로 사용해 연관된 raw waveformzq∼N(μq,σq) 를 decodingxw 는Ds 와 거의 동일한 architecture를 따르지만 더 적은 parameter 수를 가짐Dt
- Transposed convolution과 multi-receptive fusion module로 구성된 HiFi-GAN의 generator 구조를 따름
- 학습과정에서 에는 teacher 모델의 multi-period discriminatorDs 가 사용됨Cs 의 parameter 크기를 줄이기 위해, 기존의 vanilla convolution을 depthwise-separable convolution으로 대체하고 feature map dimension을 절반으로 줄임Ds
- (Nix-TTS Decoder의 목표) decoer
- Module-wise Distillation
- Encoder Distillation
- Encoder
는Es 와c 사이의 alignment를 학습하고 해당하는 parameter를 예측하여xs 를 모델링하는 것이 주요한 목표qθ(z|x) - Alignment objective
- Forward-sum algorithm를 사용하고 KL-divergence를 최소화해 와Asoft 사이의 일치를 유도하여Ahard 에서 표현되는Asoft 가 주어졌을 때xs 의 likelihood를 최대화하는 것chidden
-LForwardSum,Lbin 를 모델링하기 위해qθ(z|x) 와N(ˆμq,ˆσq) 사이의 KL-divergence를 최소화qθ(z|x)
- 두 분포 모두 Gaussian을 따르므로 closed-form KL-divergence를 최소화- 최종 Encoder Objective :
LE=LForwardSum+Lbin+Lkl
- Encoder

- Decoder Distillation
- Decoder
는Ds 와 비슷하게 들리는xw 를 생성하는 것이 목표ˆxw
- Least-square adversarial training ( ), Feature matching loss (Ladv,disc,Ladv,gen ), Mel-spectorgram reconstruction loss (Lfmatch )를 사용할 수 있음Lrecon
- : discriminator의Cls 번째 layer의 feature mapl
- :nl 번째 layer의 feature map 수l
- :L 의 layer 수Cs - 수렴 속도를 빠르게 하고 음성 품질을 향상하기 위해 Generalized Energy Distance (GED) Loss
를 decoder objective에 augmentLged
- : multi-scale spectrogram distancedspec(.)
- ,ˆxaw :ˆxbw 에서 가져온 노이즈 sample에 대해N(0,1) 에서 생성된 오디오Ds - 최종 Decoder Objective :
LD=Ladv,disc+Ladv,gen+Lfmatch+Lrecon+Lged
- Decoder

3. Experiments
- Settings
- Dataset : LJSpeech
- Teacher Configuration : VITS
- Comparisons : BVAE-TTS, SpeedySpeech with HiFi-GAN
- Speech Synthesis Quality
- Nix-TTS는 teacher VITS의 음성 품질을 훌륭하게 유지함
- CMOS로 평가했을 때 Nix-TTS가 VITS 보다 조금 낮게 측정되었지만 parameter 측면에서 82%의 압축률을 보임

- Nix-TTS의 명료도를 평가하기 위해 생성된 오디오 sample에 대한 예측 text를 추론하여 Phoneme Error Rate (PER)을 비교
- Nix-TTS는 teacher VITS와 비교해서 0.5%의 차이를 보이면서 더 적은 모델 크기를 가짐

- Model Speedup and Complexity
- Intel-i7 CPU와 Raspberry Pi Model 3B에서 Real Time Factor(RTF)와 매개변수 수 측면에서 모델 속도, 복잡도 비교
- Intel-i7 CPU에서 Nix-TTS는 teacher VITS 보다 3.04배 빠른 속도를 보임
- 모델 크기는 89.34% 감소 - Raspberry Pi Model 3B에서 Nix-TTS는 8.36배 빠른 속도를 보임
- 모델 크기는 81.32% 감소
- Intel-i7 CPU에서 Nix-TTS는 teacher VITS 보다 3.04배 빠른 속도를 보임
- Self-attention을 사용하는 대신 계산효율적인 depthwise-separable convolution을 사용함으로써 속도 향상을 이뤄냄
-> 저비용, 자원 제약 환경에서 Nix-TTS의 효율성을 보임 (lightweight!)

반응형