티스토리 뷰

반응형

WavLM: Large-Scale Self-Supervised Pre-Training for Full Stack Speech Processing


  • Speech siganl에는 speaker identity, paralinguistics, spoken content 등의 multi-faceted information이 포함되어 있음
  • WavLM
    • Pre-training 과정에서 masked speech prediction, denoising을 jointly learining
    • Input speech의 sequence ordering을 capture 하기 위해 Transformer structure에 gated relative position bias를 도입
  • 논문 (JSTSP 2022) : Paper Link

1. Introduction

  • Self-Supervised Learning (SSL)은 Automatic Speech Recognition (ASR)과 같은 speech task에서 우수한 성능을 보이고 있음
    • BUT, ASR이 아닌 speech task에 대해서는 기존의 SSL method를 확장하기 어려움
    • 특히 기존의 pre-trained SSL model은 다음의 단점이 존재함:
      1. Speaker diarization, speech separation과 같은 multi-speaker task에서 낮은 성능을 보임
      2. 대부분의 speech pre-training은 high-quality, unlabeled data에 의존함

-> 그래서 universal speech representation을 학습하고 다양한 downstream speech task에 활용할 수 있는 WavLM을 제안

 

  • WavLM
    • Masked speech denoising, prediction framework를 활용하여 noisy/overlapped speech를 simulate
      - 결과적으로 HuBERT와 같이 masked region에서 original speech의 pseudo-label을 predict 함
    • 추가적으로 Transformer structure에 Gated Relative Position Bias를 추가하여 model 성능을 개선
      - 특히 Wav2Vec 2.0에서 사용된 convolutional relative position embedding과 비교하여 adaptive adjusting이 가능함

< Overall of WavLM >

  • Masked speech denoising, prediction framework에 기반한 universal SSL method
  • 결과적으로 다양한 downstream task에 대해 기존보다 우수한 성능을 달성

2. Background: HuBERT

  • HuBERT는 SSL method로써 BERT-like prediction loss에 대한 target label을 제공하기 위해 offline clustering step을 활용함
    • 이때 backbone은 $L$ block의 Transformer encoder로 구성됨
      - Pre-training 시 Transformer는 masked acoustic feature $\mathbf{u}$를 사용해 hidden state $\mathbf{h}^{L}$을 output 함
    • Network는 각 $z_{t}\in[C]$가 $C$-class categorical variable인 discrete target sequence $\mathbf{z}$를 predict 하도록 optimize 되고, 그러면 codeword에 대한 distribution은 다음과 같이 parameterize 됨:
      (Eq. 1) $p(c|\mathbf{h}_{t}^{L})=\frac{\exp(\text{sim}(\mathbf{h}_{t}^{L}\mathbf{W}^{P},\mathbf{e}_{c})/\tau )}{\sum_{c'=1}^{C}\exp(\text{sim}(\mathbf{h}_{t}^{L}\mathbf{W}^{P},\mathbf{e}_{c'})/\tau )}$
      - $\mathbf{W}^{P}$ : projection matrix, $\mathbf{h}_{t}^{L}$ : step $t$의 output hidden state 
      - $\mathbf{e}_{c}$ : codeword $c$의 embedding, $\text{sim}(a,b)$ : cosine similarity, $\tau=0.1$ : scale
    • 결과적으로 HuBERT는 masked speech prediction task를 채택함
      1. 이때 prediction loss는 masked region에만 적용되고, continuous input에 대해 combine 된 acoustic/language model을 학습하도록 forcing 함
      2. 추가적으로 iterative re-clustering과 re-training process도 사용됨

3. WavLM

  • WavLM은 masked speech denoising, prediction framework로써, some input이 mask와 noisy/overlap 되어 simulate 될 때 masked region에서 original speech의 pseudo-label을 predict 하는 것을 목표로 함
    • 특히 HuBERT와 같은 기존 masked speech modeling은 ASR만 focus 하므로 non-ASR task에 적용하기 어려움
    • 따라서 논문은 Transformer backbone을 optimize 하고 pre-training data를 확장함

