/** * Fisher-matrix methods for EWCConsolidator (compute/penalty/reset/online update). * File-size sweep: split out of ewc-consolidation.ts. Mixed into * EWCConsolidator.prototype at the bottom of ewc-consolidation.ts. * * @module v1/cli/memory/ewc-consolidation-fisher */ import type { EWCConsolidator } from './ewc-consolidation.js'; export declare const ewcFisherMethods: { /** * Compute Fisher Information Matrix from gradient history * Uses diagonal approximation for efficiency: F_i = E[g_i^2] * * @param patterns - Array of patterns with their gradients/embeddings * @returns Fisher information diagonal */ computeFisherMatrix(this: EWCConsolidator, patterns: { id: string; embedding: number[]; success: boolean; }[]): number[]; /** * Calculate EWC regularization penalty * * L_ewc = (lambda/2) * sum_i(F_i * (theta_i - theta_old_i)^2) * * @param oldWeights - Previous weight values * @param newWeights - New weight values * @param fisher - Fisher information diagonal (optional, uses global if not provided) * @returns Regularization penalty value */ getPenalty(this: EWCConsolidator, oldWeights: number[], newWeights: number[], fisher?: number[]): number; /** * Reset Fisher matrix (use with caution - allows forgetting) */ resetFisher(this: EWCConsolidator): void; /** * Update Fisher matrix from pattern confidence changes. * Called by SONA after distillLearning to track which patterns * are important and should be protected from forgetting. * * Uses online averaging: F_new = alpha * F_old + (1-alpha) * F_current * * @param confidenceChanges - Array of {id, embedding, oldConf, newConf} */ updateFisherFromConfidences(this: EWCConsolidator, confidenceChanges: { id: string; embedding: number[]; oldConf: number; newConf: number; }[]): void; /** * Compute consolidation penalty for a proposed confidence update. * Used by SONA to check whether a pattern update would cause forgetting. * * @param oldConfidence - Current confidence value * @param newConfidence - Proposed new confidence value * @returns Penalty value (higher = more forgetting risk) */ computeConfidencePenalty(this: EWCConsolidator, oldConfidence: number, newConfidence: number): number; }; //# sourceMappingURL=ewc-consolidation-fisher.d.ts.map