티스토리 뷰
Paper/Language Model
[Paper 리뷰] Generative Pre-trained Speech Language Model with Efficient Hierarchical Transformer
feVeRin 2025. 1. 26. 12:51반응형
Generative Pre-trained Speech Language Model with Efficient Hierarchical Transformer
- Speech language model은 여전히 neural audio codec의 long acoustic sequence를 modeling 하는데 한계가 있음
- Generative Pre-trained Speech Transformer (GPST)
- Audio waveform을 2가지의 discrete speech representation으로 quantize 하고 hierarchical transformer architecture에 integrate 함
- End-to-End unsupervised manner로 train 됨으로써 다양한 speaker identity를 가지는 speech를 생성 가능
- Multi-lingual semantic token과 universal acoustic token을 incorporating 하여 spoken cross-lingual speech generation으로 확장 가능
- 논문 (ACL 2024) : Paper Link
1. Introduction
- Speech quantization은 speech language model이 controllable, high-quality speech를 생성하는데 필요함
- 특히 speech waveform은 semantic token과 acoustic token의 2가지 distinct type로 quantize 할 수 있음
- Semantic token은 $k$-means clustering을 self-supervised speech model의 continuous activation space에 적용하여 얻어짐
- BUT, semantic token은 speaker identity와 같은 acoustic detail을 retain 하지 못하므로 suboptimal reconstruction이 발생할 수 있음 - SoundStream, EnCodec과 같은 neural codec model로 얻어지는 acoustic token은 speech waveform의 nuance를 capture 하면서 low-bitrate로 compress 함
- 따라서 speech language model은 semantic token과 acoustic token을 모두 활용하여 high-quality speech를 생성함
- Semantic token은 $k$-means clustering을 self-supervised speech model의 continuous activation space에 적용하여 얻어짐
- BUT, neural codec은 high-quality synthesis를 위해 상당한 수의 code가 필요함
- 대표적으로 EnCodec은 24kHz audio waveform을 위해 75Hz에서 codec embedding을 생성함
- 이후 해당 codec embedding은 Residual Vector Quantization (RVQ)를 통해 modeling 되고, 이때 1024 entry가 있는 8 이상의 hierarchical quantizer가 필요함
- 따라서 10 second waveform은 최소 $75\times 8\times 10 = 6000$ code를 생성하게 되므로 long sequence length에 대한 self-attention의 quadratic complexity 문제가 발생함
- 결과적으로 speech language model은 perceptual quality와 computational complexity 간의 trade-off를 해결해야 함
- 특히 speech waveform은 semantic token과 acoustic token의 2가지 distinct type로 quantize 할 수 있음
-> 그래서 speech quantization을 hierarchical transformer와 결합한 speech language model인 GPST를 제안
- GPST
- Next token prediction task로 semantic sequence를 modeling 한 다음, $D$ stack code를 예측하는 방식으로 acoustic sequence를 modeling
- Semantic sequence는 condition으로써 acoustic token에 대한 prompt 역할을 수행함 - Acoustic sequence의 hierarchical structure를 modeling 하기 위해 large global transformer, small local transformer로 구성된 specialized hierarchical architecture를 설계
- Global transformer는 semantic token과 stakced acoustic token 간의 high-level relationship을 학습하고, Local transformer는 stacked acoustic code의 hierarchical detail을 modeling 함
- 결과적으로 하나의 hierarchical transformer에 semantic, acoustic token을 incorporating 함으로써 computational cost를 줄이고 long-term interaction과 local dependency를 효과적으로 학습함
- 추가적으로 Hi-Res speech generation의 training efficiency를 향상하기 위해 local-drop training technique을 도입
- Next token prediction task로 semantic sequence를 modeling 한 다음, $D$ stack code를 예측하는 방식으로 acoustic sequence를 modeling
< Overall of GPST >
- Hierarchical transformer 내에서 semantic token과 acoustic token을 integrating 하여 computational cost를 줄이고 long-term interaction을 효과적으로 capture
- 결과적으로 기존 speech model보다 뛰어난 합성 성능을 달성하면서 $33%$의 parameter 절감 효과를 달성
2. Method
- Generative Speech Pre-training
- Audio waveform sequence $x\in\mathbb{R}^{T}$가 주어진다고 하자
- 그러면 이를 semantic token $S=(s_{1},...,s_{T_{1}})\in\{1,...,N_{s}\}^{T_{1}}$과 acoustic token $A=(a_{1}^{1},...,a_{1}^{D},...,a_{T_{2}}^{D})\in\{1,...,N_{a}\}^{T_{2}\times D}$의 sequence로 quantize 함
- $T_{1},T_{2}\ll T$이고, 이때 acoustic sequence는 2-dimensional matrix와 hierarchical structure를 가지고 있으므로 $a_{t}^{q}$는 previous token $a_{t}^{q-1}$로부터 derive 될 수 있음 - 즉, speech language model의 learning objective는 다음과 같이 auto-regressively factorize 됨:
(Eq. 1) $p(S|A)=p(S)p(A|S)=\prod_{t=1}^{T_{1}}p(s_{t}|s_{<t})\prod_{q,t=1}^{D,T_{2}} p(a_{t}^{q}|a_{<t}^{\leq D},a_{t}^{<q},S)$
- 이때 naive approach로써 acoustic sequence $A$를 raster-scan order로 length가 $T_{2}\times D$인 1-dimensional sequence로 unfold 하여 transformer에 feed 할 수 있음
- BUT, $T_{2}\times D$는 상당히 크기 때문에 transformer는 self-attention mechanism으로 인한 quadratic cost 문제가 발생함 - 한편 AudioLM은 아래 그림의 (a)와 같이 speech modeling을 위해 3-stage approach를 채택함
- First stage에서는 semantic token에 대한 auto-regressive pre-training을 통해 long-term temporal structure를 capture 함
- 이후 $T_{2}\times D$의 acoustic sequence를 $T_{2}\times D'$의 coarse part와 $T_{3}\times (D-D')$의 fine part로 나눔
- $D'$은 일반적으로 $D-D'$보다 훨씬 작음
- Fine part는 $T_{2}\times (D-D')$의 sequence length를 reduce 하기 위한 coarse sequence의 subset - 최종적으로 2개의 individual transformer를 통해 coarse/fine acoustic sequence를 separately modeling 함
- 결과적으로 AudioLM의 learning objective는:
(Eq. 2) $p(S,A)=p(S)p(A|S)$
$\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, \approx \prod_{t=1}^{T_{1}}p(s_{t}|s_{<t};\theta_{S})\prod_{q_{1},t=1}^{D',T_{2}} p(a_{t}^{q_{1}}| a_{<t}^{\leq D'},a_{t}^{<q_{1}},S;\theta_{C})\prod_{q_{2}=D'+1,t=1}^{D,T_{3}} p(a_{t}^{q_{2}}|a_{<t}^{>D'},a_{t}^{<q_{2}},a_{\leq T_{3}}^{\leq D'};\theta_{F})$
- $q_{1}\leq D'<q_{2}\leq D$, $T_{3}<T_{2}$
- Fine acoustic transformer는 sequence length를 reduce 하기 위해 coarse acoustic token의 subset만 modeling 함
- Learnable parameter $\theta_{S},\theta_{C},\theta_{F}$는 각각의 independent transformer에 해당함 - 아래 그림의 (b)에 해당하는 VALL-E는 semantic token 대신 G2P tool을 condition으로 사용하여 text로부터 derive 된 phoneme sequence를 활용함
- Phoneme은 semantic token과 비슷하게 사용되고, 이때 VALL-E는 acoustic token generation process를 2-stage로 나누어 modeling 함
- 즉, first quantizer layer에서 acoustic token을 auto-regressively generate 한 다음, subsequent acoustic token은 non-autoregressively generate 하는 방식 - 이때 $p(S)$를 modeling 하지 않으므로 semantically coherent sequence를 unconditionally generate 할 수 없음
- Phoneme은 semantic token과 비슷하게 사용되고, 이때 VALL-E는 acoustic token generation process를 2-stage로 나누어 modeling 함
- 결과적으로 VALL-E의 learning objective는:
(Eq. 3) $p(A|S)=\prod_{q,t=1}^{D,T_{2}}p(a_{t}^{q}|a_{<t}^{\leq D},a_{t}^{<q},S)\approx \prod_{t=1}^{T_{2}}p(a_{t}^{1}|a_{<t}^{1},S;\theta_{AR})\prod_{q=2,t=1}^{D,T_{2}}p(a_{t}^{q}|a_{\leq T_{2}}^{<q},S;\theta_{NAR})$
- $\theta_{AR},\theta_{NAR}$ : auto-regressive/non-autoregressive model
- 그러면 이를 semantic token $S=(s_{1},...,s_{T_{1}})\in\{1,...,N_{s}\}^{T_{1}}$과 acoustic token $A=(a_{1}^{1},...,a_{1}^{D},...,a_{T_{2}}^{D})\in\{1,...,N_{a}\}^{T_{2}\times D}$의 sequence로 quantize 함
- Efficient Hierarchical Transformer
- Acoustic sequence의 hierarchical structure를 고려하여, GPST는 EnCodec에서 추출한 code를 학습하는 hierarchical transformer architecture를 도입함
- 구조적으로는:
- Speech SSL encoder와 $k$-means clustering model을 integrate 한 semantic token extractor와 neural codec model인 EnCodec을 기반으로 함
- 이후 large global transformer를 통해 previous semantic token과 stacked acoustic token에 causal attention을 적용하여 representation을 contextualize 함
- Smaller local transformer는 global model에서 contextualize 된 hidden state를 기반으로 subsequent acoustic token을 auto-regressively predict 함
- GPST의 learning objective는:
(Eq. 4) $p(S,A)=p(S)p(A|S)=\prod_{t=1}^{T_{1}}p(s_{t}|s_{<t};\theta_{global}) \prod_{q,t=1}^{D,T_{2}} p(a_{t}^{q}|a_{<t}^{\leq D},a_{t}^{<q},S;\theta_{global},\theta_{local})$
- End-to-End learning process는 one-stage, one-model로 수행되므로 multi-stage formulation에서 발생하는 error propagation 문제를 완화할 수 있음
- 구조적으로는:
- Global Tansformer
- Global transformer는 causal mask가 있는 $N_{g}$ layer decoder-only transformer에 해당함
- Long-term consistency를 capture 하는 semantic token과 RVQ에서 얻어진 acoustic token을 single sequence로 concatenate 하여 input으로 사용함:
(Eq. 5) $E(s_{t})=E_{s}(s_{t})+\text{PE}_{g}(t),\,\,\, \text{for}\,\, 1\leq t\leq T_{1}$
$\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, E(a_{t})=\sum_{q=1}^{D}E_{a}(a_{t}^{q})+\text{PE}_{g}(t+T_{1}),\,\,\,\text{for}\,\, 1\leq t\leq T_{2}$
$\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, h_{t}=\text{GlobalTransformer}(s_{1},...,s_{T_{1}},a_{1},...,a_{T_{2}}),\,\,\, 1\leq t\leq T_{1}+T_{2}$
- $E_{s}, E_{a}$ : semantic/acoustic token embedding function
- $\text{PE}_{g}$ : global transformer의 positional embedding - 추가적으로 model이 generation space를 switch 하도록 inform 하기 위해 sequence의 first position과 segment boundary에 special token을 add 함
- Local Transformer
- Local transformer는 $N_{l}$ layer로 구성됨
- Global transformer의 contextualized hidden state $h_{t}$가 주어졌을 때, local transformer는 position $t$에서 $D$ acoustic code $a^{1}_{t},...,a_{t}^{D}$를 auto-regressively predict 함:
(Eq. 6) $E(a_{t}^{q})=E_{a}(a_{t}^{q})+\text{PE}_{l}(q),\,\,\,1\leq q\leq D$
$\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,a_{t}=\text{LocalTransformer}(h_{t},a_{t}^{1},...,a_{t}^{D})$
- $\text{PE}_{l}$ : position $t$에서 share 되는 local transformer의 positional embedding - 결과적으로 GPST는 다음의 negative log-likelihood를 minimize 하여 training 됨:
(Eq. 7) $\mathcal{L}=\sum_{t=1}^{T_{l}}-\log p(s_{t}|s_{<t};\theta_{global})- \sum_{t=1}^{T_{2}}\sum_{q=1}^{D} \log p(a_{t}^{q}| a_{t}^{<q},S;\theta_{global},\theta_{local})$
- Local-Drop
- Hi-Res speech를 생성할 때 residual quantizer의 수로 인해 high computational complexity가 발생함
- 따라서 GPST의 training efficiency를 위해 local-drop을 도입함
- 먼저 local transformer는 acoustic token의 individual stack만 modeling 하므로 $(\text{Batch}\times T_{2},D)$의 input shape를 가짐
- 한편 acoustic sequence length $T_{2}$에 대한 dimension은 first batch dimension으로 unfold 되므로 code stack은 self-attention으로 처리되지 않음
- 이때 first dimension의 size를 decrease 하기 위해 일부 token $a^{\leq D}_{t}$를 randomly drop 함
- Inference
- Speech language model은 context learning을 통해 unseen speaker에 대한 semantically coherent speech를 생성할 수 있고 이는 zero-shot learning으로 확장될 수 있음
- 먼저 prompt로부터 semantic token $S_{p}$와 acoustic token $A_{p}$가 주어지고,
- Target으로부터 semantic token $S_{t}$, acoustic token $A_{t}$가 주어진다고 가정하자
- 그러면 prompt 사용에 따라 generation mode를 4가지로 나눌 수 있음:
- Unconditional Generation
- 해당 setting에서는 semantic token을 unconditionally generate 하여 이후 acoustic generation에 대한 prefix로 사용함
- 특히 randomly sampled semantic sequence는 diverse 하고 syntactically/semantically consistent 한 linguistic content를 생성할 수 있음 - Acoustic token은 speaker identity에 따라 달라질 수 있고, semantic content는 guideline으로 사용됨
- 해당 setting에서는 semantic token을 unconditionally generate 하여 이후 acoustic generation에 대한 prefix로 사용함
- Semantic to Acoustic
- TTS와 유사하게 acoustic generation을 위한 condition으로 ground-truth semantic token $S_{t}$를 사용함
- 이 경우 generated speech는 spoken sentence의 content는 preserve 하면서 speaker identity가 달라짐 - 추가적으로 SPEAR-TTS를 따라 LibriSpeech dataset에서 decoder-only transformer를 training 한 다음, text를 condition으로 semantic token을 생성해 TTS task를 지원할 수 있음
- TTS와 유사하게 acoustic generation을 위한 condition으로 ground-truth semantic token $S_{t}$를 사용함
- Speaker Identity Transfer
- 해당 setting은 prompt speech의 speaker identity를 target speech로 변환하는 voice conversion에 해당함
- 이 경우 input sequence는 $[S_{p},S_{t},A_{p}]$와 같이 concatenate 되고, GPST는 $S_{t}$의 content를 유지하면서 $A_{p}$의 speaker identity와 비슷한 acoustic token을 생성해야 함 - 한편 linguistically inconsistent $S_{p}$와 $S_{t}$를 directly concatenating 하는 경우 interface boundary에서 unstable generation이 발생함
- 따라서 논문은 $S_{p}, S_{t}$ 사이에 short silence excerpt를 artificially inserting 하여 linguistic continuation을 explicitly break 함 - 이를 통해 GPST는 $S_{p},S_{t}$로부터 stable speech를 생성할 수 있음
- 해당 setting은 prompt speech의 speaker identity를 target speech로 변환하는 voice conversion에 해당함
- Acoustic Continuations
- Prompt와 target이 서로 다른 utterance에서 제공되는 speaker identity transfer와 달리, acoustic continuation은 target의 첫 3초를 prompt로 사용함
- 이후 model은 해당 3초 이후의 acoustic continuation을 생성함
- Unconditional Generation
- Spoken Multi-lingual Learning
- 논문은 SeamlessM4T의 multi-lingual XLSR encoder를 semantic token extractor로 채택함
- Acoustic token의 경우 pre-trained neural audio codec인 EnCodec을 사용함
- EnCodec은 English data로 training 되었지만 다른 language도 합성 가능하므로 universal acoustic extractor로 사용할 수 있음
- Efficiency Analysis
- Transformer는 self-attention 계산 과정에서 sequence length에 대한 quadratic complexity로 인해 한계가 있음
- $T_{2}\times D$인 acoustic matrix $A$에 대해, AudioLM의 one-dimensional sequence unfolding과 같은 naive approach는 $\mathcal{O}(NT^{2}_{2}D^{2})$의 computational complexity를 가짐
- $N$ : Transfromer layer 수 - 한편 GPST의 경우 $N_{g}$의 global layer와 $N_{l}$의 local layer를 가지면서, global transformer는 $T_{2}$의 sequence length를 처리하고 local transformer는 $D$의 sequence length를 처리함
- 먼저 simplicity를 위해 $N=N_{g}+N_{l}$이라고 하자
- 그러면 GPST의 overall complexity는 $\mathcal{O}(N_{g}T_{2}^{2}+N_{l}T_{2}D^{2})$으로 $\mathcal{O}(NT_{2}^{2}D^{2})$보다 작음
- 특히 self-attention은 large transformer에서 primary computational cost factor로 작용하지 않음
- 대신 embedding size, feedforward network의 dimension이 overall computational cost에 영향을 미침
- e.g.) $T_{2}$ length의 sequence에서 $m$개의 non-embedding parameter가 있는 large transformer를 사용한 forward pass는 $2mT_{2}$ FLOPS를 소모함 - 따라서 global dimension $m_{g}$와 local dimension $m_{l}$을 가지는 GPST의 경우, required FLOPS는 $2T_{2}(m_{g}+m_{l}D)$가 됨
- $m_{l}$은 $m_{g}$보다 훨씬 작으므로 GPST의 FLOPS는 $2T_{2}m_{g}$로 볼 수 있고, 이는 $2T_{2}Dm_{g}$ FLOPS를 가지는 standard transformer 보다 $\times D$ 빠름
- 대신 embedding size, feedforward network의 dimension이 overall computational cost에 영향을 미침
- $T_{2}\times D$인 acoustic matrix $A$에 대해, AudioLM의 one-dimensional sequence unfolding과 같은 naive approach는 $\mathcal{O}(NT^{2}_{2}D^{2})$의 computational complexity를 가짐
3. Experiments
- Settings
- Results
- LibriSpeech Evaluation
- 전체적으로 GPST가 가장 우수한 성능을 보임
- DNSMOS 측면에서도 GPST가 가장 우수함
- Multi-lingual Evaluation
- GPST는 multi-lingual setting에서 ground-truth 수준의 성능을 달성함
- Effect of Model Architecture Settings
- Global, local transformer의 layer 수에 대한 영향을 확인하기 위해, $(12-x)\times N_{g}+4\times x \times N_{l}$의 setting을 채택
- Local transformer의 layer 수를 늘리는 경우, GPST는 acoustic token을 더 잘 학습할 수 있지만, generation speed가 저하됨
- On the Hi-Res Quality
- 6 kbps (8 quantizer)와 12 kbps (16 quantizer) GPST로 생성된 speech의 spectrogram을 각각 비교
- 이 경우, high-frequency region에서 richer harmonics는 higher speech quality를 의미 - 더 많은 quantizer를 사용하여 생성된 speech는 spectrogram에서 더 많은 detail을 가짐
- 6 kbps (8 quantizer)와 12 kbps (16 quantizer) GPST로 생성된 speech의 spectrogram을 각각 비교
반응형
'Paper > Language Model' 카테고리의 다른 글
댓글