TL;DR
Signed Rectified Flow (Signed RF) provides a principled mathematical framework for steering generative models away from undesirable content by training them on "signed measures" (mixtures of positive and negative distributions). By treating the boundary where the positive and negative distributions balance out as a natural repulsive barrier, Signed RF dynamically adapts its guidance strength to completely exclude unwanted regions without destroying sample diversity.
What Problem Does This Paper Address?
Modern generative models are incredibly powerful, but controlling what they shouldn't generate remains a persistent challenge. Whether it's filtering out copyrighted characters, preventing nudity, avoiding training data memorization, or navigating around physical obstacles in robot planning, we need reliable ways to say "no."
The standard industry workaround is Classifier-Free Guidance (CFG), which heuristically extrapolates trajectories away from an unconditional or negative prompt using a fixed, constant scaling factor. However, CFG is largely a heuristic: set the scale too low, and the model still generates the bad content; set it too high, and you over-repel the trajectories, destroying the visual quality and diversity of your samples. This paper introduces a rigorous framework to replace these heuristics with a mathematically sound, state-dependent guidance mechanism.
Methods
The authors introduce Signed Rectified Flow (Signed RF), which generalizes standard Rectified Flow to target a signed measure:
$$\pi^{\text{sign}} = (1 + \alpha) \pi^+ - \alpha \pi^-$$
where $\pi^+$ is the distribution to promote, $\pi^-$ is the distribution to suppress, and $\alpha > 0$ controls the suppression strength.
While you cannot directly sample from a signed measure (since it contains "negative probability mass"), the authors prove that extending the Rectified Flow velocity formula to $\pi^{\text{sign}}$ induces a perfectly valid generative ODE. This velocity field can be rewritten in an intuitive, guidance-like form:
$$v_t^{\text{signRF}}(x) = v_t^+(x) + \lambda_t^\alpha(x) (v_t^+(x) - v_t^-(x))$$
Crucially, the guidance scale $\lambda_t^\alpha(x)$ is not a constant or a fixed time-dependent schedule. Instead, it is state-dependent, dynamically scaling based on the local density ratio $r_t(x) = \pi_t^-(x)/\pi_t^+(x)$.
The authors propose two practical ways to estimate this density ratio during generation:
- Classifier-based: Training a lightweight, time-conditioned binary classifier on intermediate noisy states.
- Online ratio tracking: Tracking the log-density ratio directly along the trajectory by solving an augmented ODE, completely removing the need for an auxiliary classifier in certain applications.
Datasets
The method was evaluated across a diverse set of tasks and datasets:
- 2D Toy Datasets: Gaussian mixtures used to verify the theoretical behavior of the flow lines.
- PointMaze: A navigation dataset used to demonstrate obstacle avoidance where wall interiors are treated as the negative distribution.
- ImageNet ($256 \times 256$): Used for class-conditional generation benchmarks and anti-memorization stress tests.
- Ring-A-Bell & COCO-30K: Used to evaluate safety alignment (specifically nudity prevention) against adversarial prompts on Stable Diffusion 3.5-Medium.
- Z-Image: Used for qualitative concept-suppression experiments.
Key Insights and Ideas
- The Repulsive Barrier: Mathematically, the velocity field becomes singular on the "zero set" where $(1+\alpha)\pi_t^+(x) - \alpha\pi_t^-(x) = 0$. The authors prove that this singular boundary acts as a strict, impenetrable barrier. Trajectories initialized from pure noise can never cross into the negative region.
- The Ghost Region: Reversing the dynamics reveals a fascinating physical picture. The space partitions into a reachable zone, a rejection zone (negative mass), and an unsampled "ghost region" that separates them. The positive mass trapped in this ghost region perfectly balances out the excluded negative mass, ensuring the final sampling law integrates to 1.
- State-Aware CFG: Because the guidance strength adapts to the local density ratio, Signed RF only pushes back hard when a sample trajectory drifts dangerously close to an unwanted mode. If a sample is already safely in a positive region, the guidance relaxes, preserving sample diversity.
Key Results
- ImageNet Generation: Signed RF consistently outperformed standard CFG and other advanced guidance baselines (like ADG and CFG++) across all Node Function Evaluation (NFE) budgets. For instance, at 16 NFEs, Signed RF achieved an FID of 1.82 compared to CFG's 2.38, demonstrating a significantly better fidelity-diversity trade-off.
- Anti-Memorization: In "Data Repulsive Flow" experiments, Signed RF successfully prevented the model from replicating exact training images (and dataset artifacts like watermarks) while maintaining high-quality generation, outperforming existing methods like SPELL.
- Safety Alignment: When tested on the Ring-A-Bell adversarial benchmark for nudity prevention in Stable Diffusion 3.5, Signed RF slashed the Attack Success Rate (ASR) from 15.19% down to 6.33% while perfectly preserving aesthetic and CLIP scores.
Limitations and Future Work
- Numerical Stability: Because the denominator of the guidance scale can get very close to zero near the singular boundary, finite step sizes in numerical ODE solvers can cause instability. The authors currently mitigate this with practical hacks like capping $\lambda_t^\alpha$ and clipping the density ratio.
- Computational Overhead: Evaluating the density ratio classifier or tracking the online ratio adds a modest computational tax. For ImageNet sampling, Signed RF introduced an 11.3% increase in sampling time and a minor peak memory overhead (~0.48 GB).
- Future Directions: Extending this framework to discrete-time diffusion models and exploring more complex, multi-distribution signed mixtures remain open avenues for exploration.
Summary updated