티스토리 뷰

반응형

CLaM-TTS: Improving Neural Codec Language Modeling for Zero-Shot Text-to-Speech


  • Zero-shot Text-to-Speech를 위해 audio의 discrete token에 대한 multiple stream을 encode 하는 neural audio codec을 활용할 수 있음
  • 이때 audio tokenization은 long sequence legnth와 multiple sequence modeling의 complexity로 인해 scalability의 한계가 있음
  • CLaM-TTS
    • Token length에 대한 뛰어난 compression을 달성하고, Language model이 한 번에 multiple token을 생성할 수 있도록 하는 probabilistic residual vector quantization을 도입
    • 이를 통해 token stream 처리에 대한 cacaded modeling의 필요성을 제거
  • 논문 (ICLR 2024) : Paper Link

1. Introduction

  • 대규모 text data에 대해 training 된 Large Language Model (LLM)은 뛰어난 zero-shot learning capability를 보이고 있음
    • 이때 scaling paradigm은 LLM의 효율적인 training과 추론에 동시에 영향을 미침
      - 특히 discretized representation은 input length를 manageable size로 reduce 함으로써 해당 문제를 완화할 수 있음
    • 한편으로 speech domain에서 language modeling은 high-fidelity audio tokenization을 지원하는 neural audio codec을 활용하여 수행됨
      - 특히 zero-shot text-to-speech (TTS)를 위한 LLM으로써 우수한 성능을 보임
    • BUT, 해당 neural audio codec을 활용하여 TTS 모델을 scale up 하는 데는 여전히 어려움이 있음
      1. 기존 방식들은 주로 text와 audio token의 intermediary로써 self-supervised speech representation의 semantic token을 활용함
      2. 해당 semantic token은 audio token보다 information을 더 concisely compress 하지만 EnCodec과 같은 nerual codec은 5-second speech segment를 생성하기 위해 여전히 상당한 semantic token이 필요함
      3. 결과적으로 audio token modeling의 complexity 문제는 여전히 남아있음

-> 그래서 TTS에서 LLM의 효율적인 training과 추론을 지원하는 Codec Language Model-based TTS (CLaM-TTS)를 제안

 

  • CLaM-TTS
    • Sequence 수에 따른 iterative modeling 없이 각 time step에 있는 모든 multiple token을 language model의 autoregressive step을 통해 생성
    • Probabilistic discrete representation learning을 활용하여 모든 discrete latent code가 training process에 participate 하도록 보장해 고품질 speech autoencoder를 구축
    • 추가적으로 latent language model이 한 번에 효율적으로 token stack을 생성할 수 있도록 하는 framework를 제공
      - Latent language model은 continuous latent audio representation을 생성하고 probabilistic quantization method를 사용해 discrete representation으로 변환

< Overall of CLaM-TTS >

  • Latent language model을 통해 continuous latent audio representation을 생성하고 probabilistic quantization method를 사용해 효율적으로 discrete representation으로 변환
  • 결과적으로 기존 방식들 보다 빠른 추론 속도를 가지면서 비교할만한 품질을 달성

2. Preliminaries

  • 논문은 neural codec language modeling을 통해 zero-shot TTS 모델을 구축하는 것을 목표로 함
    • 이를 위해 text data x와 해당 speech data의 mel-spectrogram representation y의 2가지 data를 고려
    • 여기서 mel-spectrogram y의 latent representation z1:T로 부터 T discrete code seqeuence c1:T:=를 모델링
      - 이는 Residual Vector Quantization (RVQ)가 포함된 Variational AutoEncoder (VAE) framework를 통해 얻어짐
      - ct : quantized, discrete code의 D-depth
    • 이후 text transcript x에서 c1:T를 예측하는 것을 목표로 neural language model pθ(c1:T|x)를 적용
    • 추론 시 language model은 주어진 text x에 대해 c1:T를 생성하고, 이후 VAE decoder와 pre-trained vocoder를 통해 음성으로 변환함

- Residual-Quantized Variational AutoEncoder (RQ-VAE)

  • RQ-VAE는 residual vector quantization을 사용하여 data를 discrete code로 변환하는 neural network
    • RQ-VAE는 3가지 component로 구성됨:
      1. Data y를 latent representation sequence z1:T로 mapping 하는 ϕ로 parameterize 된 encoder
      2. 각 time t의 latent vector zt를 discrete code representation ct,1:D=RQψ(zt) 또는 quantized embedding z^t로 변환하는 residual vector quantizer RQψ()
      3. Quantized latent representation sequence z^1:T로부터 data y^를 reconstruction 하는 ω로 parameterize 된 decoder
    • 여기서 ct,1:D는 set {ct,1,...,ct,D}를 나타내고 D는 quantizer의 total depth를 나타낸다고 하자
      1. 그러면 encoder의 latent representation은 vocab size가 V인 codebook embedding에 대한 multi-stage nearest-neighbor lookup을 통해 quantize 됨
      2. 이는 codebook에서 각 depth d에 대해 residual error를 최소화하는 optimal code를 찾는 것으로 정의할 수 있음:
        (Eq. 1) ct,d=argminc{1,...,V}||rt,d1eψ(c;d)||2,rt,d=rt,d1eψ(ct,d;d)d[1,D]
        - rt,0=zt, eψ(c;d) : depth d에서 codebook의 c-th embedding vector
    • Embedding의 합 d=1Deψ(ct,d;d)은 quantized latent representation z^t가 되고, 이는 decoder를 통해 input space로 convert back 됨
      - Codebook embedding은 exponential moving average update에 의해 cluster 된 latent로 update 됨

- Mean-Field Variational Inference

  • ψ에 의해 parameterize 된 joint distribution pψ(zt,ct,1:D)로 characterize 된 latent variable model이 있다고 하자
    • 여기서 zt는 observed random variable이고, ct,1:D는 latent random variable set {ct,1,...,ct,D}을 나타냄
    • 이때 variational inference는 approximate distribution q(ct,1:D|zt)의 parameter에 대한 optimization 문제를 solving 하여 intractable distribution pψ(ct,1:D|zt)을 근사하는 방법
      1. 대표적으로 Evidence Lower BOund (ELBO)와 같이 marginal log-likelihood pψ(zt)에 대한 lower bound를 사용할 수 있음:
        logpψ(zt)=logct,1:Dpψ(zt|ct,1:D)p(ct,1:D)Eq(ct,1:D|zt)[logpψ(zt|ct,1:D)p(ct,1:D)q(ct,1:D|zt)]
      2. 한편으로 mean-field variational inference는 obeserved variable q(ct,1:D|zt)=d=1Dq(ct,d|zt)에 따라 latent variable 간의 independence를 가정하는 variational inference 방식
      3. 이때 ELBO를 maximize 하는 각 optimal variational posterior distribution q(ct,d|zt)은 다음을 만족함:
        (Eq. 2) q(ct,d|zt)exp(Eq(ct,d|zt)[logpψ(zt|zt,d,zt,d)p(ct,d,ct,d)])
        - ct,dct,d를 제외한 모든 depth ct,1:D의 latent variable
    • (Eq. 2)를 기반으로 iterative coordinate ascent algorithm을 적용하여 distribution q를 update 할 수 있음
      - Algorithm의 complexity는 q(ct,d|zt)에 대한 expectation 계산에 의해 결정됨

3. Method

