Skip to content

feat(scalarization): Add readme#749

Open
ppraneth wants to merge 6 commits into
SimplexLab:mainfrom
ppraneth:scalarization-readme
Open

feat(scalarization): Add readme#749
ppraneth wants to merge 6 commits into
SimplexLab:mainfrom
ppraneth:scalarization-readme

Conversation

@ppraneth

Copy link
Copy Markdown
Contributor

Adds a simple README

@ppraneth ppraneth added cc: feat Conventional commit type for new features. package: scalarization labels Jun 21, 2026
@github-actions github-actions Bot changed the title add readme feat(scalarization): Add readme Jun 21, 2026

@PierreQuinton PierreQuinton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So think that if this is a good idea to add, then it should be dev oriented only. Here it looks like documentation, which it should not be. The way I view this would be to explain how to create scalarizers, what to be careful about (when are they stateful, avoid non-atomic things, etc...), what are not scalarizers? etc...

What do you think of this?

@ppraneth

Copy link
Copy Markdown
Contributor Author

Yea I will make it dev oriented

@ppraneth ppraneth requested a review from PierreQuinton June 21, 2026 07:58
Comment thread src/torchjd/scalarization/README.md Outdated
Comment thread src/torchjd/scalarization/README.md Outdated

- **Any shape in, scalar out:** it reduces over *all* elements of `values` (0-dim, vector, matrix,
higher-dim) into a 0-dim scalar.
- **`values`, not `losses`:** a scalarizer is generic and not tied to losses.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we may want to speak more about the abstraction level rather than saying that. Not sure how though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rewrote it around the abstraction

Comment thread src/torchjd/scalarization/README.md Outdated
Comment on lines +53 to +56
Anything that needs the model, its parameters, or the per-task gradients belongs in the
[aggregation](../aggregation) package as a `Weighting` / `Aggregator`, which operates on the Jacobian
or its Gramian. If you reach for gradient norms or the network inside `forward`, you are writing an
aggregator, not a scalarizer.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well the aggregation package should not contain anything else than Scalarizers, it contains aggregators (that could be stateful).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. It now says the gradient-level counterpart in the aggregation package is an Aggregator (which, like a scalarizer, can be stateful) that operates on the Jacobian or its Gramian.

Comment on lines +41 to +42
- **Subclass `Stateful`** (`from torchjd._mixins import Stateful`) and implement `reset()` to restore
the initial state.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have Randomness? If so do we have the Stochastic mixin that we also use in aggregation? Maybe we can mention it here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do have a random baseline, but there is no Stochastic mixin. It just calls torch.randn directly

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, I thought that In the aggregation package, we consider random aggregators as stateful (the seed is the state), I think it would be beneficial to do that in scalarization. @ValerianRey Didn't we go in that direction? Did we abandon that idea?

ppraneth and others added 4 commits June 21, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cc: feat Conventional commit type for new features. package: scalarization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants