Shared-Private Matrix-Weighted Expert Layers
Implementation & benchmark of arXiv:2607.06970 — Subspace Consensus of Matrix-Weighted Networks
Source paper: Subspace Consensus of Matrix-Weighted Networks arXiv:2607.06970 ⓘ · analyzed Aug 30, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Build a multi-expert or multi-task layer whose feature channels are divided into a globally shared subspace and expert-private subspaces. Matrix-weighted message passing couples experts only through selected feature directions, while the nullspace preserves specialization; the graph-cut condition provides a concrete test that the shared channels can propagate across all experts rather than becoming disconnected islands.
Formulas
Mathematical statement
Let z_i\in\mathbb{R}^d denote the representation or parameter vector of expert or task i, and let \mathbb{V}=\operatorname{span}(U) be the r-dimensional shared feature subspace with orthogonal projector P_{\mathbb{V}}=UU^T. A matrix-weighted expert graph uses symmetric positive-semidefinite A_{ij} to penalize only differences visible through A_{ij}. The paper's necessary-and-sufficient condition is $$\mathbb{V}\perp\left(\bigcap_{(i,j)\in\mathcal{E}(S,\bar S)}\operatorname{null}(A_{ij})\right),\ \forall S\subseteq\mathcal{V}.$$ The notation means that for every partition of experts into S and its complement, no nonzero vector in the desired shared subspace can be invisible to every edge crossing that partition. A sufficient construction is A_{ij}=UC_{ij}U^T, with C_{ij} positive definite on every cut edge. The corresponding regularizer is $$\mathcal{R}_{\mathrm{shared}}=\frac12\sum_{(i,j)\in\mathcal{E}}(z_i-z_j)^TA_{ij}(z_i-z_j),$$ which equals $$\frac12\sum_{(i,j)\in\mathcal{E}}(U^Tz_i-U^Tz_j)^TC_{ij}(U^Tz_i-U^Tz_j).$$ Thus private coordinates in \mathbb{V}^{\perp}=\operatorname{null}(U^T) receive zero coupling when A_{ij} has range exactly \mathbb{V}.
Implementation notes
Integrate the method into a mixture-of-experts transformer or a multi-task graph neural network at the expert output projection, before the router combines expert outputs. Represent each expert's selected feature vector as z_i in R^d and choose an orthonormal shared basis U in R^{d x r}. Parameterize each expert as W_i = U B_shared + (I-U@U.T) B_i_private for a low-rank shared matrix B_shared and an expert-specific residual B_i_private, or use the same decomposition on hidden activations. During training, add the exact regularizer R_shared shown in the formulas, with A_{ij}=U C_{ij} U.T; do not penalize private residuals. The update loop is: compute task losses L_i; compute projected differences q_ij=U.T@(z_i-z_j); accumulate g_i_shared=sum_j C_ij@q_ij; update each expert with z_i -= eta_r*grad_L_i + eta_s*U@g_i_shared. Estimate whether synchronization is structurally possible by sampling cuts S and calculating lambda_min(sum_(i,j crossing S) C_ij); if this is near zero, add an edge or increase its rank rather than merely increasing the regularization coefficient. The first cheap experiment should use a 4-expert, 2-layer transformer on a mixture of four perturbed language-classification tasks, comparing independent experts, standard shared-bottom training, and this shared-private layer at equal parameter count. Sweep r over 10%, 25%, and 50% of channels. Measure average task accuracy, worst-task accuracy, expert diversity in private coordinates, pairwise disagreement in shared coordinates, and routing load balance. Success is improved worst-task accuracy without collapse of private diversity, with shared-coordinate disagreement decreasing while private-coordinate covariance remains substantially larger than in fully shared experts.
Verification
Stage 1 · Toy mechanism gate: Passed ✓
Stage 2 · Mechanism transferred to benchmark: Confirmed ✓
Stage 2 · Practical benchmark result: No measurable effect
Methodology: 8 paired seeds, permutation test (p<0.05) against a learning-rate-tuned baseline. How verification works
Stage 1 — Mechanism check agent confidence 9/10
Built a compact shared-private matrix-weighted expert simulation and verified the core mechanism. The contraction sweep matched the predicted factor |1-eta*gamma*lambda| to numerical precision, private-coordinate change stayed below 2e-15, and the stability transition occurred at eta*gamma*lambda_max=2 as predicted. The graph-cut condition behaved correctly, and shared-private coupling reduced shared disagreement while preserving private diversity unlike full sharing.
- Agent confidence
- 9/10
- Baseline
- Independent: shared MSE 4.81e-34, shared disagreement 0.7028, private pairwise distance 10.573. Fully shared: shared MSE 0.7028, disagreement 0, private distance 0.
- Idea
- Shared-private: shared MSE 0.1192, shared disagreement 0.2432, private pairwise distance 10.573. Contraction predictions matched observed values exactly for gamma values 0.1, 0.5, 1, 2, and 3.5; private change was below 2e-15. Stability matched the predicted boundary eta*gamma*lambda_max=2.
Limitations: This is a NumPy toy consensus and quadratic optimization experiment, not a transformer, MoE router, or language-classification benchmark. It does not test equal-parameter-count neural models, learned shared bases, noisy or stochastic gradients, routing balance, or scalability beyond four experts.
How to run: python3 experiment.py
Stage 2 — Benchmark vs. tuned baseline (arXiv:2607.06970)
Beats the tuned baseline by -0.0002 metric points (p=0.0081, wins 8 / 8 paired seeds; metric: lower is better).
- Benchmark
- Dynamics forecasting
- Model
- rnn_small
- Paired seeds
- 8
- Baseline mean
- 0
- Idea mean
- 0.0037
- Effect (Δ)
- -0.0002 (n/a; negative = idea better)
- Wins
- 8 / 8 paired seeds
- p-value
- 0.0081 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- n/a
- Mechanism
- Confirmed ✓
- Practical effect
- No effect
- Baseline tuning
- swept over 0 configs
The requested bench README was absent. Only the dynamics track was tested. The intervention required a custom multi-expert training loop rather than bench.train_model. The shared basis was fixed rather than learned, and CUDA failed due to cuDNN host-allocation pressure, so final results came from the automatic CPU fallback. The baseline was independent experts with the same custom GRU architecture, not the single-model built-in rnn_small path.
How to run: python3 bench_experiment.py
Verdict computed by deterministic test code from paired-seed statistics — not by the language model.
Stage 2 — Benchmark latest Worked ✓
Agent confidence: 8/10
Implemented shared-private matrix-weighted coupling on the structurally matched dynamics track using four identical GRU experts and A_ij=UU^T. Across 8 paired seeds, test MSE improved from 0.00392444 to 0.00368556, with paired delta -0.00023888 and permutation p=0.0081; shared disagreement decreased while private variance remained nonzero. CUDA cuDNN allocation failed in the shared environment, and the implemented CPU fallback completed the run.
- Baseline
- Dynamics four-independent-expert baseline, lr=0.01, wd=0.0001, 12 epochs: test MSE 0.0039244446 ± 0.0009507399.
- Idea
- Shared-private rank=8, coupling=0.03, same lr/wd/epochs: test MSE 0.0036855603 ± 0.0008949623; paired delta -0.0002388843; permutation p=0.0081; 8/8 paired wins. Shared disagreement 0.0204189 vs baseline 0.0651100; private variance 0.0840237 vs 0.0804247; mechanism confirmed=true.
Benchmark result
Beats the tuned baseline by -0.0002 metric points (p=0.0081, wins 8 / 8 paired seeds; metric: lower is better).
- Benchmark
- Dynamics forecasting
- Model
- rnn_small
- Paired seeds
- 8
- Baseline mean
- 0
- Idea mean
- 0.0037
- Effect (Δ)
- -0.0002 (n/a; negative = idea better)
- Wins
- 8 / 8 paired seeds
- p-value
- 0.0081 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- n/a
- Mechanism
- Confirmed ✓
- Practical effect
- No effect
- Baseline tuning
- swept over 0 configs
The requested bench README was absent. Only the dynamics track was tested. The intervention required a custom multi-expert training loop rather than bench.train_model. The shared basis was fixed rather than learned, and CUDA failed due to cuDNN host-allocation pressure, so final results came from the automatic CPU fallback. The baseline was independent experts with the same custom GRU architecture, not the single-model built-in rnn_small path.
How to run: python3 bench_experiment.py
Artifacts
- bench_experiment.py 5.3 KB View Raw
- bench_report.json 3.3 KB View Raw
- experiment.py 4.4 KB View Raw
- report.md 1.5 KB View
- report_bench_2026-09-02T215545.md 3.2 KB View
- results.json 2.7 KB View Raw