티스토리 뷰

반응형

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을 활용하여 모델의 크기를 줄이는 방법도 있음

-> 그래서 성능은 유지하면서 학습 비용이 낮은 경량 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

  • F(;w) : end-to-end neural TTS 모델
    - End-to-End : 외부 vocoder 없이 직접 text c에서 raw waveform xw의 음성 데이터 x를 생성하는 것을 의미
  • End-to-End TTS 모델의 architecture
    • E : Encoder, D : Decoder
      - Ec를 latent representation으로 encoding

      - Dzxw로 decoding
    • 모델에 따라 z는 결정적이거나 zN(μ,σ) 같은 분포를 따라 생성적일 수 있음

End-to-End TTS 모델 Architecture

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

Knowledge Distillation Setting

- 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 : 음성 데이터 변수, z : latent 변수
    • z의 사전 분포는 pψ(z|c)로 정의
      - latent는 input text c에 의해 condition 되고 psi로 parameterized
    • (VITS의 목표) c가 주어졌을 때 x의 분포 하에서 evidence lower bound (ELBO)를 최대화하는 방향으로 학습

VITS formulation

  • Reconstruction term은 Mel-spectrogram xm을 이용
    - Ground truth와 예측된 음성 사이의 L1 Loss로 구성

    - ˆxmpϕ(x|z)

Reconstruction term

  • Architecture 측면에서 VITS는 qθ(z|x),pϕ(x|z),pψ(z|c) 분포에 대응하는 3개의 모듈로 나눌 수 있음
    • Posterior Encoder
      - Non-casual WaveNet residual block으로 구성
      - Linear spectrogram xsxqθ(z|x)=N(μq,σq)의 parameter인 {μq,σq}로 encoding
      - Latent sample zqN(μq,σq)를 추론한 다음 deccoder로 전달되어 raw waveform xw에서 x로 reconstruction
    • Prior Encoder
      - Transformer encoder 블록과 affine coupling layer가 있는 normalizing flow f로 구성
      - cpψ(z|c)=N(μp,σp)의 parameter인 {μp,σp}와 prior latent sample zp=f(zq)로 encoding
      - {μp,σp}zp은 Monotonic Alignment Search (MAS)로 정렬
      - 추론과정에서 network는 aligned prior parameter {μp,σp}
      xs을 사용해 f1(μp,σp)으로부터 zq를 추론
    • Decoder
      - HiFi-GAN v1의 generator architecture를 따름
      - Multi-period discriminator를 사용하여 적대적인 방식으로 zqxw로 reconstruction
  • Available Knowledge to be Distilled
    • Teacher VITS가 이미 학습되어 있다고 가정하면, Encoder-Decoder 구조를 활용할 수 있음
      - Prior Encoder는 latent 분포 qθ(z|x)를 모델링하는 Et의 역할
      - Decoder는 latent sample zqqθ(z|x)에서 xw를 decoding 하는 Dt의 역할
    • Prior Encoder와 Posterior Encoder는 모두 동일한 latent space를 encoding 하므로 모두 Et로 볼 수 있음
      - qθ(z|x)에 대한 stochastic sample만을 제공하는 f로 인해 복잡한 Prior Encoder에서도 student Es가 distill 될 수 있음
      - Prior encoder은 복잡하기 때문에 쉬운 Posterior Encoder에서 qθ(z|x)를 distill

- End-to-End TTS Student

  • Nix-TTS는 end-to-end TTS student 모델 Fs의 역할을 함
    - End-to-End TTS teacher 모델 Ft인 VITS로부터 distill 되어 얻어짐
  • Encoder Architecture
    • (Nix-TTS encoder의 목표) parameter {μq,σq}를 예측하여 qθ(z|x)=N(μq,σq)를 모델링
      - c 대신 xs를 condition으로 가짐
      - xs와 의미 있게 align 되도록 c를 encoding
    • Text Encoder, Text Aligner, Duration Predictor, Latent Encoder의 4가지 모듈로 Es 구성

Nix-TTS 구조

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

Text Alignment 수식

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

Duration Predictor 수식

  • Latent Encoder
    • Embedding layer가 없는 text encoder와 동일한 구조
    • {μq,σq}latent encoder의 output을 single perceptron layer로 projection 하여 생성
  • Decoder Architecture
    • (Nix-TTS Decoder의 목표) decoer Ds는 분포 pϕ(x|z)를 모델링
      - Latent variable zqN(μq,σq)를 입력으로 사용해 연관된 raw waveform xw를 decoding
    • DsDt와 거의 동일한 architecture를 따르지만 더 적은 parameter 수를 가짐
      - Transposed convolution과 multi-receptive fusion module로 구성된 HiFi-GAN의 generator 구조를 따름
      - 학습과정에서 Ds에는 teacher 모델의 multi-period discriminator Cs가 사용됨
    • Ds의 parameter 크기를 줄이기 위해, 기존의 vanilla convolution을 depthwise-separable convolution으로 대체하고 feature map dimension을 절반으로 줄임

- Module-wise Distillation 

  • Encoder Distillation
    • Encoder Escxs 사이의 alignment를 학습하고 해당하는 parameter를 예측하여 qθ(z|x)를 모델링하는 것이 주요한 목표
    • Alignment objective
      - Forward-sum algorithm를 사용하고 KL-divergence를 최소화해 AsoftAhard 사이의 일치를 유도하여 Asoft에서 표현되는 xs가 주어졌을 때 chidden의 likelihood를 최대화하는 것
      - LForwardSum,Lbin
    • qθ(z|x)를 모델링하기 위해 N(ˆμq,ˆσq)qθ(z|x) 사이의 KL-divergence를 최소화
      - 두 분포 모두 Gaussian을 따르므로 closed-form KL-divergence를 최소화
    • 최종 Encoder Objective : LE=LForwardSum+Lbin+Lkl

Nix-TTS의 KL-Loss

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

Decoder에서 적용되는 Loss

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%의 압축률을 보임

CMOS 비교

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

Phoneme Error Rate 비교

- 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% 감소
  • Self-attention을 사용하는 대신 계산효율적인 depthwise-separable convolution을 사용함으로써 속도 향상을 이뤄냄
    -> 저비용, 자원 제약 환경에서 Nix-TTS의 효율성을 보임 (lightweight!)

On-device 환경에서의 비교

 

반응형
댓글
최근에 올라온 글
최근에 달린 댓글
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
Total
Today
Yesterday