Expand description
Federated Learning Round Consensus Tracker
Production-grade consensus mechanism for federated learning rounds. A quorum of participating nodes must commit their gradient updates before a round can proceed to aggregation.
§Overview
RoundConsensusTracker manages the lifecycle of federated learning
rounds. Each round is identified by a RoundId (a monotonically
increasing u64). Peers cast Votes, and the QuorumPolicy
determines whether consensus has been reached.
§Quorum Logic
A round commits when:
- At least
min_peersvotes have been received, AND - The fraction of
Commitvotes meetscommit_threshold
A round aborts when:
- It is impossible to reach the commit threshold even if all remaining expected peers vote Commit (i.e. enough Abort/Abstain votes exist), OR
- The timeout elapses
§Gradient CID Collection
On commit the QuorumResult::Commit variant carries the gradient_cid
values of every committing peer, ready for aggregation.
§Examples
use ipfrs_tensorlogic::consensus::{
RoundConsensusTracker, RoundId, PeerVote, Vote, QuorumPolicy, QuorumResult,
};
use std::time::Duration;
let policy = QuorumPolicy::default();
let tracker = RoundConsensusTracker::new(policy);
let round_id = RoundId::from(1_u64);
let peers = vec!["peer-a".to_string(), "peer-b".to_string(), "peer-c".to_string()];
tracker.begin_round(round_id.clone(), peers).expect("example: should succeed in docs");
for (i, peer) in ["peer-a", "peer-b", "peer-c"].iter().enumerate() {
let vote = PeerVote::new(
peer.to_string(),
round_id.clone(),
Vote::Commit,
Some(format!("bafyreic{}", i)),
);
let result = tracker.cast_vote(vote).expect("example: should succeed in docs");
if let QuorumResult::Commit { gradient_cids } = result {
assert_eq!(gradient_cids.len(), 3);
break;
}
}Structs§
- Consensus
Stats - Atomic counters tracking aggregate consensus activity.
- Consensus
Stats Snapshot - Immutable snapshot of
ConsensusStats. - Peer
Vote - A single vote cast by a peer for a specific round.
- Quorum
Policy - Policy parameters governing when a round can proceed to aggregation.
- Round
Consensus Tracker - Central registry for federated learning round consensus.
- RoundId
- Monotonically-increasing federated learning round identifier.
Enums§
- Consensus
Error - Errors that can be returned by
RoundConsensusTrackeroperations. - Quorum
Result - Outcome of evaluating the quorum policy against the current vote set.
- Round
Status - Internal lifecycle state of a single round.
- Vote
- A peer’s vote for a federated learning round.