AI Logic

Architectures

BigVGAN

Updated:

The architecture of BigVGAN. On the left, the 112M generator (100-band mel spectrogram → convolution → six stages of transposed convolution with upsampling factors 4, 4, 2, 2, 2, 2 and AMP → Snake, convolution, tanh → 24 kHz waveform). In the center, the inside of AMP (as in HiFi-GAN's MRF, residual blocks with kernel sizes 3, 7, and 11 run in parallel and are summed, with an anti-aliased Snake before each convolution). On the right, the anti-aliased Snake (a plot of the Snake function and the flow of 2× upsampling → Snake → 1/2 downsampling)

Background and Overview

BigVGAN is a GAN vocoder aiming to be a "universal" vocoder that works for any speaker, language, or recording environment without fine-tuning. It was published in 2022 by Lee et al. at NVIDIA and Seoul National University (ICLR 2023). Like HiFi-GAN, it generates waveforms from mel spectrograms, and it builds on HiFi-GAN's generator.

GAN vocoders such as MelGAN and HiFi-GAN can generate high-quality waveforms on a GPU hundreds of times faster than real time. However, their quality drops sharply outside the speakers heard in training and outside clean recordings. Real-world uses, such as multi-speaker speech synthesis, voice cloning, voice conversion, and decoding for neural audio codecs, require vocoders that remain robust on audio from conditions not seen in training (out-of-distribution).

BigVGAN addresses this challenge with three ideas.

  • A periodic activation function (Snake): since audio waveforms are superpositions of periodic components, the activation function itself is made periodic, so that the generator can produce periodic patterns more easily.
  • Anti-aliasing: the high-frequency components produced by Snake that a discrete signal cannot represent are removed with a low-pass filter. The building block that combines these two is called AMP (anti-aliased multi-periodicity composition).
  • Large-scale training: the generator is scaled up to 112 million parameters, and training collapse is kept in check through the learning rate, batch size, and gradient clipping.

BigVGAN, trained only on LibriTTS speech, was rated closer to the original audio than HiFi-GAN and others across unseen speakers, unseen languages, noisy recordings, singing voices, and musical instruments.

Architecture

BigVGAN consists of a generator in which HiFi-GAN's activation functions are replaced with the "anti-aliased Snake", together with a multi-period discriminator (MPD) and a multi-resolution discriminator (MRD). In the figure at the top of this article, the left shows the generator, the center shows the inside of AMP, and the right shows the anti-aliased Snake.

The Snake function is a periodic activation function proposed by Ziyin et al. for forecasting time series such as temperature and financial data.

fα(x)=x+1αsin⁡2(αx)f_\alpha(x) = x + \frac{1}{\alpha} \sin^2(\alpha x)

α\alpha is a learnable parameter that sets the frequency of the periodic component (the larger it is, the higher the frequency). BigVGAN gives each convolution channel its own α\alpha, so that each channel can learn a different period. Because it uses sin⁡2\sin^2, the function is monotonically increasing, which also makes it easy to optimize.

The anti-aliased Snake prevents the high-frequency components produced by Snake from turning into aliasing (folded-back noise).

  1. The signal is upsampled by a factor of 2 along the time axis.
  2. The Snake function is applied.
  3. The signal is downsampled by 1/2 back to its original length.

The upsampling and downsampling use a low-pass filter based on a Kaiser-windowed sinc function. Following the same idea as StyleGAN3, the cutoff frequency is s/(2m)s/(2m) (where ss is the sampling rate and m=2m = 2 is the upsampling ratio), and the window length is 6m6m.

AMP is HiFi-GAN's MRF with the Leaky ReLUs replaced by anti-aliased Snakes. Three residual blocks with kernel sizes 3, 7, and 11 run in parallel and their outputs are summed; each residual block stacks [anti-aliased Snake → dilated convolution with dilation dd → anti-aliased Snake → convolution with dilation 1 → add the input] three times with d=1,3,5d = 1, 3, 5.

The overall generator is as follows.

  1. Input: a 100-band log-mel spectrogram (0–12 kHz) is taken in by a convolution of width 7 with hh channels.
  2. Upsampling blocks × NN: each block consists of a transposed convolution that halves the channels, followed by AMP.
  3. Output: Snake, a convolution of width 7 with 1 channel, and tanh produce the waveform.

The paper compares two sizes.

ModelParametersChannels hhUpsampling factorsAMP kernel sizesDilations
BigVGAN-base14.01 M5128, 8, 2, 2 (256× in total)3, 7, 11[[1, 1], [3, 1], [5, 1]] in each block
BigVGAN112.4 M1,5364, 4, 2, 2, 2, 2 (256× in total)3, 7, 11Same

BigVGAN-base has the same configuration as HiFi-GAN V1, with only the activation functions changed. BigVGAN splits upsampling into six stages that refine the resolution gradually, and increases the channels to 1,536.

For discriminators, BigVGAN uses HiFi-GAN's multi-period discriminator (MPD, periods 2, 3, 5, 7, 11) and replaces the multi-scale discriminator (MSD) with a multi-resolution discriminator (MRD). MRD, proposed in UnivNet, converts the waveform into linear spectrograms with three settings (FFT size, hop, and window length of [1024, 120, 600], [2048, 240, 1200], and [512, 50, 240]) and judges each with 2D convolutions. The paper reports that replacing MSD with MRD reduces pitch and periodicity errors and improves audio quality.

The loss is the same as HiFi-GAN's. The least-squares GAN loss, the discriminator feature-matching loss LfmL_{\mathrm{fm}}, and the mel-spectrogram L1 loss LmelL_{\mathrm{mel}} are summed with λfm=2\lambda_{\mathrm{fm}} = 2 and λmel=45\lambda_{\mathrm{mel}} = 45 (DkD_k is each discriminator of MPD and MRD, ss is the mel spectrogram, and xx is the ground-truth waveform).

LG=∑k=1K[Ladv(G;Dk)+λfmLfm(G;Dk)]+λmelLmel(G),LD=∑k=1KLadv(Dk;G)L_G = \sum_{k=1}^{K}\left[L_{\mathrm{adv}}(G; D_k) + \lambda_{\mathrm{fm}} L_{\mathrm{fm}}(G; D_k)\right] + \lambda_{\mathrm{mel}} L_{\mathrm{mel}}(G), \qquad L_D = \sum_{k=1}^{K} L_{\mathrm{adv}}(D_k; G) Ladv(G;Dk)=Es[(Dk(G(s))−1)2],Ladv(Dk;G)=E(x,s)[(Dk(x)−1)2+(Dk(G(s)))2]L_{\mathrm{adv}}(G; D_k) = \mathbb{E}_s\left[(D_k(G(s)) - 1)^2\right], \qquad L_{\mathrm{adv}}(D_k; G) = \mathbb{E}_{(x, s)}\left[(D_k(x) - 1)^2 + (D_k(G(s)))^2\right]

Why It Is Robust to Unseen Audio

The key point of BigVGAN is that it builds the assumption that "audio consists of periodic components" (an inductive bias) into the generator, enabling it to extrapolate to frequencies and timbres not seen in training.

Generators such as HiFi-GAN's could only learn periodic components by stacking dilated convolutions. Their activation function, Leaky ReLU, is piecewise linear and carries no cue for periodicity. The paper reports that generators with Leaky ReLU produce speech well in recording environments heard in training, but their quality drops sharply for unseen recording environments, non-speech sounds, and musical instruments. Snake has a periodic shape in itself, so it can keep producing periodic patterns even outside the training range.

As an analogy, the Snake function is a straight slope (y=xy = x) with small steps (sin⁡2\sin^2) added at regular intervals. The step interval is set by α\alpha, and since each channel learns a different interval, sounds with many different periods can be built by superposing them. Thanks to the slope, the output is not confined to a fixed range even for large inputs, retaining the ease of use of ReLU.

However, Snake also produces very high-frequency components that a discrete signal (a sampled waveform) cannot represent. These become aliasing and create noise in the high range, so Snake is applied at twice the resolution, the high frequencies are removed with a low-pass filter, and the signal is then returned to its original resolution.

The roles of the other techniques are as follows.

TechniqueWhat it doesWhat it helps with
Snake functionGives the activation function a periodicity learned per channelBetter extrapolation to unseen audio. Removing it lowers SMOS on MUSDB18-HQ
Low-pass filterUpsamples 2× around Snake and back, removing high frequenciesReduces high-range noise caused by aliasing
MRDJudges spectrograms at three resolutionsReduces pitch and periodicity errors
Larger modelScales up to 112M parametersMakes use of diverse training data and gets closer to the original audio
Diverse training dataTrains on all of LibriTTS (including noisy recordings)Better robustness to unseen recording environments

To train the large model stably, the paper uses the following techniques.

  • Halve the learning rate: with HiFi-GAN's learning rate of 2×10−42 \times 10^{-4}, the discriminator loss dropped to 0 within a few thousand updates and training collapsed, so it was lowered to 1×10−41 \times 10^{-4}.
  • Double the batch size: increasing it from the usual 16 to 32 made training less prone to collapse.
  • Gradient clipping: the anti-aliased Snake amplified the gradients from MPD, and the generator's gradients diverged early in training, so the global gradient norm was clipped at 10310^3.

Experimental Results

The paper trains all models, including the baselines, on the full 24 kHz LibriTTS training data (train-clean-100, train-clean-360, and train-other-500, including noisy recordings). The mel spectrogram uses 100 bands over 0–12 kHz rather than the usual 0–8 kHz, with an FFT and window length of 1,024 and a hop of 256. BigVGAN is trained for 1 million steps with a batch size of 32, segments of 8,192 samples, and an initial learning rate of 1×10−41 \times 10^{-4}; the other settings (such as AdamW) follow the official HiFi-GAN implementation.

For subjective evaluation, SMOS (a 5-point rating of how similar the audio sounds when compared with the ground-truth recording) is used in addition to MOS. For a universal vocoder, MOS alone can give high scores even to "a natural but average voice that differs from the original speaker."

Model size and speed (24 kHz, RTX 8000 GPU; how many times faster than real time)

ModelParametersSynthesis speed
WaveGlow99.43 M31.87×
WaveFlow22.58 M19.59×
HiFi-GAN (V1)14.01 M93.75×
BigVGAN-base14.01 M70.18×
BigVGAN-base (no filter)14.01 M75.83×
BigVGAN112.4 M44.72×

Evaluation on LibriTTS (objective metrics on dev, subjective evaluation on test; both with speakers not heard in training)

ModelM-STFT (↓)PESQ (↑)MCD (↓)Periodicity error (↓)V/UV F1 (↑)MOSSMOS
Ground truth−−−−−4.40 ± 0.064.44 ± 0.06
SC-WaveRNN2.23581.7011.88540.30440.81443.20 ± 0.113.29 ± 0.10
WaveGlow-2561.30993.1382.35910.14850.93783.84 ± 0.103.87 ± 0.10
WaveFlow-1281.11203.0271.24550.14160.94103.85 ± 0.103.89 ± 0.10
HiFi-GAN (V1)1.00172.9470.66030.15650.93004.08 ± 0.094.15 ± 0.09
BigVGAN-base0.87883.5190.45640.12870.94594.10 ± 0.094.20 ± 0.08
BigVGAN0.79974.0270.37450.10180.95984.11 ± 0.094.26 ± 0.08

The MOS difference between HiFi-GAN and BigVGAN is small, but on SMOS, which compares against the ground truth, BigVGAN is ahead by 0.11.

SMOS on unseen languages and recording environments

ModelClean recordings (Javanese, Khmer, Nepali, Sundanese)Recordings with added noise (Spanish, French, Italian, Portuguese)Real noisy recordings (Korean)
Ground truth4.58 ± 0.054.36 ± 0.054.56 ± 0.05
UnivNet-c324.35 ± 0.073.95 ± 0.094.18 ± 0.08
HiFi-GAN (V1)4.39 ± 0.074.13 ± 0.084.21 ± 0.08
BigVGAN-base4.38 ± 0.074.21 ± 0.074.36 ± 0.07
BigVGAN4.41 ± 0.074.26 ± 0.074.38 ± 0.07

(UnivNet-c32 uses publicly released weights trained on train-clean-360.)

SMOS on music (MUSDB18-HQ)

ModelVocalsDrumsBassOther instrumentsMixtureAverage
Ground truth4.58 ± 0.054.57 ± 0.054.52 ± 0.054.61 ± 0.054.56 ± 0.054.57 ± 0.02
UnivNet-c324.22 ± 0.094.23 ± 0.093.90 ± 0.113.80 ± 0.133.80 ± 0.123.99 ± 0.05
HiFi-GAN (V1)4.26 ± 0.084.37 ± 0.083.95 ± 0.113.92 ± 0.123.91 ± 0.114.08 ± 0.05
BigVGAN-base4.36 ± 0.084.39 ± 0.074.00 ± 0.114.14 ± 0.094.11 ± 0.104.20 ± 0.04
BigVGAN-base (no filter)4.30 ± 0.084.32 ± 0.073.95 ± 0.114.05 ± 0.104.11 ± 0.104.15 ± 0.04
BigVGAN-base (no filter, no Snake)4.31 ± 0.084.32 ± 0.073.94 ± 0.114.01 ± 0.114.02 ± 0.104.12 ± 0.04
BigVGAN4.37 ± 0.084.41 ± 0.074.00 ± 0.104.25 ± 0.094.26 ± 0.084.26 ± 0.04

Removing the filter lowers the average from 4.20 to 4.15, and also removing Snake (equivalent to HiFi-GAN with MRD) lowers it to 4.12. The gaps are large for vocals, other instruments, and mixtures, and small for drums and bass.

Diversity of training data (the 112M BigVGAN; objective metrics on LibriTTS dev-other, SMOS on test-other)

Training dataM-STFT (↓)PESQ (↑)MCD (↓)Periodicity error (↓)V/UV F1 (↑)SMOS
All of LibriTTS0.81974.0010.40970.10230.95864.38 ± 0.07
LibriTTS train-clean-3600.84293.8470.42320.11490.95214.31 ± 0.08
VCTK0.87473.8180.59210.12150.94904.27 ± 0.08

In a listening comparison against a HiFi-GAN of the same 112M size (MUSDB18-HQ mixtures), 58% of the ratings preferred BigVGAN.

Practical Considerations

Keep the following points in mind when using BigVGAN.

  • Match the mel-spectrogram settings: BigVGAN is trained on 100-band mel spectrograms over 0–12 kHz (24 kHz, FFT 1,024, hop 256). The output of the upstream speech synthesis model must match these settings. They differ from the HiFi-GAN settings trained on 80 bands over 0–8 kHz.
  • Trade-off with speed: the anti-aliased Snake adds computation, so BigVGAN-base (70.18×) is slower than a HiFi-GAN of the same size (93.75×). Even the 112M BigVGAN runs about 45 times faster than real time on a GPU.
  • Training large models is prone to collapse: the paper recommends three measures: lowering the learning rate to 1×10−41 \times 10^{-4}, using a batch size of 32, and clipping the gradient norm at 10310^3.

The paper reports that many techniques commonly used in large-scale GAN training backfired for audio. Spectral Normalization stabilized training but weakened the gradients from MPD too much, increasing phase-mismatch artifacts. SpecAugment produced overly smooth audio, and Mixup produced audio with two voices mixed together. Applying the filter to the upsampling layers as well, using Snake in the discriminators, and increasing the channels to 2,048 also led to training collapse or degraded audio quality.

Comparison with Other Vocoders

Comparing BigVGAN with other vocoders from the same perspective gives the following. The numbers are from the BigVGAN paper's evaluation on LibriTTS (24 kHz, RTX 8000 GPU).

ModelGeneration methodGenerator activationDiscriminatorsParametersSynthesis speedSMOS
WaveGlowNormalizing flow (parallel)−None99.43 M31.87×3.87 ± 0.10
HiFi-GAN (V1)GAN generator (parallel)Leaky ReLUMPD + MSD14.01 M93.75×4.15 ± 0.09
BigVGAN-baseGAN generator (parallel)Anti-aliased SnakeMPD + MRD14.01 M70.18×4.20 ± 0.08
BigVGANGAN generator (parallel)Anti-aliased SnakeMPD + MRD112.4 M44.72×4.26 ± 0.08

Rough guidelines for choosing:

  • Handling unseen speakers, languages, recording environments, and even singing voices or instruments: BigVGAN fits. Without fine-tuning, it produces waveforms closer to the original audio than HiFi-GAN.
  • Maximizing speed for speech from fixed speakers only: HiFi-GAN fits. At the same size it is faster than BigVGAN-base, and for speech from fixed speakers the MOS gap is also small.
  • Keeping the generator small: BigVGAN-base has the same number of parameters as HiFi-GAN V1 and beats HiFi-GAN on every objective metric.

The paper also cites speech synthesis models that use the HiFi-GAN generator as a decoder, such as VITS, and neural audio codecs such as SoundStream and EnCodec, as applications for a universal vocoder.

PyTorch example

Show code
python
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.parametrizations import weight_norm

"""
A small implementation of the core components of the BigVGAN generator (Snake, anti-aliased Snake, AMP), following Sections 3.2 and 3.3 and Appendix A of the paper.
PyTorch has no built-in BigVGAN (the authors' official implementation and pre-trained models are at NVIDIA/BigVGAN on GitHub).
The discriminators (MPD, MRD) and losses are almost the same as the implementation in the HiFi-GAN article (MRD is used instead of MSD).
"""


class Snake(nn.Module):
    """f_α(x) = x + sin²(αx) / α. α is learned per channel"""
    def __init__(self, channels):
        super().__init__()
        self.alpha = nn.Parameter(torch.ones(1, channels, 1))

    def forward(self, x):
        return x + torch.sin(self.alpha * x) ** 2 / (self.alpha + 1e-9)


def kaiser_sinc_filter(m=2):
    """Low-pass filter from Appendix A: cutoff 1/(2m) (relative to the sampling rate), window length 6m, transition half-width 0.6/m"""
    n, cutoff, half_width = 6 * m, 0.5 / m, 0.6 / m
    A = 2.285 * (n / 2 - 1) * math.pi * 4 * half_width + 7.95      # maximum attenuation
    beta = 0.1102 * (A - 8.7)
    window = torch.kaiser_window(n, periodic=False, beta=beta)
    t = torch.arange(n) - (n - 1) / 2
    filt = 2 * cutoff * torch.sinc(2 * cutoff * t) * window
    return (filt / filt.sum()).view(1, 1, n)


class AntiAliasedSnake(nn.Module):
    """2x upsampling (low-pass filter) → Snake → 1/2 downsampling (low-pass filter)"""
    def __init__(self, channels, m=2):
        super().__init__()
        self.m, self.act = m, Snake(channels)
        self.register_buffer("filt", kaiser_sinc_filter(m))

    def forward(self, x):
        C, k = x.shape[1], self.filt.shape[-1]
        f = self.filt.expand(C, 1, k)
        T = x.shape[-1]
        up = F.conv_transpose1d(x, f * self.m, stride=self.m, groups=C)          # insert zeros to double the length, then interpolate with the filter
        start = (k - self.m) // 2
        up = up[..., start:start + T * self.m]
        y = self.act(up)
        y = F.pad(y, (k // 2 - 1, k // 2), mode="replicate")
        return F.conv1d(y, f, stride=self.m, groups=C)[..., :T]                   # filter, then decimate


class AMPBlock(nn.Module):
    """[anti-aliased Snake → conv with dilation d → anti-aliased Snake → conv with dilation 1 → add input], 3 times with d = 1, 3, 5"""
    def __init__(self, ch, k, dilations=(1, 3, 5)):
        super().__init__()
        pad = lambda d: (k * d - d) // 2
        self.c1 = nn.ModuleList(weight_norm(nn.Conv1d(ch, ch, k, dilation=d, padding=pad(d))) for d in dilations)
        self.c2 = nn.ModuleList(weight_norm(nn.Conv1d(ch, ch, k, padding=pad(1))) for _ in dilations)
        self.a1 = nn.ModuleList(AntiAliasedSnake(ch) for _ in dilations)
        self.a2 = nn.ModuleList(AntiAliasedSnake(ch) for _ in dilations)

    def forward(self, x):
        for c1, c2, a1, a2 in zip(self.c1, self.c2, self.a1, self.a2):
            x = x + c2(a2(c1(a1(x))))
        return x


class Generator(nn.Module):
    def __init__(self, n_mels=100, h=512, ups=(8, 8, 2, 2), kernels=(3, 7, 11)):   # BigVGAN-base. The 112M model uses h=1536, ups=(4, 4, 2, 2, 2, 2)
        super().__init__()
        self.pre = weight_norm(nn.Conv1d(n_mels, h, 7, padding=3))
        self.ups, self.amps = nn.ModuleList(), nn.ModuleList()
        for i, u in enumerate(ups):
            cin, cout = h // 2 ** i, h // 2 ** (i + 1)
            self.ups.append(weight_norm(nn.ConvTranspose1d(cin, cout, 2 * u, u, padding=u // 2)))
            self.amps.append(nn.ModuleList(AMPBlock(cout, k) for k in kernels))
        self.act = AntiAliasedSnake(h // 2 ** len(ups))
        self.post = weight_norm(nn.Conv1d(h // 2 ** len(ups), 1, 7, padding=3))

    def forward(self, mel):
        x = self.pre(mel)
        for up, amp in zip(self.ups, self.amps):
            x = up(x)
            x = sum(b(x) for b in amp)                   # sum of 3 blocks with different receptive fields
        return torch.tanh(self.post(self.act(x)))


G = Generator()
mel = torch.randn(1, 100, 32)                            # 100-band, 0-12 kHz mel spectrogram
wave = G(mel)                                            # [1, 1, 32 × 256]
print(wave.shape)

# Training settings (Section 3.4 of the paper): learning rate 1e-4, batch 32, clip the global gradient norm at 1e3
opt_g = torch.optim.AdamW(G.parameters(), lr=1e-4, betas=(0.8, 0.99))
loss = wave.abs().mean()                                 # in practice: least-squares GAN + 2 × feature matching + 45 × mel L1
loss.backward()
torch.nn.utils.clip_grad_norm_(G.parameters(), max_norm=1e3)
opt_g.step()

FAQ

Q. What is the difference between BigVGAN and HiFi-GAN?
A.

There are three main differences.

  • Activation function: the generator's Leaky ReLU is replaced with the "anti-aliased Snake," which combines the periodic Snake function with a low-pass filter
  • Discriminators: a multi-resolution discriminator (MRD) is used instead of the multi-scale discriminator (MSD)
  • Size: the model is scaled up to as many as 112M parameters, with training stabilized through the learning rate, batch size, and gradient clipping

The generator layout (transposed convolutions and a block that runs residual blocks with different receptive fields in parallel) and the losses are the same as in HiFi-GAN.

Q. What does α in the Snake function represent?
A.

The frequency of the periodic component. The sin⁡2(αx)\sin^2(\alpha x) term in fα(x)=x+sin⁡2(αx)/αf_\alpha(x) = x + \sin^2(\alpha x)/\alpha oscillates faster as α\alpha grows. BigVGAN learns a separate α\alpha for each convolution channel, so each channel handles a pattern with a different period, and superposing them produces a wide range of sounds.

Q. How can it generate singing voices and music when the training data contains none?
A.

Because the periodic activation function gives the generator the property that "audio consists of periodic components." A generator with Leaky ReLU struggles to produce periodic patterns outside the training range, whereas Snake can extrapolate beyond it while preserving periodicity. In the paper's evaluation on music (MUSDB18-HQ), removing both Snake and the filter lowered the average SMOS from 4.20 to 4.12.

References

  1. Lee, S., Ping, W., Ginsburg, B., Catanzaro, B., & Yoon, S. (2023). BigVGAN: A Universal Neural Vocoder with Large-Scale Training. ICLR 2023. arXiv:2206.04658.
  2. NVIDIA. Official BigVGAN implementation and pre-trained models.
  3. BigVGAN audio samples (by the paper's authors)
  4. Ziyin, L., Hartwig, T., & Ueda, M. (2020). Neural Networks Fail to Learn Periodic Functions and How to Fix It. NeurIPS 2020. arXiv:2006.08195.
  5. Kong, J., Kim, J., & Bae, J. (2020). HiFi-GAN: Generative Adversarial Networks for Efficient and High Fidelity Speech Synthesis. NeurIPS 2020. arXiv:2010.05646.