- Mel-VAE

  • CLaM-TTS는 short sequence length에서 discrete speech code를 생성하는 neural codec을 구축하는 것을 목표로 함
    • 이를 위해 아래 그림과 같이 speech audio의 mel-spectrogram을 compress 하는 RQ-VAE를 사용함
      - 이때 기존 vector quantization method의 codeword collapse 문제를 해결하기 위해, residual codeword를 학습하는 variational inference method를 도입
    • Mel-VAE는 앞선 RQ-VAE와 유사하게 구성됨
      1. 먼저 encoder는 mel-spectrogram y를 latent representation sequence z1:T와 residual vector quantizer RQψ()으로 mapping 하여,
      2. 각 time t의 latent vector zt를 discrete code representation ct나 해당 quantized embedding z^t=d=1Deψ(ct,d;d)으로 변환함
      3. Decoder는 quantized latent representation sequence z^1:T로 부터 mel-spectrogram y^를 reconstruct 함
    • q(ct,1:D|zt)=d=1Dq(ct,d|zt)p(ct,d,ct,d)가 uniformly distribute 되어 있다는 가정하에, mean-field variational inference는 다음의 distribution condition을 산출함:
      (Eq. 3) q(ct,d|zt)exp(Eq(ct,d|zt)[logpψ(zt|ct,d,ct,d)])
      - 이때 latent는 normal distribution pψ(zt|ct)=N(zt;deψ(ct,d;d),σψ2I)을 따름
    • BUT, (Eq. 3)의 모든 depth에 대한 code의 interdependence는 iterative approach 없이 solve 하기 어려움
      1. 여기서 iterative coordinate update approach 대신 CLaM-TTS는 Eq(ct,d|zt)[logpψ(zt|ct,d,ct,d)]를 모든 d에 대해 logpψ(zt|ct,d,ct,d)로 pointwise 하게 근사할 수 있음
        - ct,1:D=RQψ(zt)
      2. 그러면 posterior는 q(ct,d|zt)pψ(zt|ct,d,ct,d)로 나타남
    • 이를 기반으로 variational inference framework는 각 depth d의 codebook embedding을 independently optimize 함:
      (Eq. 4) L(ψd;zt,ct,d)=Eq(ct,d|zt)[logpψ(zt|ct,d,ct,d)]
      (Eq. 5) L(ψ;zt,ct,1:D)=d=1DL(ψd;zt,ct,d)
    • Encoder parameter ϕ, decoder parameter ω에 대한 Mel-VAE의 다른 module은 commitment loss, reconstruction loss, adversarial loss로 train 됨:
      (Eq. 6) L(ω,ϕ;y,ct,1:D)=λr|yy^|+λc||zdeψ(ct,d;d)||2+λaLadv
      - λr,λc,λa : 각각 reconstruction loss, commitment loss, adversarial loss의 ocefficient
    • Adversarial training을 위해 CLaM-TTS는 multi-length discriminator, multi-resolution spectorgram discriminator를 채택
      - 그리고 least squares GAN objective와 L1 feature matching loss를 adversarial loss Ladv로 사용

Overall of CLaM-TTS

