Terminal SNR and the Zero-SNR Fix
Problem Statement
Common schedules never fully destroy the signal: at the last step alpha_bar_T is slightly above 0, leaking image information the sampler can never remove. Detect this and apply the "enforce zero terminal SNR" rescaling from Lin et al. (2024).
Background
The signal-to-noise ratio at step t is SNR_t = alpha_bar_t / (1 - alpha_bar_t). A schedule has zero terminal SNR iff alpha_bar_T = 0. The fix rescales the sqrt(alpha_bar) curve linearly so its first value is unchanged and its last value becomes 0:
then square back to get the corrected alpha_bar.
Your Task
Implement:
def fix_zero_terminal_snr(alpha_bar):
Return the corrected alpha_bar list rounded to 6 decimals. The last value must be exactly 0.0.
Input Format
- alpha_bar: list of T cumulative products (decreasing).
Output Format
- A list of T floats rounded to 6 decimals.
Sample
print(fix_zero_terminal_snr([0.81, 0.36, 0.04]))
Output:
[0.81, 0.26449, 0.0]
Example
print(fix_zero_terminal_snr([0.81, 0.36, 0.04]))
[0.81, 0.26449, 0.0]
- Compute the square roots of the input values to work in the domain: , , and .
- Identify the first () and last () values to determine the linear rescaling range, which is .
- Apply the linear transformation to each element to shift the curve so the last value becomes zero while keeping the first value unchanged:
- For the first element:
- For the second element:
- For the last element:
- Square the rescaled values to return to the domain and round to 6 decimal places:
- The final output is
[0.81, 0.26449, 0.0]
Constraints
2 <= T <= 100000.- Rescale the
sqrt(alpha_bar)curve so the first value is preserved and the last hits 0. - Square back; the final value is exactly
0.0; round to 6 decimals.