# Win-Martingale Adaptive Router

- ID: 1187
- Canonical URL: https://synthcore.org/idea/1187/win-martingale-adaptive-router
- API JSON: https://synthcore.org/api/idea/1187.json
- API Markdown: https://synthcore.org/api/idea/1187.md
- Verification status: unverified
- Source: [arXiv:2607.20373](https://arxiv.org/abs/2607.20373)
- Category: architecture
- Solves: scalability, stability, accuracy
- ML areas: moe-routing, transformer, inference-speedup, training
- Math tags: stochastic-processes, probability, dynamical-systems
- Ratings: usefulness 6/10; difficulty 5/10; novelty 7/10

## Idea description

Replace a conventional softmax router or fixed halting score with a scalar confidence state that evolves as a bounded martingale diffusion. The state starts at the network's prior confidence, receives evidence-dependent stochastic increments, and is absorbed at 0 or 1; absorption selects an MoE expert or halts additional transformer blocks. State-dependent volatility lets the model explore aggressively when uncertain and commit rapidly when confident, while the martingale constraint prevents systematic confidence drift in the absence of evidence.

## Mathematical statement

The paper's Definition (2.1) uses an autonomous win-martingale \(\Pi_t\) satisfying \(\Pi_t=\pi+\int_0^{t\wedge\tau}\sigma(\Pi_s)\,dB_s\), where \(\pi\in(0,1)\) is the initial state, \(B_t\) is standard Brownian motion, \(\sigma:(0,1)\to(0,\infty)\) is a \(C^1\) volatility function, and \(\tau=\inf\{t\ge0:\Pi_t\in\{0,1\}\}\) is the absorption time. Lemma 2.1 states that the SDE has a pathwise unique strong solution, remains in \([0,1]\), is a bounded uniformly integrable martingale, and converges almost surely and in \(L^1\) to \(\Pi_\infty\in\{0,1\}\), with \(\mathbb P(\Pi_\infty=1)=\pi\). The martingale property gives \(\mathbb E[\Pi_t\mid\mathcal F_s]=\Pi_s\) for \(s\le t\), so expected future confidence equals current confidence. Its interior generator is \(\mathcal Lf(p)=\tfrac12\sigma(p)^2f''(p)\). The adaptation uses \(\sigma(p,h)\) as a learned compute-versus-exploration control while retaining boundedness and unbiased conditional confidence.

## Key formulas

- $$\Pi_t=\pi+\int_0^{t\wedge\tau}\sigma(\Pi_s)\,dB_s,\qquad \tau=\inf\{t\ge0:\Pi_t\in\{0,1\}\}.$$
- $$\Pi_t\in[0,1],\qquad \mathbb E[\Pi_t\mid\mathcal F_s]=\Pi_s\quad(s\le t),\qquad \Pi_t\xrightarrow[t\to\infty]{}\Pi_\infty\in\{0,1\},\qquad \mathbb P(\Pi_\infty=1)=\pi.$$
- $$\mathcal Lf(p)=\frac12\sigma(p)^2f''(p),\qquad dp_t=\sigma_\theta(p_t,h_t)\,dB_t.$$
- $$p_{k+1}=\operatorname{Absorb}_{[0,1]}\left(p_k+\sigma_\theta(p_k,h_k)\sqrt{\Delta t}\,\varepsilon_k\right),\qquad \varepsilon_k\sim\mathcal N(0,1).$$

## Implementation notes

Integrate this into the per-token adaptive-depth controller or the MoE router, rather than into the main hidden-state update. Let \(h_k\) be the token representation after layer or routing step \(k\), and initialize \(p_0=\operatorname{sigmoid}(w^Th_0+b)\). Use a positive volatility such as \(\sigma_\theta(p,h)=\sigma_{\min}+\operatorname{softplus}(a^T[h,p,p(1-p)]+c)\), clipped to \(\sigma_{\max}\). At each step sample \(\varepsilon_k\sim\mathcal N(0,1)\), compute \(q=p_k+\sigma_\theta(p_k,h_k)\sqrt{\Delta t}\varepsilon_k\), and apply absorption: set \(p_{k+1}=0\) when \(q\le0\), set \(p_{k+1}=1\) when \(q\ge1\), and otherwise set \(p_{k+1}=q\). For adaptive depth, continue while \(p_k\in(\delta,1-\delta)\); halt with the positive branch at \(p_k\ge1-\delta\), and halt or skip at \(p_k\le\delta\). For MoE, use the terminal branch to select an expert and use a straight-through gate during training. The paper supplies the SDE, absorption rule, and martingale constraint; the implementation estimates \(\sigma_\theta\) from hidden states and approximates the diffusion by Euler-Maruyama. Add a calibration loss on the terminal decision and optionally a small variance penalty if trajectories are excessively noisy. First test a 6-layer Transformer on CIFAR-10 or a small language-model benchmark against fixed-depth inference and a standard sigmoid halting head. Measure accuracy at equal average layers, expected compute at equal accuracy, calibration error, absorption time, and empirical conditional drift \(\operatorname{mean}(p_{k+1}-p_k\mid p_k\text{ bin})\). Success means lower average depth at unchanged accuracy, bounded confidence trajectories, and near-zero conditional drift before absorption.

## Disclaimer

AI-generated research hypothesis, automatically tested. Not peer-reviewed.