- Model Structure

  • WavLM은 convolutional feature encoder와 Tansformer encoder를 가짐
    • Convolutional encoder는 7개의 temporal covolution block과 layer normalization, GELU activation을 가짐
      1. Temporal convolution은 512 channel, $(5,2,2,2,2,2,2)$ stride, $(10,3,3,3,3,2,2)$ kernel width으로 구성됨
      2. 한편으로 convolutional output representation $\mathbf{x}$는 Transformer input으로 mask 됨
      3. Transformer는 128 kernel size, 16 group의 convolution-based relative position embedding을 가짐
    • 이때 논문은 Transformer self-attention mechanism의 key/query 간의 offset에 기반한 Gated Relative Position Bias를 통해 해당 model을 개선함
      1. 먼저 $\{\mathbf{h}_{i}\}_{i=1}^{T}$를 self-attention의 input hidden state라고 하자
      2. 그러면 각 $\mathbf{h}_{i}$는 query, key, value triplet $(\mathbf{q}_{i},\mathbf{k}_{i},\mathbf{v}_{i})$로 linearly project 됨:
        (Eq. 2) $\mathbf{q}_{i},\mathbf{k}_{i},\mathbf{v}_{i}=\mathbf{h}_{i}\mathbf{W}^{Q},\mathbf{h}_{i}\mathbf{W}^{K},\mathbf{h}_{i}\mathbf{W}^{V}$
      3. Self-attention output $\{\tilde{\mathbf{h}}_{i}\}_{i=1}^{T}$는:
        (Eq. 3) $a_{ij}\propto\exp\left\{\frac{\mathbf{q}_{i}\cdot \mathbf{k}_{j}}{\sqrt{d_{k}}}+r_{i-j}\right\}$
        (Eq. 4) $\tilde{\mathbf{h}_{i}}=\sum_{j=1}^{T}a_{ij}\mathbf{v}_{j}$
      4. 여기서 $r_{i-j}$는 gated relative position bias로써 다음과 같이 얻어짐:
        $g_{i}^{\text{(update)}},g_{i}^{\text{(reset)}}=\sigma(\mathbf{q}_{i}\cdot \mathbf{u}),\sigma(\mathbf{q}_{i}\cdot \mathbf{w}),$
        $\tilde{r}_{i-j}=wg_{i}^{\text{(reset)}}d_{i-j},$
        $r_{i-j}=d_{i-j}+g_{i}^{\text{(update)}}d_{i-j}+(1-g_{i}^{\text{(update)}})\tilde{r}_{i-j}$
        - $d_{i-j}$ : learnable scalar relative position bias, $\mathbf{u},\mathbf{w}\in\mathbb{R}^{d_{k}}$ : learnable parameter
        - $\sigma$ : sigmoid, $w$ : learnable value
    • 논문에서 $d_{i-j}$는 bucket relative position embedding을 사용하고 embedding parameter는 모든 layer에 share 됨
      1. 이때 $n=320$ embedding을 사용하고 각각은 possible $(i-j)$ offset range에 해당함
      2. Range는 $m=800$의 maximum offset까지 logarithmically increase 하고, 그 이상에 대해서는 모든 relative offset을 same embedding에 assign 함:
        (Eq. 5) $d_{|i-j|}=\left\{\begin{matrix}
        |i-j|, & |i-j|<\frac{n}{4} \\
        \left\lfloor \frac{n}{4}\left( \frac{\log (|i-j|)-\log(\frac{n}{4})}{\log(m)-\log(\frac{n}{4})}+1\right)\right\rfloor, & \frac{n}{4}\leq |i-j|<m \\
        \frac{n}{2}-1, & |i-j|\geq m  \\
        \end{matrix}\right.$
        (Eq. 6) $d_{i-j}=d_{|i-j|}+\frac{n}{2}\cdot\mathbb{1}_{i-j>0}$
    • Wav2Vec 2.0의 convolutional relative position embedding과 비교하여 해당 gate는 current speech content에 대한 conditioning을 통해 relative position bias를 adaptively adjust 할 수 있음

WavLM Architecture

- Masked Speech Denoising and Prediction

  • 논문은 robustness와 speaker identity preservation을 위해 masked speech denoising, prediction framework를 도입함
    • 즉, noisy/overlapped speech를 manually simulate 하고 masked region에서 pseudo-label을 predict 함
    • 먼저 self-supervised pre-training을 위해 다양한 background noise와 speaker를 가지는 noisy speech를 활용함
      1. 이를 위해 각 training batch에서 some utterance를 randomly select 하고 random region에서 selected noise, secondary utterance를 mix 함
        - Noise audio, secondary utterance는 same batch에서 randomly select, crop, scale 됨
      2. 이때 overlap region이 50% 이하가 되도록 하여 first utterance의 speaker를 main speaker로 사용함
      3. 이후 masked speech denoising, prediction task를 통해 WavLM은 noisy/overlapped speech를 identify 하고 mask prediction loss를 통해 main speaker에 대한 content predict 함
  • Noisy/Overlapped Speech Simulation
    • Noisy/overlapped speech simulation은 아래 [Algorithm 1]을 따름
    • 먼저 batch size $B$, length $L$의 speech utterance batch $\mathbf{U}=\{\mathbf{u}^{i}\}_{i=1}^{B}$와 size $M$의 Deep Noise Suppression (DNS) noise $\mathbf{N}=\{\mathbf{n}^{i}\}_{i=1}^{M}$이 주어진다고 하자
      - 이때 probability $p$의 Bernoulli sampling을 통해 $S$ utterance $\mathbf{U}^{S}=\{\mathbf{u}^{i}\}_{i=1}^{S}$를 randomly choice 함
    • 다음으로 각 utterance $\mathbf{u}^{\text{pri}}\in\mathbf{U}^{S}$에 대해 continuous uniform distribution $\mathcal{U}(0,1)$에 대한 random value $v$를 sampling 하여 noise/secondary utterance에 대한 mix 여부를 결정함
      1. Random value $v$가 mixing noise probability $p_{n}$보다 크면:
        - Batch $\mathbf{U}$에 대한 discrete uniform distribution에서 secondary utterance $\mathbf{u}^{\text{sec}}$를 sampling 하고,
        - Uniform distribution $\mathcal{U}(-5,5)$에서 mixing energy ratio $r$을 randomly sampling 함
      2. 그렇지 않은 경우:
        - DNS noise set $\mathbf{N}$에 대한 discrete uniform distribution에서 noise $\mathbf{u}^{\text{sec}}$를 sampling 하고,
        - Uniform distribution $\mathcal{U}(-5,20)$에서 mixing energy ratio $r$을 randomly sampling 함
    • 이후 uniform distribution에서 utterance에 대한 mixing region을 randomly select 함
      - Mixing length $l$은 $\{1,...,\frac{L}{2}\}$에서 uniformly sampling 되고 utterance $\mathbf{u}^{\text{pri}},\mathbf{u}^{\text{sec}}$에 대한 start position $s^{\text{pri}},s^{\text{sec}}$는 $\{1,...,L-1\}$에서 uniformly sampling 됨
    • 다음으로 primary utterance $\mathbf{u}^{\text{pri}}[s^{\text{pri}}:s^{\text{pri}}+l]$와 secondary utterance $\mathbf{u}^{\text{sec}}[s^{\text{sec}}:s^{\text{sec}}+l]$의 mixing region이 주어지면, primary/secondary utterance energy $E^{\text{pri}}, E^{\text{sec}}$와 함께 secondary utterance의 mixing scale $scl$을 계산함
    • 최종적으로 primary utterance $\mathbf{u}^{\text{pri}}[s^{\text{pri}}:s^{\text{pri}}+l]$의 selected region을 mixing scale $scl$로 scale 된 secondary utterance $\mathbf{u}^{\text{sec}}[s^{\text{sec}}:s^{\text{sec}}+l]$과 mix 함
  • Mask Prediction Loss
    • 논문은 mask prediction loss를 통해 network를 optimize 함
    • Utterance $\mathbf{u}$와 simulated version $\mathbf{u}'$이 있다고 하면, last iteration network에 $\mathbf{u}$를 전달하여 pseudo-label $\mathbf{z}$를 얻을 수 있음
      1. 이때 MFCC에 대한 $k$-means clustering이나 latent representation을 pseudo-label로 사용함
      2. 그러면 current network에 $\mathbf{u}'$을 전달하여 hidden state $\mathbf{h}_{t}^{L}$을 얻을 수 있음
    • 결과적으로 WavLM은 다음의 objective를 optimize함:
      (Eq. 7) $\mathcal{L}=-\sum_{l\in K}\sum_{t\in M}\log p(z_{t}|\mathbf{h}_{t}^{L})$
      - $M$ : time-domain의 masked index set, $\mathbf{h}_{t}^{L}$ : step $t$의 $L$-layer Transformer output

Noisy/Overlapped Speech Simulation

- Pre-Training Data

  • 논문은 robustness를 향상하기 위해 다양한 domain의 large-scale unsupervised data를 활용함
    • 기존의 LibriSpeech, LibriLight와 같은 dataset은 input data가 audiobook에서 추출되므로 pre-trained model의 generalization capability를 제한하기 때문
    • 따라서 논문은 GigaSpeech, VoxPopuli dataset을 추가하여 94k hours의 training dataset을 구성함
      - 해당 enriched dataset은 다양한 audio background, speaker, content를 가지고 있으므로 model robustness를 크게 향상할 수 있음

- Stabilization of Training

  • 일반적으로 16-bit float precision $\text{fp16}$이나 mixed precision을 사용하여 large model을 pre-training 함
    • BUT, $\text{NaN}$ loss와 같은 overflow 문제로 인해 unstable training의 문제가 있음
      - 특히 attention score $\frac{\mathbf{q}_{i}\cdot \mathbf{k}_{j}}{\sqrt{d}}$가 $\text{fp16}$의 upper bound value 보다 커지는 경우 overflow가 발생함
    • 따라서 논문은 overflow를 방지하기 위해 다음의 trick을 적용함
      1. 먼저 softmax는 각 coordinate에서 same value로 translate시 invariant 함
      2. 즉, $\text{softmax}(\mathbf{x}+\alpha)_{k}=\text{softmax}(\mathbf{x})_{k}$
        - $\alpha$ : constant
      3. 그러면 (Eq. 3):
        (Eq. 8) $\alpha_{i,j}\propto\exp\left\{\frac{\mathbf{q}_{i}\cdot \mathbf{k}_{j}}{\sqrt{d}}+r_{i-j} \right\}=\exp\left\{\left( \frac{\mathbf{q}_{i}}{c\sqrt{d}}\cdot \mathbf{k}_{j}-\max_{j'\leq T} \left( \frac{\mathbf{q}_{i}}{c\sqrt{d}}\cdot \mathbf{k}_{j'}\right)\right)\times c +r_{i-j} \right\}$
        - $c=32$ : scale hyperparameter
    • 이를 통해 $\max_{j'\leq T} \left( \frac{\mathbf{q}_{i}}{c\sqrt{d}}\cdot \mathbf{k}_{j'}\right)$의 최댓값은 $2^{16}$ 보다 작다는 것을 보장할 수 있으므로 overflow 문제를 해결할 수 있음

