Skip to content

refactor: unify aggregator strategy configuration and CLI params - #1290

Open
ale18V wants to merge 1 commit into
mainfrom
refactor/aggregator-params
Open

ale18V wants to merge 1 commit into
mainfrom
refactor/aggregator-params

Conversation

@ale18V

@ale18V ale18V commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Currently the local client trainer is decoupled from the aggregator, which is limiting to implementing more complex algorithms.

What

This PR unifies the configuration of aggregation strategies across discojs and the CLI.
Previously, aggregator parameters were scattered across ad-hoc fields like privacy.byzantineFaultTolerance and root maxShareValue, causing CLI argument sprawl.
This refactor introduces a typed aggregationParams schema discriminated by aggregationStrategy and a generic --aggregatorParams CLI flag.

Individual flags (--clippingRadius, --beta, --maxIterations, --maxShareValue) are removed in favor of comma-separated key-value pairs, keeping argument parsing clean and extensible.

TODO

@ale18V
ale18V force-pushed the refactor/aggregator-params branch 7 times, most recently from 9726da6 to 9f2fe66 Compare November 12, 2026 14:37
@ale18V
ale18V added this pull request to stack #1292 November 12, 2026 15:58
@ale18V
ale18V requested a review from JulienVig November 12, 2026 15:58
@ale18V
ale18V marked this pull request as ready for review November 12, 2026 15:58

@JulienVig JulienVig left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this refactor is a good idea but I see a few blockers right now:

  • The zod schema is too loose, it allows incorrect arguments without error, and doesn't let TypeScript narrow types correctly
  • The CLI parsing is quite shaky, it looks like passing CLI argument as JSON would let us avoid reimplementing a possible incorrect CLI parser even if less convenient
  • The CLI isn't clear about its API: what are the accepted parameters, and it doesn't fail clearly when passing incorrect arguments

Let me know what you think on keeping JSON arguments for the CLI

Comment thread cli/src/args.ts Resolved
Comment thread cli/src/args.ts Resolved
Comment thread cli/src/args.ts Resolved
Comment thread cli/src/args.ts Resolved
Comment thread cli/src/args.ts Resolved
Comment thread cli/src/args.ts Resolved
Comment thread discojs/src/training/trainer.ts Resolved
Comment thread cli/src/python/run_experiments.py Resolved
Comment thread cli/src/python/run_experiments.py Resolved
@ale18V

ale18V commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

The CLI parsing is quite shaky, it looks like passing CLI argument as JSON would let us avoid reimplementing a possible incorrect CLI parser even if less convenient

By the way, regarding this, for sure JSON is more convenient for code, less convenient for CLI usage.
I intentionally chose key=value over JSON as that's the usual pattern

@ale18V
ale18V force-pushed the refactor/aggregator-params branch 2 times, most recently from 7dabd89 to 6cb20f5 Compare November 18, 2026 10:49
@ale18V
ale18V force-pushed the refactor/aggregator-params branch from 6cb20f5 to 736095d Compare November 18, 2026 15:26
@JulienVig
JulienVig self-requested a review November 19, 2026 12:51

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants