twinflow: adversarial loss, doc updates - #2453
Merged
Merged
Conversation
samzhang996-hue
pushed a commit
to samzhang996-hue/SimpleTuner
that referenced
this pull request
Apr 27, 2026
…twinflow twinflow: adversarial loss, doc updates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2452
This pull request adds support for the full self-adversarial training branch of TwinFlow, as described in the original paper, across all documentation and the core model helper code. It introduces new configuration options to enable and control adversarial and rectification losses (L_adv and L_rectify), and implements the corresponding loss computations and fake sample generation in the training pipeline. Documentation in English, Spanish, Portuguese, Hindi, Japanese, and Chinese is updated to explain these new features and settings.
TwinFlow adversarial branch support
twinflow_adversarial_enabled,twinflow_adversarial_weight, andtwinflow_rectify_weightin_twinflow_settingswithinsimpletuner/helpers/models/common.py.simpletuner/helpers/models/common.pyfor generating fake samples (_twinflow_generate_fake_samples) and computing the adversarial (_twinflow_compute_adversarial_loss) and rectification (_twinflow_compute_rectify_loss) losses, following the TwinFlow paper.Documentation updates (all languages)
documentation/distillation/TWINFLOW.md,.es.md,.pt-BR.md,.hi.md,.ja.md,.zh.md) to describe the new adversarial branch, configuration flags, and the behavior and purpose of L_adv and L_rectify losses. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18]These changes make it possible to optionally enable full self-adversarial training in TwinFlow, allowing for improved distribution matching and trajectory alignment without the need for an external discriminator, and ensure that documentation is clear and up-to-date in all supported languages.