HiFi-GAN

On this page 7

HiFi-GAN is a neural vocoder based on a generative adversarial network that converts a mel spectrogram into a raw speech waveform with high fidelity and very high speed. Introduced in 2020 by Jungil Kong, Jaehyeon Kim and Jaekyoung Bae, it became one of the most widely used vocoders in Speech & language AI because it matched the perceived quality of autoregressive models such as WaveNet while generating audio hundreds of times faster than real time on a GPU.

In a typical text-to-speech system, an acoustic model such as Tacotron or FastSpeech predicts a mel spectrogram from text, and HiFi-GAN performs the final step of waveform synthesis. The same model is also used in voice conversion, speech enhancement and speech-to-speech translation, wherever a spectral representation must become audible sound.

How HiFi-GAN generates a waveform

HiFi-GAN works by upsampling a mel spectrogram through a stack of transposed convolutions until each spectrogram frame expands into hundreds of audio samples. With a hop size of 256 samples at 22.05 kHz, the generator must increase the time resolution by a factor of 256, typically in four stages such as 8, 8, 2 and 2.

After each upsampling layer, the generator applies a multi-receptive field fusion module, abbreviated MRF. It runs several residual blocks in parallel with different kernel sizes and dilation rates and averages their outputs. This lets the network model short periodic patterns and longer temporal structure at the same time, which is crucial because speech mixes harmonic voiced sounds with noisy consonants.

Generation is fully parallel and non-autoregressive: every output sample is computed in one forward pass instead of one at a time. That design choice is the main reason HiFi-GAN is so much faster than WaveNet, which predicts each sample conditioned on all previous ones.

The input carries magnitude information only. A mel spectrogram discards phase and compresses high frequencies into fewer bands, so the generator must infer plausible phase and fine spectral detail on its own. This is why vocoder quality depends so strongly on what the network learned during training: it reconstructs information that is not present in its input. Most public checkpoints expect 80 mel bands covering roughly 0 to 8 kHz or 0 to 11 kHz, and a model trained for one band layout cannot simply be reused with another.

Discriminators and training losses

The quality of HiFi-GAN comes largely from its two complementary discriminators, which judge whether audio is real or generated from different viewpoints. Each one is a group of sub-discriminators trained jointly with the generator.

DiscriminatorHow it views audioWhat it catches
Multi-period discriminatorReshapes audio into 2D grids with periods 2, 3, 5, 7 and 11Errors in periodic, pitch-related structure
Multi-scale discriminatorAnalyzes raw, 2x and 4x downsampled audioErrors in overall waveform shape and continuity
The two discriminator families in HiFi-GAN

The periods 2, 3, 5, 7 and 11 are prime numbers chosen to minimize overlap between sub-discriminators, so together they inspect many different periodic patterns. The multi-scale discriminator was adopted from the earlier MelGAN vocoder.

Training combines three loss terms, summarized below. The mel-spectrogram loss stabilizes early training, while the adversarial and feature matching losses push the output toward natural detail.

LossDefinitionTypical weight
Adversarial lossLeast-squares GAN objective1
Feature matching lossL1 distance between discriminator feature maps2
Mel-spectrogram lossL1 distance between real and generated mel spectrograms45
Loss functions used to train HiFi-GAN

Model variants and their trade-offs

The original work defined three generator configurations that share the same discriminators but differ in width and kernel layout. They let engineers choose between maximum fidelity and minimum compute.

VariantApproximate parametersBest suited for
V1About 14 millionHighest quality, server GPUs
V2About 0.9 millionSmall footprint, embedded or CPU use
V3About 1.5 millionFastest synthesis with good quality
HiFi-GAN generator variants

In the original listening tests on the single-speaker LJSpeech dataset, V1 reached a mean opinion score close to that of human recordings, while V2 and V3 traded a small quality loss for much lower cost. Exact scores depend on the dataset, the listening panel and the acoustic model feeding the vocoder, so published numbers should be read as relative rankings rather than fixed guarantees.

HiFi-GAN compared with other neural vocoders

HiFi-GAN occupies a middle position among neural vocoders: faster than autoregressive and diffusion models, and higher in quality than earlier GAN vocoders. The table compares it with common alternatives.

VocoderApproachSpeedMain limitation
WaveNetAutoregressive sample-by-sample modelVery slowImpractical without heavy optimization
WaveGlowNormalizing flowFast on GPULarge model, high memory use
MelGANGAN with multi-scale discriminatorVery fastAudible artifacts in voiced speech
HiFi-GANGAN with period and scale discriminatorsVery fastWeaker on unseen voices and music
BigVGANScaled GAN with periodic activationsFastLarger and costlier to train
HiFi-GAN and related vocoder families

HiFi-GAN also serves as the waveform decoder inside end-to-end systems such as VITS, where it is trained jointly with the rest of the model instead of as a separate stage.

Practical deployment and limitations

The most important practical rule is that the vocoder and the acoustic model must agree on every spectrogram parameter: sample rate, FFT size, hop size, number of mel bands and frequency range. A mismatch produces metallic, buzzing or muffled audio even when both models are individually well trained.

  • Fine-tune on predicted spectrograms from the target acoustic model, because they are smoother than ground-truth spectrograms and cause artifacts if the vocoder has never seen them.
  • Expect degraded quality on unseen speakers, singing, whispering and non-speech sounds unless the training data covers them.
  • Watch for typical artifacts: metallic buzz, phase smearing in high frequencies and clicks at chunk boundaries in streaming setups.
  • Use a universal vocoder checkpoint trained on many speakers when the target voice has little data.

Despite newer models, HiFi-GAN remains a strong default baseline because it is well understood, easy to train on a single GPU and fast enough for real-time synthesis on modest hardware.

The idea in brief

A speech system first writes a kind of sound blueprint. This blueprint shows which pitches are loud at each moment. It is not sound yet. HiFi-GAN turns that blueprint into real audio you can hear.

It learns this skill through a contest. One network makes audio. Other networks try to spot the fake. Over time, the maker gets so good that the result sounds natural. It also works very quickly, so a voice assistant can answer without delay.

A practical scenario

A public transport operator builds a text-to-speech system for station announcements in two languages. The team trains an acoustic model on 20 hours of recordings from one professional voice actor, then pairs it with a HiFi-GAN V1 vocoder pretrained on a multi-speaker corpus.

First tests sound slightly metallic, because the vocoder has only seen clean ground-truth spectrograms. The engineers fine-tune HiFi-GAN for about 100,000 steps on spectrograms predicted by their own acoustic model, using the same 22.05 kHz sample rate, 80 mel bands and hop size of 256.

After fine-tuning, listeners in a blind test rate the announcements as nearly indistinguishable from the original recordings. A single server GPU now generates each announcement in a fraction of a second, so dynamic messages about delays play without noticeable lag.