-
Notifications
You must be signed in to change notification settings - Fork 3
Task Contracts
While the Platform Contracts are deployed once for the whole network, the task contracts are deployed per model, by the model owner: every model trained on DIN gets its own pair of DINTaskCoordinator and DINTaskAuditor contracts that run the federated-learning lifecycle for that model.
Model owner (Ownable)
├── deploys & drives ──► DINTaskCoordinator ◄──── aggregators (register, submit T1/T2)
│ │ │
│ delegates │ │ slash()
│ ▼ ▼
└── deploys ───────────► DINTaskAuditor DinValidatorStake
▲
clients (submit local models) · auditors (register, score)
Before a model can be registered in DinModelRegistry, both contracts must be authorized as slashers on DinValidatorStake — the model owner requests this from the DIN-Representative (off-chain), who executes addSlasherContract via DinCoordinator after verifying the deployment. This guarantees that any model admitted to the network can hold its validators accountable.
The central orchestration contract for a model's training. It drives the 23-state Global Iteration (GI) state machine, coordinates aggregators, and executes slashing.
Responsibilities:
- Lifecycle management — every phase of a GI is opened and closed explicitly by the model owner; all other participants can only act while their phase is open.
- Aggregator registration — staked validators register as aggregators for the current GI (permissionless while the phase is open, subject to a minimum stake).
- Two-tier aggregation — forms Tier-1 batches (approved local models split into sub-batches, 3 aggregators per batch) and a single Tier-2 batch that combines the T1 results into the new global model. Aggregators submit result CIDs, and the winning CID per batch is decided by majority vote among the batch's aggregators.
-
Slashing — penalizes registered auditors and aggregators that failed to participate or voted against the majority, by calling
slash()onDinValidatorStake. - Holds the genesis model CID (set once before GI 1) and the finalized global model CID of each iteration.
The evaluation and quality-control contract — the gatekeeper deciding which client contributions make it into the global model.
Responsibilities:
- Auditor registration — staked validators register as auditors for the current GI.
- Local Model Submission (LMS) — clients submit the IPFS CID of their locally trained model (one submission per client per GI, capped at 10,000 per GI).
- Audit batch formation — submitted models are assigned to batches of auditors (3 auditors × 3 models per batch by default), with a per-batch test dataset CID supplied by the model owner.
- Scoring & eligibility — each assigned auditor evaluates the models in its batch against the test data and records a score (0–100) plus an eligibility vote.
- Finalization — once quorum is reached, a model's final average score is computed; it is approved for aggregation only if the eligibility majority passed it and its average score meets the pass threshold (default 50). Scoring parameters (auditors per batch, quorums, pass score) are tunable per round.
A GI is one full training round. The coordinator's state machine enforces the order — each transition is an explicit dincli model-owner ... command:
Setup (once): set auditor contract → confirm slasher auth → submit genesis model
│
┌────────────────────────────────────────────────────────────────┘
▼
1. GI started
2. Aggregator registration (open → aggregators stake & register → close)
3. Auditor registration (open → auditors stake & register → close)
4. Local Model Submission (LMS) (open → clients train locally & submit CIDs → close)
5. Auditor evaluation (batches created → auditors score & vote → close)
6. T1 aggregation (batches created → aggregators combine sub-batches → finalize)
7. T2 aggregation (T1 winners combined into new global model → finalize)
8. Slashing (non-performing / minority-voting auditors & aggregators)
9. GI ended → next GI starts from the new global model
Only model artifacts move between participants — raw training data never leaves a client's device. All artifacts (genesis model, local models, aggregated models, test datasets) live on IPFS; the contracts store and vote on their CIDs.
The model owner deploys and wires up both contracts through dincli:
dincli model-owner deploy task-coordinator --artifact <DINTaskCoordinator.json>
dincli model-owner deploy task-auditor --artifact <DINTaskAuditor.json>
# then: request slasher authorization from the DIN-Representative,
# confirm it, submit the genesis model, and register the modelThe full step-by-step — including the slasher authorization request channels and the manifest/services setup — is in the Model Workflow guide.
- Model Workflow — complete per-model walkthrough with all commands
- Technical references: DINTaskCoordinator · DINTaskAuditor · DINShared (GI state enum & shared interfaces)
- Platform Contracts — the network-wide layer that authorizes these contracts
- Platform Contracts
- Task Contracts
- DIN CLI
- DIN SDK (planned)
- DIN Daemon (planned)
- IPFS Layer
- DIN Node
- Worker Node