Sigmoid Beta Schedule
Problem Statement
The sigmoid schedule (popularized for higher-resolution training) shapes betas with a logistic curve so most of the noising happens in the middle of the trajectory. Build it.
Background
Take T points on a linear grid over [-6, 6], pass them through the logistic sigmoid sigma(x) = 1/(1+e^{-x}), then affinely rescale that curve so its minimum maps to beta_start and its maximum to beta_end:
so beta_0 = beta_start and beta_{T-1} = beta_end exactly.
Your Task
Implement:
def sigmoid_beta_schedule(T, beta_start, beta_end):
Return a list of T betas rounded to 6 decimals.
Input Format
- T (int), T >= 2.
- beta_start, beta_end (float): 0 < beta_start < beta_end < 1.
Output Format
- A list of T floats rounded to 6 decimals.
Sample
print(sigmoid_beta_schedule(3, 0.0001, 0.02))
Output:
[0.0001, 0.01005, 0.02]
Example
print(sigmoid_beta_schedule(3, 0.0001, 0.02))
[0.0001, 0.01005, 0.02]
- Generate Grid Points: With , we create a linear grid of 3 points spanning the interval . This yields the input values for the sigmoid function: .
- Compute Sigmoid Values: We apply the logistic function to each point.
- For :
- For :
- For :
- Normalize the Curve: We rescale the sigmoid outputs so the minimum maps to 0 and the maximum maps to 1 using the formula .
- The range is .
- Normalized values:
- :
- :
- :
- Affine Rescaling to Beta Range: We map the normalized values to the interval using . The total range is .
- :
- :
- :
- The final output is
[0.0001, 0.01005, 0.02]
Constraints
T >= 2,0 < beta_start < beta_end < 1.- Grid is
[-6, 6]; rescale so endpoints hitbeta_start/beta_endexactly. - Round every beta to 6 decimals.