Log-SNR of a Schedule
Problem Statement
Continuous-time diffusion (VDM) parameterizes everything by lambda_t = log SNR_t. Convert an alpha_bar schedule to its log-SNR curve.
Background
The signal-to-noise ratio is SNR_t = alpha_bar_t / (1 - alpha_bar_t), and its log is
lambda runs from large positive (clean) to large negative (pure noise) and is the natural axis for noise schedules and loss weights.
Your Task
Implement:
def log_snr(alpha_bar):
Return the list of lambda_t values rounded to 4 decimals.
Input Format
- alpha_bar: list of cumulative products, each strictly in (0, 1).
Output Format
- A list of floats rounded to 4 decimals.
Sample
print(log_snr([0.5, 0.2]))
Output:
[0.0, -1.3863]
Example
print(log_snr([0.5, 0.2]))
[0.0, -1.3863]
- Input:
alpha_baris a list of cumulative signal fractions , each strictly between 0 and 1. Here and : the first step keeps half the signal, the second keeps a fifth. - First element: , so signal and noise are equal and . Then , which prints as
0.0(a positive zero, never a negative one). - Second element: , so , which rounds to 4 decimal places as .
- Output: one natural-log value per schedule entry, same length and order as the input:
[0.0, -1.3863]. - Notice: marks the point where signal equals noise. Less signal gives a negative , and the curve is antisymmetric: would give , the exact mirror of .
Constraints
1 <= len(alpha_bar) <= 100000, values strictly in(0, 1).lambda_t = log(alpha_bar_t) - log(1 - alpha_bar_t).- Round to 4 decimals; avoid
-0.0.