dpth 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +198 -0
- package/dist/agent-sdk.d.ts +157 -0
- package/dist/agent-sdk.d.ts.map +1 -0
- package/dist/agent-sdk.js +367 -0
- package/dist/agent-sdk.js.map +1 -0
- package/dist/correlation.d.ts +94 -0
- package/dist/correlation.d.ts.map +1 -0
- package/dist/correlation.js +463 -0
- package/dist/correlation.js.map +1 -0
- package/dist/economics.d.ts +203 -0
- package/dist/economics.d.ts.map +1 -0
- package/dist/economics.js +510 -0
- package/dist/economics.js.map +1 -0
- package/dist/embed.d.ts +81 -0
- package/dist/embed.d.ts.map +1 -0
- package/dist/embed.js +270 -0
- package/dist/embed.js.map +1 -0
- package/dist/entity.d.ts +76 -0
- package/dist/entity.d.ts.map +1 -0
- package/dist/entity.js +327 -0
- package/dist/entity.js.map +1 -0
- package/dist/fallback.d.ts +104 -0
- package/dist/fallback.d.ts.map +1 -0
- package/dist/fallback.js +359 -0
- package/dist/fallback.js.map +1 -0
- package/dist/federation.d.ts +224 -0
- package/dist/federation.d.ts.map +1 -0
- package/dist/federation.js +377 -0
- package/dist/federation.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/temporal.d.ts +95 -0
- package/dist/temporal.d.ts.map +1 -0
- package/dist/temporal.js +257 -0
- package/dist/temporal.js.map +1 -0
- package/dist/types.d.ts +157 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -0
- package/package.json +92 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dpth.io Federated Learning Coordinator
|
|
3
|
+
*
|
|
4
|
+
* Network-trained models as public goods. Agents fine-tune locally,
|
|
5
|
+
* share only weight deltas (LoRA adapters), and the network aggregates
|
|
6
|
+
* them into models that couldn't exist outside dpth.io.
|
|
7
|
+
*
|
|
8
|
+
* How it works:
|
|
9
|
+
* 1. Coordinator publishes a training round with base model CID
|
|
10
|
+
* 2. Eligible agents (trusted tier+) claim the round
|
|
11
|
+
* 3. Each agent fine-tunes on local data, uploads weight delta
|
|
12
|
+
* 4. Coordinator aggregates deltas (federated averaging)
|
|
13
|
+
* 5. New model version published to network via CAS
|
|
14
|
+
* 6. Agents earn credits for training contributions
|
|
15
|
+
*
|
|
16
|
+
* Security:
|
|
17
|
+
* - Only trusted+ agents can participate (reputation gate)
|
|
18
|
+
* - Weight deltas are validated (norm clipping, anomaly detection)
|
|
19
|
+
* - Differential privacy noise added before aggregation
|
|
20
|
+
* - Byzantine-tolerant: median aggregation, not mean
|
|
21
|
+
*/
|
|
22
|
+
export type TrainingStatus = 'pending' | 'active' | 'aggregating' | 'complete' | 'failed';
|
|
23
|
+
export type ParticipantStatus = 'claimed' | 'training' | 'uploaded' | 'validated' | 'rejected';
|
|
24
|
+
export interface ModelVersion {
|
|
25
|
+
id: string;
|
|
26
|
+
modelFamily: string;
|
|
27
|
+
version: number;
|
|
28
|
+
/** CID of the base model weights */
|
|
29
|
+
baseModelCid: string;
|
|
30
|
+
/** CID of the aggregated LoRA adapter (null for base) */
|
|
31
|
+
adapterCid: string | null;
|
|
32
|
+
/** Training rounds that produced this version */
|
|
33
|
+
trainingRoundIds: string[];
|
|
34
|
+
/** Performance metrics */
|
|
35
|
+
metrics: ModelMetrics;
|
|
36
|
+
/** When this version was created */
|
|
37
|
+
createdAt: string;
|
|
38
|
+
/** Parent version (null for initial) */
|
|
39
|
+
parentVersionId: string | null;
|
|
40
|
+
}
|
|
41
|
+
export interface ModelMetrics {
|
|
42
|
+
/** Loss on validation set */
|
|
43
|
+
validationLoss?: number;
|
|
44
|
+
/** Task-specific accuracy */
|
|
45
|
+
taskAccuracy?: Record<string, number>;
|
|
46
|
+
/** Number of training examples across all participants */
|
|
47
|
+
totalTrainingExamples: number;
|
|
48
|
+
/** Number of participants who contributed */
|
|
49
|
+
participantCount: number;
|
|
50
|
+
/** Improvement over parent version (percentage) */
|
|
51
|
+
improvementOverParent?: number;
|
|
52
|
+
}
|
|
53
|
+
export interface TrainingRound {
|
|
54
|
+
id: string;
|
|
55
|
+
/** Which model family (e.g., 'dpth-entity-8b', 'dpth-anomaly-3b') */
|
|
56
|
+
modelFamily: string;
|
|
57
|
+
/** Current model version being improved */
|
|
58
|
+
baseVersionId: string;
|
|
59
|
+
/** CID of training config (hyperparameters, dataset spec) */
|
|
60
|
+
configCid: string;
|
|
61
|
+
status: TrainingStatus;
|
|
62
|
+
/** Training configuration */
|
|
63
|
+
config: TrainingConfig;
|
|
64
|
+
/** Participating agents */
|
|
65
|
+
participants: TrainingParticipant[];
|
|
66
|
+
/** Minimum participants needed to aggregate */
|
|
67
|
+
minParticipants: number;
|
|
68
|
+
/** Maximum participants (prevent over-contribution) */
|
|
69
|
+
maxParticipants: number;
|
|
70
|
+
/** Deadline for submissions */
|
|
71
|
+
deadline: string;
|
|
72
|
+
/** Resulting model version (after aggregation) */
|
|
73
|
+
resultVersionId?: string;
|
|
74
|
+
/** Aggregation stats */
|
|
75
|
+
aggregationStats?: AggregationStats;
|
|
76
|
+
createdAt: string;
|
|
77
|
+
updatedAt: string;
|
|
78
|
+
}
|
|
79
|
+
export interface TrainingConfig {
|
|
80
|
+
/** Learning rate */
|
|
81
|
+
learningRate: number;
|
|
82
|
+
/** Epochs per participant */
|
|
83
|
+
localEpochs: number;
|
|
84
|
+
/** Batch size */
|
|
85
|
+
batchSize: number;
|
|
86
|
+
/** LoRA rank */
|
|
87
|
+
loraRank: number;
|
|
88
|
+
/** LoRA alpha */
|
|
89
|
+
loraAlpha: number;
|
|
90
|
+
/** Target modules for LoRA */
|
|
91
|
+
targetModules: string[];
|
|
92
|
+
/** Max gradient norm for clipping */
|
|
93
|
+
maxGradNorm: number;
|
|
94
|
+
/** Differential privacy epsilon (lower = more private) */
|
|
95
|
+
dpEpsilon?: number;
|
|
96
|
+
/** Task types to train on */
|
|
97
|
+
taskTypes: string[];
|
|
98
|
+
/** Minimum local examples required to participate */
|
|
99
|
+
minLocalExamples: number;
|
|
100
|
+
}
|
|
101
|
+
export interface TrainingParticipant {
|
|
102
|
+
agentId: string;
|
|
103
|
+
status: ParticipantStatus;
|
|
104
|
+
claimedAt: string;
|
|
105
|
+
/** CID of uploaded weight delta */
|
|
106
|
+
deltaCid?: string;
|
|
107
|
+
uploadedAt?: string;
|
|
108
|
+
/** Local training stats */
|
|
109
|
+
localStats?: {
|
|
110
|
+
examples: number;
|
|
111
|
+
epochs: number;
|
|
112
|
+
finalLoss: number;
|
|
113
|
+
trainingTimeMs: number;
|
|
114
|
+
gpuModel?: string;
|
|
115
|
+
vramUsedMb?: number;
|
|
116
|
+
};
|
|
117
|
+
/** Validation result from coordinator */
|
|
118
|
+
validation?: {
|
|
119
|
+
valid: boolean;
|
|
120
|
+
deltaL2Norm: number;
|
|
121
|
+
anomalyScore: number;
|
|
122
|
+
reason?: string;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
export interface AggregationStats {
|
|
126
|
+
method: 'fedavg' | 'fedmedian' | 'trimmed_mean';
|
|
127
|
+
participantsUsed: number;
|
|
128
|
+
participantsRejected: number;
|
|
129
|
+
/** Aggregate delta L2 norm */
|
|
130
|
+
aggregateDeltaNorm: number;
|
|
131
|
+
/** Total training examples across all participants */
|
|
132
|
+
totalExamples: number;
|
|
133
|
+
/** Time to aggregate */
|
|
134
|
+
aggregationTimeMs: number;
|
|
135
|
+
/** Differential privacy noise added */
|
|
136
|
+
dpNoiseScale?: number;
|
|
137
|
+
}
|
|
138
|
+
export interface WeightDelta {
|
|
139
|
+
/** CID of this delta */
|
|
140
|
+
cid: string;
|
|
141
|
+
/** Agent who produced it */
|
|
142
|
+
agentId: string;
|
|
143
|
+
/** Training round it belongs to */
|
|
144
|
+
roundId: string;
|
|
145
|
+
/** LoRA adapter format info */
|
|
146
|
+
format: {
|
|
147
|
+
rank: number;
|
|
148
|
+
alpha: number;
|
|
149
|
+
targetModules: string[];
|
|
150
|
+
dtype: 'float16' | 'float32' | 'bfloat16';
|
|
151
|
+
};
|
|
152
|
+
/** Size in bytes */
|
|
153
|
+
sizeBytes: number;
|
|
154
|
+
/** L2 norm of the delta (for anomaly detection) */
|
|
155
|
+
l2Norm: number;
|
|
156
|
+
/** Number of local examples used */
|
|
157
|
+
trainingExamples: number;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Register an initial base model version.
|
|
161
|
+
*/
|
|
162
|
+
export declare function registerBaseModel(modelFamily: string, baseModelCid: string, metrics?: Partial<ModelMetrics>): ModelVersion;
|
|
163
|
+
/**
|
|
164
|
+
* Get the latest version of a model family.
|
|
165
|
+
*/
|
|
166
|
+
export declare function getLatestVersion(modelFamily: string): ModelVersion | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* Get full version history for a model family.
|
|
169
|
+
*/
|
|
170
|
+
export declare function getVersionHistory(modelFamily: string): ModelVersion[];
|
|
171
|
+
/**
|
|
172
|
+
* Create a new training round for a model family.
|
|
173
|
+
*/
|
|
174
|
+
export declare function createTrainingRound(modelFamily: string, config: TrainingConfig, options?: {
|
|
175
|
+
minParticipants?: number;
|
|
176
|
+
maxParticipants?: number;
|
|
177
|
+
deadlineHours?: number;
|
|
178
|
+
configCid?: string;
|
|
179
|
+
}): TrainingRound;
|
|
180
|
+
/**
|
|
181
|
+
* Agent claims a training round.
|
|
182
|
+
*/
|
|
183
|
+
export declare function claimTrainingRound(roundId: string, agentId: string): TrainingParticipant;
|
|
184
|
+
/**
|
|
185
|
+
* Agent uploads a weight delta for a training round.
|
|
186
|
+
*/
|
|
187
|
+
export declare function submitWeightDelta(roundId: string, agentId: string, delta: Omit<WeightDelta, 'roundId' | 'agentId'>): WeightDelta;
|
|
188
|
+
/**
|
|
189
|
+
* Aggregate weight deltas from a training round into a new model version.
|
|
190
|
+
* Uses federated median (Byzantine-tolerant) by default.
|
|
191
|
+
*/
|
|
192
|
+
export declare function aggregateRound(roundId: string, method?: 'fedavg' | 'fedmedian' | 'trimmed_mean'): ModelVersion;
|
|
193
|
+
export declare function getTrainingRound(roundId: string): TrainingRound | undefined;
|
|
194
|
+
export declare function getModelVersion(versionId: string): ModelVersion | undefined;
|
|
195
|
+
/**
|
|
196
|
+
* Get active training rounds an agent can join.
|
|
197
|
+
*/
|
|
198
|
+
export declare function getAvailableRounds(agentId?: string): TrainingRound[];
|
|
199
|
+
/**
|
|
200
|
+
* Get all rounds an agent has participated in.
|
|
201
|
+
*/
|
|
202
|
+
export declare function getAgentTrainingHistory(agentId: string): TrainingRound[];
|
|
203
|
+
/**
|
|
204
|
+
* Get network-wide training stats.
|
|
205
|
+
*/
|
|
206
|
+
export declare function getTrainingStats(): {
|
|
207
|
+
totalRounds: number;
|
|
208
|
+
completedRounds: number;
|
|
209
|
+
activeRounds: number;
|
|
210
|
+
totalParticipations: number;
|
|
211
|
+
totalExamplesProcessed: number;
|
|
212
|
+
modelFamilies: string[];
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* List all registered model families with their latest versions.
|
|
216
|
+
*/
|
|
217
|
+
export declare function listModelFamilies(): Array<{
|
|
218
|
+
family: string;
|
|
219
|
+
latestVersion: number;
|
|
220
|
+
latestVersionId: string;
|
|
221
|
+
totalRounds: number;
|
|
222
|
+
}>;
|
|
223
|
+
export declare function clearFederation(): void;
|
|
224
|
+
//# sourceMappingURL=federation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"federation.d.ts","sourceRoot":"","sources":["../src/federation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAMH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,QAAQ,GAAG,aAAa,GAAG,UAAU,GAAG,QAAQ,CAAC;AAC1F,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,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AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,KAAK,CAAC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC,CAUD;AAID,wBAAgB,eAAe,IAAI,IAAI,CAMtC"}
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dpth.io Federated Learning Coordinator
|
|
3
|
+
*
|
|
4
|
+
* Network-trained models as public goods. Agents fine-tune locally,
|
|
5
|
+
* share only weight deltas (LoRA adapters), and the network aggregates
|
|
6
|
+
* them into models that couldn't exist outside dpth.io.
|
|
7
|
+
*
|
|
8
|
+
* How it works:
|
|
9
|
+
* 1. Coordinator publishes a training round with base model CID
|
|
10
|
+
* 2. Eligible agents (trusted tier+) claim the round
|
|
11
|
+
* 3. Each agent fine-tunes on local data, uploads weight delta
|
|
12
|
+
* 4. Coordinator aggregates deltas (federated averaging)
|
|
13
|
+
* 5. New model version published to network via CAS
|
|
14
|
+
* 6. Agents earn credits for training contributions
|
|
15
|
+
*
|
|
16
|
+
* Security:
|
|
17
|
+
* - Only trusted+ agents can participate (reputation gate)
|
|
18
|
+
* - Weight deltas are validated (norm clipping, anomaly detection)
|
|
19
|
+
* - Differential privacy noise added before aggregation
|
|
20
|
+
* - Byzantine-tolerant: median aggregation, not mean
|
|
21
|
+
*/
|
|
22
|
+
import { randomUUID } from 'crypto';
|
|
23
|
+
const store = {
|
|
24
|
+
modelVersions: new Map(),
|
|
25
|
+
trainingRounds: new Map(),
|
|
26
|
+
weightDeltas: new Map(),
|
|
27
|
+
latestVersions: new Map(),
|
|
28
|
+
agentHistory: new Map(),
|
|
29
|
+
};
|
|
30
|
+
// ─── Model Version Management ────────────────────────
|
|
31
|
+
/**
|
|
32
|
+
* Register an initial base model version.
|
|
33
|
+
*/
|
|
34
|
+
export function registerBaseModel(modelFamily, baseModelCid, metrics) {
|
|
35
|
+
const version = {
|
|
36
|
+
id: randomUUID(),
|
|
37
|
+
modelFamily,
|
|
38
|
+
version: 1,
|
|
39
|
+
baseModelCid,
|
|
40
|
+
adapterCid: null,
|
|
41
|
+
trainingRoundIds: [],
|
|
42
|
+
metrics: {
|
|
43
|
+
totalTrainingExamples: 0,
|
|
44
|
+
participantCount: 0,
|
|
45
|
+
...metrics,
|
|
46
|
+
},
|
|
47
|
+
createdAt: new Date().toISOString(),
|
|
48
|
+
parentVersionId: null,
|
|
49
|
+
};
|
|
50
|
+
store.modelVersions.set(version.id, version);
|
|
51
|
+
store.latestVersions.set(modelFamily, version.id);
|
|
52
|
+
return version;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get the latest version of a model family.
|
|
56
|
+
*/
|
|
57
|
+
export function getLatestVersion(modelFamily) {
|
|
58
|
+
const versionId = store.latestVersions.get(modelFamily);
|
|
59
|
+
return versionId ? store.modelVersions.get(versionId) : undefined;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get full version history for a model family.
|
|
63
|
+
*/
|
|
64
|
+
export function getVersionHistory(modelFamily) {
|
|
65
|
+
return Array.from(store.modelVersions.values())
|
|
66
|
+
.filter(v => v.modelFamily === modelFamily)
|
|
67
|
+
.sort((a, b) => a.version - b.version);
|
|
68
|
+
}
|
|
69
|
+
// ─── Training Round Management ───────────────────────
|
|
70
|
+
/**
|
|
71
|
+
* Create a new training round for a model family.
|
|
72
|
+
*/
|
|
73
|
+
export function createTrainingRound(modelFamily, config, options) {
|
|
74
|
+
const latestVersion = getLatestVersion(modelFamily);
|
|
75
|
+
if (!latestVersion) {
|
|
76
|
+
throw new Error(`No base model registered for family '${modelFamily}'. Call registerBaseModel first.`);
|
|
77
|
+
}
|
|
78
|
+
const now = new Date();
|
|
79
|
+
const deadline = new Date(now.getTime() + (options?.deadlineHours || 24) * 3600000);
|
|
80
|
+
const round = {
|
|
81
|
+
id: randomUUID(),
|
|
82
|
+
modelFamily,
|
|
83
|
+
baseVersionId: latestVersion.id,
|
|
84
|
+
configCid: options?.configCid || `config-${randomUUID().slice(0, 8)}`,
|
|
85
|
+
status: 'pending',
|
|
86
|
+
config,
|
|
87
|
+
participants: [],
|
|
88
|
+
minParticipants: options?.minParticipants || 3,
|
|
89
|
+
maxParticipants: options?.maxParticipants || 50,
|
|
90
|
+
deadline: deadline.toISOString(),
|
|
91
|
+
createdAt: now.toISOString(),
|
|
92
|
+
updatedAt: now.toISOString(),
|
|
93
|
+
};
|
|
94
|
+
store.trainingRounds.set(round.id, round);
|
|
95
|
+
return round;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Agent claims a training round.
|
|
99
|
+
*/
|
|
100
|
+
export function claimTrainingRound(roundId, agentId) {
|
|
101
|
+
const round = store.trainingRounds.get(roundId);
|
|
102
|
+
if (!round)
|
|
103
|
+
throw new Error(`Training round '${roundId}' not found`);
|
|
104
|
+
if (round.status !== 'pending' && round.status !== 'active') {
|
|
105
|
+
throw new Error(`Round '${roundId}' is ${round.status}, cannot claim`);
|
|
106
|
+
}
|
|
107
|
+
if (round.participants.length >= round.maxParticipants) {
|
|
108
|
+
throw new Error(`Round '${roundId}' is full (${round.maxParticipants} participants)`);
|
|
109
|
+
}
|
|
110
|
+
if (round.participants.some(p => p.agentId === agentId)) {
|
|
111
|
+
throw new Error(`Agent '${agentId}' already claimed this round`);
|
|
112
|
+
}
|
|
113
|
+
if (new Date(round.deadline).getTime() < Date.now()) {
|
|
114
|
+
throw new Error(`Round '${roundId}' deadline has passed`);
|
|
115
|
+
}
|
|
116
|
+
const participant = {
|
|
117
|
+
agentId,
|
|
118
|
+
status: 'claimed',
|
|
119
|
+
claimedAt: new Date().toISOString(),
|
|
120
|
+
};
|
|
121
|
+
round.participants.push(participant);
|
|
122
|
+
// Move to active if first participant
|
|
123
|
+
if (round.status === 'pending') {
|
|
124
|
+
round.status = 'active';
|
|
125
|
+
}
|
|
126
|
+
round.updatedAt = new Date().toISOString();
|
|
127
|
+
// Track agent history
|
|
128
|
+
const history = store.agentHistory.get(agentId) || [];
|
|
129
|
+
history.push(roundId);
|
|
130
|
+
store.agentHistory.set(agentId, history);
|
|
131
|
+
return participant;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Agent uploads a weight delta for a training round.
|
|
135
|
+
*/
|
|
136
|
+
export function submitWeightDelta(roundId, agentId, delta) {
|
|
137
|
+
const round = store.trainingRounds.get(roundId);
|
|
138
|
+
if (!round)
|
|
139
|
+
throw new Error(`Training round '${roundId}' not found`);
|
|
140
|
+
if (round.status !== 'active') {
|
|
141
|
+
throw new Error(`Round '${roundId}' is ${round.status}, cannot submit`);
|
|
142
|
+
}
|
|
143
|
+
const participant = round.participants.find(p => p.agentId === agentId);
|
|
144
|
+
if (!participant)
|
|
145
|
+
throw new Error(`Agent '${agentId}' is not a participant in round '${roundId}'`);
|
|
146
|
+
if (participant.status !== 'claimed' && participant.status !== 'training') {
|
|
147
|
+
throw new Error(`Agent '${agentId}' already submitted or was rejected`);
|
|
148
|
+
}
|
|
149
|
+
const weightDelta = {
|
|
150
|
+
...delta,
|
|
151
|
+
agentId,
|
|
152
|
+
roundId,
|
|
153
|
+
};
|
|
154
|
+
// Validate the delta
|
|
155
|
+
const validation = validateDelta(weightDelta, round.config);
|
|
156
|
+
participant.validation = validation;
|
|
157
|
+
if (validation.valid) {
|
|
158
|
+
participant.status = 'uploaded';
|
|
159
|
+
participant.deltaCid = delta.cid;
|
|
160
|
+
participant.uploadedAt = new Date().toISOString();
|
|
161
|
+
store.weightDeltas.set(delta.cid, weightDelta);
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
participant.status = 'rejected';
|
|
165
|
+
}
|
|
166
|
+
round.updatedAt = new Date().toISOString();
|
|
167
|
+
// Check if we can aggregate
|
|
168
|
+
const uploadedCount = round.participants.filter(p => p.status === 'uploaded').length;
|
|
169
|
+
if (uploadedCount >= round.minParticipants &&
|
|
170
|
+
(uploadedCount >= round.maxParticipants || new Date(round.deadline).getTime() < Date.now())) {
|
|
171
|
+
// Auto-trigger aggregation
|
|
172
|
+
aggregateRound(roundId);
|
|
173
|
+
}
|
|
174
|
+
return weightDelta;
|
|
175
|
+
}
|
|
176
|
+
// ─── Validation ──────────────────────────────────────
|
|
177
|
+
/**
|
|
178
|
+
* Validate a weight delta for anomalies and compliance.
|
|
179
|
+
* Returns validation result with anomaly scores.
|
|
180
|
+
*/
|
|
181
|
+
function validateDelta(delta, config) {
|
|
182
|
+
const issues = [];
|
|
183
|
+
// Check L2 norm against expected range
|
|
184
|
+
// A very large norm suggests adversarial weights
|
|
185
|
+
const maxNorm = config.maxGradNorm * config.localEpochs * 2;
|
|
186
|
+
if (delta.l2Norm > maxNorm) {
|
|
187
|
+
issues.push(`L2 norm ${delta.l2Norm} exceeds max ${maxNorm}`);
|
|
188
|
+
}
|
|
189
|
+
// Check LoRA format matches config
|
|
190
|
+
if (delta.format.rank !== config.loraRank) {
|
|
191
|
+
issues.push(`LoRA rank mismatch: expected ${config.loraRank}, got ${delta.format.rank}`);
|
|
192
|
+
}
|
|
193
|
+
if (delta.format.alpha !== config.loraAlpha) {
|
|
194
|
+
issues.push(`LoRA alpha mismatch: expected ${config.loraAlpha}, got ${delta.format.alpha}`);
|
|
195
|
+
}
|
|
196
|
+
// Check minimum training data
|
|
197
|
+
if (delta.trainingExamples < config.minLocalExamples) {
|
|
198
|
+
issues.push(`Too few examples: ${delta.trainingExamples} < ${config.minLocalExamples}`);
|
|
199
|
+
}
|
|
200
|
+
// Anomaly score: 0 = normal, 1 = very suspicious
|
|
201
|
+
let anomalyScore = 0;
|
|
202
|
+
anomalyScore += Math.min(1, delta.l2Norm / maxNorm) * 0.5; // Norm contribution
|
|
203
|
+
if (delta.sizeBytes < 1000)
|
|
204
|
+
anomalyScore += 0.3; // Suspiciously small
|
|
205
|
+
if (delta.trainingExamples < config.minLocalExamples * 2)
|
|
206
|
+
anomalyScore += 0.2; // Low data
|
|
207
|
+
anomalyScore = Math.min(1, anomalyScore);
|
|
208
|
+
return {
|
|
209
|
+
valid: issues.length === 0 && anomalyScore < 0.8,
|
|
210
|
+
deltaL2Norm: delta.l2Norm,
|
|
211
|
+
anomalyScore: Math.round(anomalyScore * 1000) / 1000,
|
|
212
|
+
reason: issues.length > 0 ? issues.join('; ') : undefined,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
// ─── Aggregation ─────────────────────────────────────
|
|
216
|
+
/**
|
|
217
|
+
* Aggregate weight deltas from a training round into a new model version.
|
|
218
|
+
* Uses federated median (Byzantine-tolerant) by default.
|
|
219
|
+
*/
|
|
220
|
+
export function aggregateRound(roundId, method = 'fedmedian') {
|
|
221
|
+
const round = store.trainingRounds.get(roundId);
|
|
222
|
+
if (!round)
|
|
223
|
+
throw new Error(`Training round '${roundId}' not found`);
|
|
224
|
+
const validParticipants = round.participants.filter(p => p.status === 'uploaded');
|
|
225
|
+
if (validParticipants.length < round.minParticipants) {
|
|
226
|
+
throw new Error(`Not enough valid participants: ${validParticipants.length} < ${round.minParticipants}`);
|
|
227
|
+
}
|
|
228
|
+
round.status = 'aggregating';
|
|
229
|
+
round.updatedAt = new Date().toISOString();
|
|
230
|
+
const startTime = Date.now();
|
|
231
|
+
// Collect deltas
|
|
232
|
+
const deltas = validParticipants
|
|
233
|
+
.map(p => store.weightDeltas.get(p.deltaCid))
|
|
234
|
+
.filter((d) => d !== undefined);
|
|
235
|
+
// Calculate aggregate norm (simulated — real impl would do actual weight math)
|
|
236
|
+
let aggregateNorm;
|
|
237
|
+
const norms = deltas.map(d => d.l2Norm);
|
|
238
|
+
switch (method) {
|
|
239
|
+
case 'fedavg':
|
|
240
|
+
// Weighted average by training examples
|
|
241
|
+
const totalExamples = deltas.reduce((sum, d) => sum + d.trainingExamples, 0);
|
|
242
|
+
aggregateNorm = deltas.reduce((sum, d) => sum + (d.l2Norm * d.trainingExamples / totalExamples), 0);
|
|
243
|
+
break;
|
|
244
|
+
case 'fedmedian':
|
|
245
|
+
// Coordinate-wise median — most Byzantine-tolerant
|
|
246
|
+
norms.sort((a, b) => a - b);
|
|
247
|
+
aggregateNorm = norms[Math.floor(norms.length / 2)];
|
|
248
|
+
break;
|
|
249
|
+
case 'trimmed_mean':
|
|
250
|
+
// Remove top/bottom 10%, average the rest
|
|
251
|
+
norms.sort((a, b) => a - b);
|
|
252
|
+
const trim = Math.max(1, Math.floor(norms.length * 0.1));
|
|
253
|
+
const trimmed = norms.slice(trim, -trim);
|
|
254
|
+
aggregateNorm = trimmed.reduce((a, b) => a + b, 0) / trimmed.length;
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
// Apply differential privacy noise if configured
|
|
258
|
+
let dpNoiseScale;
|
|
259
|
+
if (round.config.dpEpsilon) {
|
|
260
|
+
// Gaussian mechanism: noise proportional to sensitivity / epsilon
|
|
261
|
+
dpNoiseScale = round.config.maxGradNorm / round.config.dpEpsilon;
|
|
262
|
+
// In real impl, would add calibrated noise to each parameter
|
|
263
|
+
}
|
|
264
|
+
const totalExamples = deltas.reduce((sum, d) => sum + d.trainingExamples, 0);
|
|
265
|
+
const aggregationTimeMs = Date.now() - startTime;
|
|
266
|
+
// Create aggregated adapter CID (simulated)
|
|
267
|
+
const adapterCid = `adapter-${roundId.slice(0, 8)}-${randomUUID().slice(0, 8)}`;
|
|
268
|
+
// Create new model version
|
|
269
|
+
const baseVersion = store.modelVersions.get(round.baseVersionId);
|
|
270
|
+
const newVersion = {
|
|
271
|
+
id: randomUUID(),
|
|
272
|
+
modelFamily: round.modelFamily,
|
|
273
|
+
version: baseVersion.version + 1,
|
|
274
|
+
baseModelCid: baseVersion.baseModelCid,
|
|
275
|
+
adapterCid,
|
|
276
|
+
trainingRoundIds: [...baseVersion.trainingRoundIds, roundId],
|
|
277
|
+
metrics: {
|
|
278
|
+
totalTrainingExamples: baseVersion.metrics.totalTrainingExamples + totalExamples,
|
|
279
|
+
participantCount: baseVersion.metrics.participantCount + validParticipants.length,
|
|
280
|
+
},
|
|
281
|
+
createdAt: new Date().toISOString(),
|
|
282
|
+
parentVersionId: baseVersion.id,
|
|
283
|
+
};
|
|
284
|
+
store.modelVersions.set(newVersion.id, newVersion);
|
|
285
|
+
store.latestVersions.set(round.modelFamily, newVersion.id);
|
|
286
|
+
// Mark participants as validated
|
|
287
|
+
for (const p of validParticipants) {
|
|
288
|
+
p.status = 'validated';
|
|
289
|
+
}
|
|
290
|
+
// Update round
|
|
291
|
+
round.status = 'complete';
|
|
292
|
+
round.resultVersionId = newVersion.id;
|
|
293
|
+
round.aggregationStats = {
|
|
294
|
+
method,
|
|
295
|
+
participantsUsed: validParticipants.length,
|
|
296
|
+
participantsRejected: round.participants.filter(p => p.status === 'rejected').length,
|
|
297
|
+
aggregateDeltaNorm: Math.round(aggregateNorm * 1000) / 1000,
|
|
298
|
+
totalExamples,
|
|
299
|
+
aggregationTimeMs,
|
|
300
|
+
dpNoiseScale,
|
|
301
|
+
};
|
|
302
|
+
round.updatedAt = new Date().toISOString();
|
|
303
|
+
return newVersion;
|
|
304
|
+
}
|
|
305
|
+
// ─── Queries ─────────────────────────────────────────
|
|
306
|
+
export function getTrainingRound(roundId) {
|
|
307
|
+
return store.trainingRounds.get(roundId);
|
|
308
|
+
}
|
|
309
|
+
export function getModelVersion(versionId) {
|
|
310
|
+
return store.modelVersions.get(versionId);
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Get active training rounds an agent can join.
|
|
314
|
+
*/
|
|
315
|
+
export function getAvailableRounds(agentId) {
|
|
316
|
+
return Array.from(store.trainingRounds.values())
|
|
317
|
+
.filter(r => {
|
|
318
|
+
if (r.status !== 'pending' && r.status !== 'active')
|
|
319
|
+
return false;
|
|
320
|
+
if (new Date(r.deadline).getTime() < Date.now())
|
|
321
|
+
return false;
|
|
322
|
+
if (r.participants.length >= r.maxParticipants)
|
|
323
|
+
return false;
|
|
324
|
+
if (agentId && r.participants.some(p => p.agentId === agentId))
|
|
325
|
+
return false;
|
|
326
|
+
return true;
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Get all rounds an agent has participated in.
|
|
331
|
+
*/
|
|
332
|
+
export function getAgentTrainingHistory(agentId) {
|
|
333
|
+
const roundIds = store.agentHistory.get(agentId) || [];
|
|
334
|
+
return roundIds
|
|
335
|
+
.map(id => store.trainingRounds.get(id))
|
|
336
|
+
.filter((r) => r !== undefined);
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Get network-wide training stats.
|
|
340
|
+
*/
|
|
341
|
+
export function getTrainingStats() {
|
|
342
|
+
const rounds = Array.from(store.trainingRounds.values());
|
|
343
|
+
const families = new Set(rounds.map(r => r.modelFamily));
|
|
344
|
+
return {
|
|
345
|
+
totalRounds: rounds.length,
|
|
346
|
+
completedRounds: rounds.filter(r => r.status === 'complete').length,
|
|
347
|
+
activeRounds: rounds.filter(r => r.status === 'active' || r.status === 'pending').length,
|
|
348
|
+
totalParticipations: rounds.reduce((sum, r) => sum + r.participants.length, 0),
|
|
349
|
+
totalExamplesProcessed: rounds
|
|
350
|
+
.filter(r => r.aggregationStats)
|
|
351
|
+
.reduce((sum, r) => sum + (r.aggregationStats?.totalExamples || 0), 0),
|
|
352
|
+
modelFamilies: Array.from(families),
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* List all registered model families with their latest versions.
|
|
357
|
+
*/
|
|
358
|
+
export function listModelFamilies() {
|
|
359
|
+
return Array.from(store.latestVersions.entries()).map(([family, versionId]) => {
|
|
360
|
+
const version = store.modelVersions.get(versionId);
|
|
361
|
+
return {
|
|
362
|
+
family,
|
|
363
|
+
latestVersion: version.version,
|
|
364
|
+
latestVersionId: versionId,
|
|
365
|
+
totalRounds: version.trainingRoundIds.length,
|
|
366
|
+
};
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
// ─── Reset (Testing) ────────────────────────────────
|
|
370
|
+
export function clearFederation() {
|
|
371
|
+
store.modelVersions.clear();
|
|
372
|
+
store.trainingRounds.clear();
|
|
373
|
+
store.weightDeltas.clear();
|
|
374
|
+
store.latestVersions.clear();
|
|
375
|
+
store.agentHistory.clear();
|
|
376
|
+
}
|
|
377
|
+
//# sourceMappingURL=federation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"federation.js","sourceRoot":"","sources":["../src/federation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAiKpC,MAAM,KAAK,GAAoB;IAC7B,aAAa,EAAE,IAAI,GAAG,EAAE;IACxB,cAAc,EAAE,IAAI,GAAG,EAAE;IACzB,YAAY,EAAE,IAAI,GAAG,EAAE;IACvB,cAAc,EAAE,IAAI,GAAG,EAAE;IACzB,YAAY,EAAE,IAAI,GAAG,EAAE;CACxB,CAAC;AAEF,wDAAwD;AAExD;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,WAAmB,EACnB,YAAoB,EACpB,OAA+B;IAE/B,MAAM,OAAO,GAAiB;QAC5B,EAAE,EAAE,UAAU,EAAE;QAChB,WAAW;QACX,OAAO,EAAE,CAAC;QACV,YAAY;QACZ,UAAU,EAAE,IAAI;QAChB,gBAAgB,EAAE,EAAE;QACpB,OAAO,EAAE;YACP,qBAAqB,EAAE,CAAC;YACxB,gBAAgB,EAAE,CAAC;YACnB,GAAG,OAAO;SACX;QACD,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,eAAe,EAAE,IAAI;KACtB,CAAC;IAEF,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7C,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IAClD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAA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CAAC,CAAC,gBAAgB,EAAE,aAAa,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;QACxE,aAAa,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;KACpC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAM/B,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,EAAE;QAC5E,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,CAAE,CAAC;QACpD,OAAO;YACL,MAAM;YACN,aAAa,EAAE,OAAO,CAAC,OAAO;YAC9B,eAAe,EAAE,SAAS;YAC1B,WAAW,EAAE,OAAO,CAAC,gBAAgB,CAAC,MAAM;SAC7C,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,uDAAuD;AAEvD,MAAM,UAAU,eAAe;IAC7B,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;IAC5B,KAAK,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;IAC7B,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAC3B,KAAK,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;IAC7B,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;AAC7B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dpth.io — The Distributed Intelligence Layer
|
|
3
|
+
*
|
|
4
|
+
* Decentralized AI inference, data intelligence, and agent coordination.
|
|
5
|
+
*
|
|
6
|
+
* Core modules:
|
|
7
|
+
* - Entity: Unified identity across sources with temporal history
|
|
8
|
+
* - Correlation: Cross-source pattern detection and causality discovery
|
|
9
|
+
* - Temporal: Time-native storage where every value has history
|
|
10
|
+
* - Embed: Semantic search and similarity across all data
|
|
11
|
+
* - Ingest: Data ingestion pipeline from connectors
|
|
12
|
+
* - Agent SDK: Client for agents to participate in the network
|
|
13
|
+
* - Fallback: Centralized inference when no agents available
|
|
14
|
+
*/
|
|
15
|
+
export * from './types.js';
|
|
16
|
+
export * from './entity.js';
|
|
17
|
+
export * from './correlation.js';
|
|
18
|
+
export * from './temporal.js';
|
|
19
|
+
export * from './embed.js';
|
|
20
|
+
export * from './agent-sdk.js';
|
|
21
|
+
export * from './fallback.js';
|
|
22
|
+
export * from './economics.js';
|
|
23
|
+
export * from './federation.js';
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC"}
|