Given K≥2 weight tensors from models with identical architecture: {T(1),T(2),…,T(K)},T(k)∈Rd1×⋯×dn,
Step 1: Flatten and RMS-normalize each tensor
Flatten each tensor into a vector and normalize by its RMS: x(k)=flatten(T(k))∈RD,D=i=1∏ndi rk=RMS(x(k))=D1i=1∑D(xi(k))2+ε u(k)=rk+εx(k)
Step 2: Determine Center Point
Case A: Anchor Mode
m=un
Case B: No Anchor Mode
Subcase B1:
Compute the geometric median via the Weiszfeld algorithm:
m=argymini=1∑K∥ui−y∥2
Subcase B2:
Use coordinate-wise median:
mj=median(u1,j,u2,j,…,uK,j),∀j=1,…,D
Step 3: Compute residual matrix
R=U−1Km⊤∈RK×D
Step 4: Early exit if residuals are negligible
If kmax∥Rk,:∥2<10−7, then set y′=m and skip to Step 8. Otherwise, proceed.
Step 5: Perform SVD on residuals
Compute the thin SVD of R^⊤∈R^D×K: R⊤=UΣV⊤ Let min(K−1,rank(R)), and take the first r' columns of U : Ur′=U[:,:r′]∈RD×r′
Step 6: Compute energy-based scaling factor
Total energy: Etotal=i=1∑rankσi2 Retained energy: Eretained=i=1∑r′σi2 Energy ratio: p=Etotal+εEretained Scaling factor (clamped for stability): λ=min(p+ε1,10.0)
Coordinate-wise weights: wk,jcoord=[max(0,1−(c⋅sj+ε∣Zk,j∣)2)]2 Global (per-model) weights: wkglobal=[max(0,1−(c⋅sglobal+ε∥zk∥)2)]2 Combined weights: Wk,j=wk,jcoord⋅wkglobal
Compute robust consensus in subspace
zj∗=∑k=1KWk,j+ε∑k=1KWk,jZk,j,j=1,…,r′ Reconstruct robust residual: r∗=λ⋅Ur′z∗∈RD Final estimate in normalized space: y′=m+r∗
Step 8: Restore average RMS scale
Compute mean RMS across inputs: rˉ=K1k=1∑Krk Scale back: y=y′⋅rˉ
Step 9: Final L2 norm alignment
Compute average L2 norm of original flattened tensors: nˉ=K1k=1∑K∥x(k)∥2 Compute current norm: ny=∥y∥2 Final scaling factor: α=ny+εnˉ Scaled output vector: x^=α⋅y Reshape to original tensor shape: T^=reshape(x^,(d1,…,dn))