Min-SNR Weights for v-Prediction
Problem Statement
Min-SNR weighting changes form with the prediction target. For v-prediction the effective weight uses SNR + 1 in the denominator. Compute it.
Background
Hang et al. give the Min-SNR weight per parameterization by dividing the clamped SNR by the parameterization's implicit weight:
- eps-pred: w = min(SNR, gamma) / SNR
- x0-pred: w = min(SNR, gamma)
- v-pred: w = min(SNR, gamma) / (SNR + 1)
The SNR + 1 denominator for v reflects that v-prediction already balances signal and noise, so its baseline weight is SNR + 1.
Your Task
Implement:
def min_snr_v_weights(snr, gamma):
Return the list of v-prediction Min-SNR weights rounded to 4 decimals.
Input Format
- snr: list of non-negative SNRs.
- gamma (float): the clamp.
Output Format
- A list of floats rounded to 4 decimals.
Sample
print(min_snr_v_weights([10.0, 4.0, 1.0], 5.0))
Output:
[0.4545, 0.8, 0.5]
Example
print(min_snr_v_weights([10.0, 4.0, 1.0], 5.0))
[0.4545, 0.8, 0.5]
- For each SNR value, the weight is calculated using the v-prediction formula: . The numerator clamps the SNR to the maximum value to prevent weights from becoming too large, while the denominator accounts for the signal-to-noise ratio plus one, specific to v-prediction.
- For the first input with , the numerator is and the denominator is . The weight is , which rounds to .
- For the second input with , the numerator is and the denominator is . The weight is , which remains when rounded to 4 decimals.
- For the third input with , the numerator is and the denominator is . The weight is , which remains when rounded to 4 decimals.
- The final output is [0.4545, 0.8, 0.5]
Constraints
1 <= len(snr) <= 100000, allsnr[i] >= 0,gamma > 0.w_t = min(SNR_t, gamma) / (SNR_t + 1).- Round to 4 decimals.