Relativistic Resonant Flow (RRF): High-Fidelity Sampling for Rectified Flow Models via Tangential Damping and Stochastic Resonance
Created by: Mohammad Farid Hendianto (IRedDragonICY)
This repository contains the PyTorch implementation of the Relativistic Resonant Flow (RRF) sampler. This novel discretization method is designed to mitigate manifold deviation in Rectified Flow models, particularly under conditions of high Classifier-Free Guidance (CFG).
RRF addresses the curvature of the generative trajectory by decomposing the velocity vector into parallel and orthogonal components, applying tangential damping to reduce artifacts, and injecting resonant high-frequency details to counteract discretization dissipation.
Rectified Flow models facilitate generation via Ordinary Differential Equations (ODEs). However, standard solvers (e.g., Euler, Heun) often struggle with the high curvature induced by guidance scales, leading to "burn" artifacts and loss of fine texture.
We propose Relativistic Resonant Flow (RRF), which introduces:
- Tangential Damping: A geometric correction that projects the lookahead velocity vector onto the current trajectory, damping the orthogonal component responsible for manifold drift.
- Stochastic Resonance Injection: A spectral enhancing technique that reintroduces high-frequency components—extracted via a Difference of Gaussians (DoG) approximation—during the refinement stages to improve perceptual fidelity.
Given the current velocity
We decompose
Where:
The corrected lookahead velocity is computed by damping the orthogonal component by a factor
The final update step approximates a Crank-Nicolson scheme using the damped vector.
To counteract the smoothing effects of numerical integration (spectral dissipation), we define a resonance term
As visualized in the figure above, we extract high-frequency residuals using a fast approximation:
This residual is injected back into the trajectory with a time-dependent scaling factor, ensuring texture preservation (sharpness) without disrupting the semantic structure.
The core logic is self-contained in auraflow_rrf.py. To use this in ComfyUI, integration into the internal sampler dispatch is required.
TANGENTIAL_DAMPING(default: 0.85): Controls the suppression of orthogonal drift. Lower values reduce high-CFG artifacts but may reduce compositional adherence.RESONANCE_START_PCT(default: 0.2): The percentage of the sampling process elapsed before resonance injection activates (prevents hallucinating details during the initial structural phase).
If you find this work useful in your research, please consider citing:
@misc{hendianto2025rrf,
author = {Hendianto, Mohammad Farid},
title = {Relativistic Resonant Flow: High-Fidelity Sampling via Tangential Damping},
year = {2025},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/IRedDragonICY/auraflow_rrf}}
}

