home/ atoms/ shift-trick-test-time-augmentation

Averaging predictions over multiple time-shifted inputs (the shift trick) improves separation quality

A trained separation model is not perfectly time-equivariant: presenting the same audio shifted by a few milliseconds can yield slightly different outputs. The shift trick (test-time augmentation) exploits this: --shifts=N randomly shifts the input up to 0.5 seconds N times, runs the model on each version, reverses the shifts, then averages predictions. This makes the combined predictor time-equivariant and improves SDR by up to 0.2 dB. The cost is N× slower inference, so it is only practical on a GPU.

Examples

# Run with 5 random shifts (5x slower, slightly better):
demucs --shifts=5 mytrack.mp3

Assessment

Why does averaging shifted predictions improve SDR? What other test-time augmentation strategies apply to audio models?

“The `--shifts=SHIFTS` performs multiple predictions with random shifts (a.k.a the *shift trick*) of the input and average them.”
corpus · demucs-music-source-stem-separation · chunk 6