Skip to content

Add tutorials to user documentation - #55

Merged
ArthurDanjou merged 53 commits into
mainfrom
54-add-tutorials-to-user-documentation
Jul 30, 2026
Merged

Add tutorials to user documentation#55
ArthurDanjou merged 53 commits into
mainfrom
54-add-tutorials-to-user-documentation

Conversation

@ArthurDanjou

@ArthurDanjou ArthurDanjou commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

This PR adds a complete tutorial section to the Krum documentation, restructures the quickstart, and fixes several documentation issues.**

New tutorials (14 .rst files)

The docs/tutorials/ directory now contains a full walkthrough series:

Tutorial Covers
using_aggregators_attacks All built-in aggregation rules and attacks, resilience table, combined example
working_with_models Model wrapper, zero-copy flat tensor views, standard models (Krum NIPS 2017, MONNA ICML 2023)
centralised_simulation_walkthrough KrumSimulation and HiddenVulnerabilitySimulation lifecycle, baseline comparison
decentralised_simulation_walkthrough MonnaSimulation, per-worker models, Byzantine reach modes, custom data streams
custom_dataset Using any PyTorch Dataset with Krum: TensorDataset, torchvision, disk loading
working_with_orchestrator Structured result collection with Metric and Orchestrator
results_analysis Filtering, pivoting, merging, plotting, exporting MetricDataFrame
systematic_benchmark N aggregators × M attacks sweep, comparison table, LaTeX export
end_to_end Complete experiment in one script: dataset → model → Orchestrator → analysis → CSV export
troubleshooting Common errors (aggregator bounds, NaN, divergence, missing gradients) with causes and fixes
implement_simulation Custom simulation subclassing
implement_aggregator Custom aggregation rule
implement_attack Custom Byzantine attack

Other changes

  • Quickstart trimmed from ~180 lines to ~40 — a minimal sanity check pointing to tutorials for depth
  • pyproject.tomlmatplotlib, numpy, and seaborn moved to a new [experiments] extra; runtime deps reduced to pandas, torch, torchvision only; dev deps bumped
  • README updated with krum[experiments] install instructions
  • Docs nav — Tutorials section added to the Sphinx sidebar and docs homepage
  • Reference docs — all automodule paths fixed from bare aggregators.xxx to krum.primitives.aggregators.xxx (same for attacks)
  • Heading fixes — 13 RST heading underlines corrected across 7 tutorial files (off-by-one length mismatches)
  • uv.lock regenerated to match new dependency tree

@ArthurDanjou ArthurDanjou linked an issue Jul 21, 2026 that may be closed by this pull request
7 tasks
@ArthurDanjou ArthurDanjou added the documentation Improvements or additions to documentation label Jul 21, 2026
@ArthurDanjou ArthurDanjou self-assigned this Jul 21, 2026
@ArthurDanjou
ArthurDanjou marked this pull request as ready for review July 27, 2026 08:55
Replaced the detailed "Key Concepts" section with a minimal sanity check
example. Point users to tutorials for comprehensive guides on
aggregators,
attacks, and models.
Krum now requires pandas as a runtime dependency. Update install
instructions
to include the experiments extra which adds matplotlib, numpy, and
seaborn.
New tutorial covering MetricDataFrame filtering, merging, pivoting,
CSV/JSON export, seed aggregation, and plotting. Added to tutorial
index and todo.md marked complete.
New tutorial showing how to run N aggregators × M attacks with
Orchestrator, build a comparison table, and export for papers.
Added to tutorial index and todo.md marked complete.
Conceptual tutorial covering the Byzantine threat model, the three
regimes of the Byzantine budget (f < n/2, 2f+2 < n, 4f+2 < n),
a strategy-based panorama of all five built-in attacks, and the
fundamental limits of robustness. Added to tutorial index and
todo.md marked complete.
Complete the tutorial series with a decision guide for using any
PyTorch Dataset with Krum simulations (TensorDataset, torchvision,
disk loading, model matching).
Fix RST title underlines that were one character too long across
centralised_simulation, decentralised_simulation, results_analysis,
systematic_benchmark, and working_with_orchestrator tutorials.
Improve the minimal example and add new sections on data partitioning
and
evaluating worker models. The data loading pattern now uses an infinite
cycle helper to avoid StopIteration when streams are exhausted.
Improve cross-linking between tutorials by adding links to
implement_aggregator and implement_attack, reordering sections for
better learning flow, and standardizing formatting across all tutorial
pages.
Documents the Metric, Orchestrator, and MetricDataFrame API for running
reproducible experiments with multiple configurations and collecting
comparable metrics across seeds.
- Move implement_aggregator and implement_attack to Available Tutorials
- Consolidate advanced orchestration tutorials into
  structured_experiments
- Update introduction paragraph with revised learning path
Added a code example demonstrating how custom kwargs passed to
`aggregator_kwargs` are accessible via `specialized.get()`. Updated the
testing section to show the specific command.
The tutorial now demonstrates how MultiKrum handles SignFlip attacks by
comparing against a simple Average baseline, with an explanation of why
their gradient norms differ.
Added "Setup" and "Running the grid" subsections to improve
tutorial structure and readability.
- Document that aggregator uses aggregate() and attack uses generate()
  methods
- Add rounds=50 parameter to simulation examples
- Document stop_attack_at and weight_decay parameters
@ArthurDanjou
ArthurDanjou force-pushed the 54-add-tutorials-to-user-documentation branch from 75ca0d7 to 4c1beac Compare July 30, 2026 15:19
@ArthurDanjou
ArthurDanjou merged commit fc0678f into main Jul 30, 2026
6 checks passed
@ArthurDanjou
ArthurDanjou deleted the 54-add-tutorials-to-user-documentation branch July 30, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tutorials to user documentation

2 participants