- Latent Language Modeling

  • 모델의 효율성을 향상하기 위해 text x가 주어지는 conditional speech code language model을 구축
    • 이는 speech code가 vector quantization을 통해 생성된다는 점을 활용
    • 따라서 vector 자체를 예측함으로써 residual vector quantization을 통해 각 layer에서 multiple token으로 변환할 수 있으므로, 기존의 sequential 한 speech code token 예측을 개선할 수 있음
      1. 구체적으로 논문은 text에서 token을 직접 예측하는 대신, residual vector quantization을 사용하여 speech code로 변환할 수 있는 speech의 continuous latent representation zt를 고려함:
        pθ(c1:T|x)=t=1Tpθ(ct|x,c<t)=t=1Tpθ(ct,zt|x,c<t)dzt=t=1Tpθ(zt|x,c<t)pψ(ct|zt)dzt
        - 이때 c<tc1:t1
        - pθ(ct|zt,x,c<t)의 대체로 Mel-VAE와 함께 학습된 probabilistic quantizer distribution pψ(ct|zt)를 사용
      2. Conditional distribution pθ(zt|x,c<t)를 Gaussian mixture model로 정의하면:
        pθ(zt|x,c<t)=k=1Kpθ(k|x,c<t)N(zt;μθ(k,x,c<t),σψ2I)
      3. 위 모델로부터 log-likelihood에 대한 다음의 variational lower bound를 얻을 수 있음:
        logpθ(c|x)t=1TEq(k|x,ct)[DKL(pψ(zt|ct)||pθ(zt|x,c<t,k))+logpθ(k|x,c<t)+B(ψ,ct)]
        =LVB(θ)+B(ψ,ct)
    • 결과적으로 latent language model을 training 하기 위한 total loss
      L(θ)=LVB(θ)+LEOS(θ)
      - 이때 second loss LEOS(θ)는 End of Speech EOS를 identify 하기 위한 binary classifier training을 위함
    • CLaM-TTS는 mixture weight, Gaussian mixture distribution의 평균, generation concluding probability를 output 하는 autoregressive latent model을 활용함
      1. 구조적으로는 transformer decoder와 3가지 parallel module을 통합하여 구성됨
        - pθ(k|x,c<t)에 대한 softmax actiavtion을 사용하는 prediction layer
        - μθ(k,x,c<t)에 대한 prediction layer
        - EOS prediction을 위한 binary classifier layer
      2. 추가적으로 Mel-VAE의 pre-trained quantizer RQψ()도 사용

- Model Architecture and Inference

  • Model Architecture
    • Mel-VAE은 Denoising Diffusion Probabilistic Model (DDPM)의 causal 1D convolutional U-Net을 사용함
      - 이때 skip connection과 attention layer를 제거하고 1D ConvNeXt block을 decoder의 final layer에 추가
    • 추가적으로 각 depth에 대해 codebook size가 1024인 32-stage residual vector quantization을 사용
    • Text-to-Code latent language model의 경우, transformer-based encoder-decoer LM을 채택
      - 특히 SoundStorm과 유사하게 pre-trained ByT5-large를 활용하고 text encoder를 frozen 함
  • Inference
    • Text-to-Code generation은 3단계로 진행됨
      1. 먼저 time step t에서 distribution pθ(k|x,<t)으로부터 k를 randomly select 함
      2. 다음으로 pθ(zt|x,c<t,k)에서 latent vector zt를 random sampling 함
        - 즉, time step t에서 discrete code는 learned quantizer ct=RQψ(zt)를 통해 얻어짐
      3. 이후 EOS의 probability가 0.5 이상이면 generation을 종료하고, 그렇지 않으면 step을 진행함
    • 결과적으로 생성된 code는 Mel-VAE decoder를 통해 mel-spectrogram으로 decoding 되고, pre-trained vocoder인 BigVGAN을 통해 raw waveform으로 최종 변환됨

4. Experiments

- Settings

  • Dataset : 아래 표 참고 (11 language dataset
  • Comparisons : YourTTS, VALL-E, Spear-TTS, VoiceBox

사용된 Dataset

- Results

  • English-only continuation, cross-sentence task에 대해 CLaM-TTS는 VoiceBox와 비교할만한 성능을 보임

English-only Continuation 성능
English-only Cross-Sentence 성능

  • 주관적 품질 비교에서도 CLaM-TTS는 가장 뛰어난 것으로 나타남

MOS 품질 비교

  • 한편으로 Multi-lingual continuation 측면에서도 CLaM-TTS는 우수한 성능을 보임

Multi-lingual Continuation 성능

  • Effectiveness of Proposed RVQ
    • Ablation study 측면에서 Mel-VAE에 적용된 RVQ의 효과를 확인해 보면, 논문에서 제안된 RVQ가 baseline RVQ보다 더 효과적인 것으로 나타남
    • 특히 CLaM-TTS의 RVQ는 EnCodec보다 뛰어난 speech reconstruction 성능을 보임 

제안된 RVQ의 효과

 

반응형
댓글
최근에 올라온 글
최근에 달린 댓글
«   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