feat(aggregation): Add FairGrad#688
Merged
Merged
Conversation
Implements the step decision of Algorithm 1 from "Fair Resource Allocation in Multi-Task Learning" (https://arxiv.org/pdf/2402.15638). The alpha=0 case is handled as a closed-form special case returning uniform weights, matching the paper's statement that w_i=1 for all i when alpha=0. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e except - Short-circuit forward() when alpha=0, returning uniform weights per the paper (Section 3: "w_i=1 for all i when alpha=0"), avoiding division by zero - Remove the ValueError catch around least_squares: huge-gramian overflow is not a case we need to handle gracefully - Allow all real-valued alpha (negative alpha is valid per the paper) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
PierreQuinton
left a comment
There was a problem hiding this comment.
I didn't review the tests.
PierreQuinton
approved these changes
May 20, 2026
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.
Summary
FairGradandFairGradWeightingimplementing the step decision of Algorithm 1 from Fair Resource Allocation in Multi-Task Learningalpha=0as a closed-form special case returning uniform weights (matching the paper: "w_i = 1 for all i when α = 0"), avoiding division by zero in the general formulafairgradoptional dependency group (pip install "torchjd[fairgrad]") backed byscipyAdapted by claude code from the implementation we started a while ago: https://github.com/ValerianRey/torchjd_private/commit/3bb76b0ca807a2929f059facc2e3c50e76154a69#diff-c532e502689e02a8fc7f2f75712294f9db73c5fefc842b8d66df36c4eb4b3507
TODO: