Federated Learning
src/lib/federated-learning.ts lets the learning system improve across users without sharing
individual data.
The protocol
- Each client trains locally on its own quiz observations
- The client computes a BKT parameter delta (not raw data)
- The delta’s sensitivity is bounded by gradient clipping (
clipNorm) - Gaussian noise is added for (ε, δ)-differential privacy
- The noised delta is sent to the server
- The server aggregates deltas via weighted averaging into a
GlobalModel
Key types
src/lib/federated-learning.ts
export interface FederatedUpdate { /* gradient delta with DP noise */ }
export interface BKTParamDelta { /* per-parameter adjustments */ }
export interface GlobalModel { /* aggregated state across clients */ }
export interface PrivacyParams {
epsilon: number // privacy budget ε
// delta δ
clipNorm: number // gradient clipping norm
// noise scale — computed from ε, δ, clipNorm
}Guarantees
- What leaves the device: a clipped, noised parameter delta — never observations, video content, or identity
- Formal privacy: Gaussian-mechanism (ε, δ)-DP with sensitivity bounded by
clipNorm - Utility: weighted averaging favors clients with more observations, so the global BKT parameters converge toward population-realistic values