In the realm of Large Language Models, adjusting the "temperature" to control the trade-off between predictability and creativity is standard practice. However, achieving this same control in diffusion and flow-matching models—the engines behind systems like Stable Diffusion and Flux—has historically required expensive retraining or hacky workarounds that degrade the underlying data distribution.
A recent paper, "Temporal Score Rescaling for Temperature Sampling in Diffusion and Flow Models," introduces a mathematically grounded, plug-and-play mechanism called Temporal Score Rescaling (TSR). TSR allows users to steer sampling diversity without any fine-tuning, offering a reliable way to make outputs either "sharper" (more precise) or "flatter" (more diverse).
The Challenge of Sampling Distributions
Generative models aim to learn an underlying probability distribution $p(x)$. During inference, however, drawing true samples from $p(x)$ is not always the optimal strategy. The ideal distribution shape depends heavily on the task:
- Discriminative Tasks (Depth Prediction, Pose Estimation): Users typically want the most likely, high-precision estimate, requiring a "sharp" distribution.
- Creative Tasks (Artistic Image Generation): Users often prefer high-frequency details and variety, requiring a "flat" distribution, even if those specific samples are technically less "likely" in the training data.
Existing methods to control this trade-off fall short. Classifier-Free Guidance (CFG) is helpful but requires specific training paradigms and is not true temperature scaling. Constant Noise Scaling (CNS)—a common heuristic—frequently induces "mode collapse," where the model ignores peripheral data and collapses toward the center of the distribution.
Methodology: Temporal Score Rescaling
TSR addresses these limitations by analytically relating the score function of the original data to a hypothetical "temperature-scaled" version. The authors derive a time-dependent rescaling factor, $r_t(k, \sigma)$, which is applied to the model's predicted score (or noise) at each step of the denoising process.
- $k$ (The Sharpening Factor): Controls the target variance. Values of $k > 1$ yield sharper, more likely samples, while $k < 1$ produces flatter, more diverse samples.
- $\sigma$ (The Timing Parameter): Dictates when in the diffusion process the steering takes effect.
Because TSR is a simple multiplier applied to the neural network's output, it is entirely training-free. It is compatible with both deterministic (ODE) and stochastic (SDE) samplers, effectively tricking the sampler into perceiving a narrower or wider distribution locally around each mode.
Key Insights
- Local vs. Global Scaling: Traditional temperature scaling can alter the relative weights of different modes (e.g., generating only cats and no dogs). TSR acts as a local operator: it preserves all modes but adjusts how tightly samples cluster around them.
- Task-Specific "Sweet Spots": Different domains require opposite scaling directions. Discriminative tasks thrive with $k > 1$ (sharpening). Conversely, creative image generation benefits from a slightly flatter distribution ($k \approx 0.93$), which enhances high-frequency details.
- Orthogonality to CFG: TSR complements rather than replaces Classifier-Free Guidance. Applying TSR alongside CFG allows models to push past the standard Pareto frontier of the quality-versus-diversity trade-off.
Empirical Results
The authors validated TSR across an impressively broad suite of benchmarks, demonstrating consistent improvements:
- Image Generation: On Stable Diffusion 3 (evaluated on a 5k subset of LAION Aesthetics), TSR reduced the FID from 24.77 to 22.81 while simultaneously increasing the CLIP score for better text alignment.
- Depth Estimation: Using the Marigold diffusion-based estimator on ETH3D and NYUv2 datasets, TSR outperformed standard DDIM and CNS baselines, yielding cleaner depth maps with fewer artifacts in highly uncertain regions.
- Robotics: Applied to the Pi-0 flow-matching policy on the LIBERO-10 benchmark, TSR improved success rates on 6 out of 10 manipulation tasks without extra training, raising the average success rate from 81.7% to 82.8%.
- Mode Preservation: In MNIST experiments, the CNS baseline suffered from mode collapse (over-generating "1s" and "9s"). TSR successfully maintained a perfectly balanced distribution across all digits.
Limitations and Future Directions
While highly effective, TSR is fundamentally a local approximation. Its mathematical derivation is strictly proven for mixtures of Gaussians; although it generalizes well to complex, high-dimensional data like images, the theoretical guarantees are less rigorous in those domains. Additionally, TSR cannot recover modes that the model failed to learn during training—it can only scale known modes.
Future research may explore deriving complex rescaling schedules for non-Gaussian distributions or distilling specific TSR temperatures into faster, few-step models.
Summary updated