4. Experiments

- Settings

Datasets

- Results

  • Universal Representation Evaluation
    • 각 downstream task에 대해 WavLM이 가장 우수한 성능을 달성함

Universal Representation Evaluation

  • 특히 bottom layer는 speaker identification, speaker verification, speaker diarization 등에 효과적임
    - Top layer는 content, semantic task에 유용함

Weight Analysis

  • Speaker Verification
    • Speaker verification task에 대해서도 WavLM이 효과적임

Speaker Verification

  • Speaker Diarization
    • 마찬가지로 diarization에서도 WavLM이 가장 우수한 성능을 달성함

Speaker Diarization

  • Speech Separation
    • WavLM은 Speech Separation에서도 우수한 성능을 보임

Speech Separation

  • 마찬가지로 각 task에 대한 contribute는 bottom layer에서 발생함

Speaker Verification (SV), Diarization (SD), Separation (SS)에 대한 Weight Analysis

  • Speech Recognition
    • Speech recognition task에서도 WavLM이 가장 적합함

Speech Recognition

  • Pre-training을 활용하는 경우 더 나은 성능을 얻을 수 있음

Labeled Data에 대한 성능

 

반응형
댓글
최근에 올라온 글
최근에 달린 댓글
«   2025/07   »
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 31
Total
Today
Yesterday