Skip to content

Menu

WorksComputer Science

DuplexTune: Coupled-State Replay for Memory-Efficient Mixture-of-Experts Adaptation

Download PDFView on arXiv

Ask your agent about this work

Your agent reads this work through Valency, with its citations and similar works. Paste this at the start of a chat.

Use the Valency MCP. Work: W_r8qhz375. Fetch it with get_paper_by_id, then find its nearest works with find_similar_papers and tell me what it adds.

Works with any MCP client. Not connected yet? Connect your agent

Abstract

Sparse expert execution does not remove the stored states needed to adapt a mixture-of-experts language model. We present DuplexTune, a framework for replaying coupled hidden states through pretrained attention and expert modules. Trainable width bridges connect two residual streams to the backbone. Bridge warm-up precedes backbone adaptation, with router weights kept frozen. We analyze the implicit state-recovery equation and identify the convergence and replay conditions needed for reconstruction. On Qwen1.5-MoE-A2.7B, the single-H800 evaluation reports 38.8 GB peak memory, versus 64.8 GB for supervised fine-tuning with checkpointing, and throughput of 25.1 versus 19.9 samples/s. DuplexTune achieves 67.2% MMLU, 75.6% GSM8K, and 7.69 MT-Bench, with a weaker multilingual score than the checkpointed baseline. The results characterize a configuration-dependent tradeoff among state storage, throughput, and adaptation quality.

Introduction

MoE activation is sparse, but training still maintains weights, gradients, optimizer states, and activations [1, 2]. Qwen1.5-MoE-A2.7B contains 14.3 billion parameters but activates approximately 2.7 billion [3]. Active computation and stored-state costs therefore need separate accounting when adapting Transformer language models [4, 5, 6].

LoRA restricts trainable updates, while QLoRA also quantizes the frozen backbone [7, 8]. ZeRO and FSDP shard model states [9, 10], whereas checkpointing recomputes intermediate features on single or multiple devices [11].

DuplexTune frames this target as coupled-state replay. Two half-width residual streams exchange information through pretrained attention and expert modules. Learnable width bridges connect the streams to those modules. Bridge warm-up establishes the interface before backbone adaptation updates attention, expert weights, and bridges while leaving router weights fixed. This expands learning beyond adapters without describing the frozen-router configuration as an update to every parameter.

Related Work

Routing and resource allocation. MoE surveys distinguish expert architecture, routing, and system execution [12]. At the agent level, KABB and GAM-Agent coordinate expertise [13, 14]. Training-system reviews separately examine memory placement, parallelism, and communication [15]. Agora trades uncertainty, while Markets of Minds evaluates assistance through marginal benefit and opportunity cost [16, 17]. Agent allocation and token-level state recovery operate at different granularities.

Adaptation objectives and optimization. PEFT surveys organize adaptation by the trainable parameterization [18]. CF-VLM and VLM learning dynamics address adaptation objectives [19, 20]. LoRA, DoRA, and (IA){sup}3 restrict trainable updates {citep}[7, 21, 22]. Self-rewarded multimodal reasoning studies adaptation signals, while MAT-Agent organizes training optimization {citep}[23, 24]. LOMO reduces optimization memory, GaLore projects gradients, and Adam determines optimizer-state costs {citep}[25, 26, 27]. OSC aligns collaborator knowledge, and failure-driven refinement organizes workflows {citep}[28, 29]`. These objectives and coordination mechanisms differ from activation replay.

Reconstruction and memory budgets. RevNet uses triangular coupling, and Reformer brings reversible layers to Transformers [30, 31]. Invertible residual networks recover states under a contraction condition [32], relevant to our query-dependent attention. Routing also appears in diffusion [33], targeting a different computation–quality tradeoff. FlashAttention reduces memory traffic through IO-aware exact attention, whereas ZeRO-Offload moves state and computation to the CPU [34, 35]. HTC-VLM compresses visual tokens; video encoders built on frozen image representations allocate tokens before temporal refinement [36, 37]. These mechanisms change different costs from retaining hidden states across layers.

DuplexTune architecture

Figure 1. DuplexTune architecture. (a) Adapted decoder stack. (b) Width-lift and width-return bridges connect paired states to pretrained attention and sparse experts. Attention updates aa to uu; expert processing then updates bb to vv before the channel join. (c) Schematic expert bank with frozen router weights during backbone adaptation.

Evaluation scope. MMLU, GSM8K, and MT-Bench assess knowledge, mathematical reasoning, and conversational responses [38, 39, 40]. Tri-MARF and MM-CoT instead examine annotation and visual reasoning [41, 42]. The multimodal and multi-agent studies above provide context for adaptation and allocation; they are not memory baselines in our language-model evaluation.

Coupled-State Replay with Width Bridges

Paired States and Width Bridges

Let H=[a,b]∈RB×S×dH = [a, b] \in\mathbb{R}^{B \times S \times d}, where each stream has width d/2d/2, BB is batch size, and SS is sequence length. The transition pair

Tin:Rd/2⟶Rd,Tout:Rd⟶Rd/2(1)T_{\mathrm{in}} : \mathbb{R}^{d/2} \longrightarrow\mathbb{R}^{d}, \qquad T_{\mathrm{out}} : \mathbb{R}^{d} \longrightarrow\mathbb{R}^{d/2} \tag*{(1)}

connects these streams to the pretrained sublayers. We call TinT_{\mathrm{in}} the width-lift bridge and ToutT_{\mathrm{out}} the width-return bridge. With stream normalization Norm⁡\operatorname{Norm}, the projected states are

aˉ=Tin(Norm⁡(a)),bˉ=Tin(Norm⁡(b)).(2)\bar{a} = T_{\mathrm{in}}(\operatorname{Norm}(a)), \qquad \bar{b} = T_{\mathrm{in}}(\operatorname{Norm}(b)). \tag*{(2)}

The wrapped attention and expert functions are

A(a,b)=ToutAttn⁡pt(aˉ,bˉ,bˉ),M(a)=ToutMoE⁡pt(Tin(Norm⁡(a))).(3)\begin{aligned} \mathcal{A}(a,b) &= T_{\mathrm{out}}\operatorname{Attn}_{\mathrm{pt}}(\bar{a},\bar{b},\bar{b}),\\ \mathcal{M}(a) &= T_{\mathrm{out}}\operatorname{MoE}_{\mathrm{pt}}(T_{\mathrm{in}}(\operatorname{Norm}(a))). \tag*{(3)} \end{aligned}

Attention uses queries from aa and keys and values from bb, with a causal mask. The coupled update is

u=a+A(a,b),v=b+M(u).(4)\begin{aligned} u &= a + \mathcal{A}(a,b),\\ v &= b + \mathcal{M}(u). \tag*{(4)} \end{aligned}

The next layer receives [u,v][u,v]. Attention and expert operations retain their pretrained matrix dimensions, while residual streams remain half-width.

For a shared transition pair, the additional weight count is d2d^2 per layer, excluding biases; independent pairs for attention and MoE would require 2d22d^2. Preserving pretrained matrix shapes does not make the wrapper functionally identical to the original decoder. In particular, the rank of the linear stream interface is at most d/2d/2. Alignment must therefore learn a useful interface rather than assume lossless recovery of the original representation.

Conditional State Replay

Given uu and vv, the second input stream follows directly:

b^=v−M(u).(5)\hat{b} = v - \mathcal{M}(u). \tag*{(5)}

The first stream satisfies a=u−A(a,b)a = u - \mathcal{A}(a,b). Unlike triangular RevNet coupling, aa also appears inside the attention query. Its reconstruction uses

a(0)=Norm⁡(u),a(j+1)=u−A(a(j),b^),j≥0.(6)\begin{aligned} a^{(0)} &= \operatorname{Norm}(u),\\ a^{(j+1)} &= u - \mathcal{A}(a^{(j)},\hat{b}), \qquad j \ge0. \tag*{(6)} \end{aligned}

This equation is a reconstruction procedure, not an unconditional analytic inverse.

For fixed bb, suppose a↦u−A(a,b)a \mapsto u - \mathcal{A}(a,b) maps a closed domain into itself and is Lipschitz with constant q<1q < 1. This gives a unique fixed point, as in the contraction argument for invertible residual networks [32]. For a candidate a^\hat{a} and exact bb, the residual and error bound are

r=a^+A(a^,b)−u,r = \hat{a} + \mathcal{A}(\hat{a},b) - u,
∥a^−a∥≤∥r∥1−q.(7)\lVert\hat{a} - a \rVert\le\frac{\lVert r \rVert}{1-q}. \tag*{(7)}

The bound follows by subtracting the true fixed-point equation and applying the triangle inequality. A small residual is informative only when the contraction factor is controlled. Additive coupling alone does not establish this condition, and finite-precision replay need not be exact.

Local invertibility. Within a differentiable region of fixed expert dispatch, let Ja=∂A/∂aJ_a = \partial A/\partial a. The forward map factors into (a,b)↦(u,b)(a,b) \mapsto(u,b) and (u,b)↦(u,v)(u,b) \mapsto(u,v). The second factor has unit Jacobian determinant, giving

det⁡(∂(u,v)∂(a,b))=det⁡(I+Ja).(8)\det\left(\frac{\partial(u,v)}{\partial(a,b)}\right) = \det(I + J_a). \tag*{(8)}

Local invertibility therefore depends on query-dependent attention, although recovering bb is a direct subtraction. Contraction keeps I+JaI + J_a nonsingular, but must be verified for the learned functions and numerical precision.

Backward replay requires the same parameters, attention masks, random states, and expert dispatch decisions as the forward computation. Frozen router weights do not freeze token assignments when inputs change. Gradients must follow the replayed forward block rather than an arbitrary unrolling of inverse iterations.

Approximate state recovery perturbs the gradient evaluation points. Reconstruction residuals and gradient agreement with a stored-activation reference are therefore separate numerical checks; downstream task scores alone validate neither.

Bridge Warm-Up and Backbone Adaptation

Let θ\theta denote pretrained parameters, θr\theta_r the router subset, and ϕ\phi the transitions. Autoregressive supervised adaptation minimizes

L(θ,ϕ)=−∑(c,y)∑jlog⁡pθ,ϕ(yj∣c,y<j).(9)\mathcal{L}(\theta,\phi) = -\sum_{(c,y)} \sum_j \log p_{\theta,\phi}(y_j \mid c,y_{<j}). \tag*{(9)}

During bridge warm-up, Phase 1 freezes θ\theta and updates only ϕ\phi. Phase 2, backbone adaptation, optimizes ϕ\phi and θ∖θr\theta\setminus\theta_r. Attention and expert weights become trainable while router weights stay fixed. This extends learning beyond the bridges without updating every parameter. The ablation evaluates the schedule, without assigning its gains to an unmeasured convergence mechanism.

Resource Accounting

Peak GPU memory is the maximum concurrent storage of weights, gradients, optimizer states, activations, and workspace. Reconstruction targets activations; stored expert weights and optimizer states remain. A replayable segment can reduce stored layer-boundary states from O(LBSd)O(LBSd) to O(BSd)O(BSd) for depth LL, but attention workspace, temporary expert activations, and replay metadata remain. Fixed-point attention recovery adds evaluations whose count depends on numerical convergence.

Sparse computation and state residency remain distinct: selecting fewer experts need not reduce stored weights. Markets of Minds addresses shared-capacity allocation [17]; our frozen-router wrapper instead targets activation storage. Precision, optimizer representation, and state placement still determine total memory. The evaluation compares complete configurations, without separately profiling activation savings or implementing market clearing.

Experiments

Evaluation Setting

The evaluation adapts Qwen/Qwen1.5-MoE-A2.7B on databricks-dolly-15k, using PyTorch and Transformers on one 80 GB NVIDIA H800. The checkpoint uses the qwen2_moe implementation [3].

The comparison includes LoRA, DoRA, and (IA)3^3 as parameter-efficient methods, and supervised fine-tuning (SFT) with checkpointing, LOMO, and GaLore as methods with broader weight updates. Peak GPU memory is reported in GB and throughput in samples/s. The methods use the same number of training steps, with batch sizes adjusted to the memory capacity. This setting measures achievable throughput for each configuration; it does not control processed tokens or isolate kernel efficiency.

Task metrics are MMLU [38], GSM8K [39], and MT-Bench [40], together with the multilingual aggregate in the comparison. The multilingual dataset composition is unspecified, so that column is interpreted within this evaluation rather than as a standardized external benchmark. The available results contain no multi-seed uncertainty estimates.

Memory–Throughput Tradeoff

Table 1 reports 38.8 GB peak memory for DuplexTune, versus 64.8 GB for checkpointed SFT. The reduction is 26.0 GB, or 40.1%. Throughput increases from 19.9 to 25.1 samples/s, a 26.1% gain under the reported batching policy. This difference cannot establish that reconstruction itself is faster than checkpointing: batch sizes and other configuration choices contribute to the measured speed.

MethodMemory (GB)↓\downarrowSamples/s↑\uparrow
Parameter-efficient adaptation
LoRA18.476.2
DoRA19.872.5
(IA)3^317.674.8
Broader weight updates
SFT + checkpointing64.819.9
LOMO41.917.6
GaLore44.835.5
DuplexTune38.825.1

Table 1. Single-H800 efficiency. Batch sizes are capacity-tuned; throughput is not a matched-token comparison.

DuplexTune uses 3.1 GB less memory than LOMO and 6.0 GB less than GaLore, but is 29.3% slower than GaLore’s 35.5 samples/s. PEFT remains more memory efficient: (IA)3^{3} uses 17.6 GB, and LoRA reaches 76.2 samples/s. These configurations offer different tradeoffs between update scope, memory, and throughput.

Adaptation Quality

Table 2 shows the highest adapted-model scores for DuplexTune on MMLU, GSM8K, and MT-Bench. Relative to checkpointed SFT, the gains are 0.9 and 0.5 percentage points on MMLU and GSM8K, and 0.13 MT-Bench points. Against DoRA, the corresponding differences are 1.3, 4.5, and 0.40. These are descriptive differences from the reported runs; the table does not establish statistical significance.

MethodMMLUGSM8KMulti.MT-B.
Base model62.461.240.46.25
LoRA65.571.838.77.21
DoRA65.971.139.17.29
(IA)3^{3}65.270.538.47.18
SFT + checkpointing66.375.139.87.56
LOMO66.574.939.57.52
GaLore66.674.539.47.49
DuplexTune67.275.639.07.69

Table 2. Table 2. Downstream scores. MMLU, GSM8K, and Multi. are percentages; MT-B. is MT-Bench. Bold marks the best score per column, including the base model.

Multilingual performance shows a different pattern: DuplexTune scores 39.0, below checkpointed SFT (39.8), DoRA (39.1), and the base model (40.4). Every adapted model underperforms the base in this column. Reasoning and conversational gains therefore coexist with a lower multilingual score.

Training-Phase Ablation

Table 3 compares the complete schedule with removing either phase. Omitting alignment yields 57.5% MMLU, 9.7 percentage points below the complete method. Restricting learning to transitions yields 54.9%, a 12.3-point decrease. Both variants also fall below the 62.4% base-model score.

ConfigurationMMLU (%)↑
DuplexTune (complete)67.2
No bridge warm-up (joint updates)57.5
No backbone adaptation (bridges only)54.9

Table 3. Table 3. Training-phase ablation on MMLU. Removing either alignment or backbone fine-tuning reduces the score.

Figure 2. Fig. 2. Memory and MMLU. Points combine the values in Table 1 and Table 2; they summarize complete configurations with capacity-tuned batches. Throughput and other task scores remain separate criteria.

These observations support using alignment and subsequent backbone updates together in this configuration. They do not, without optimization traces, prove that the joint-training variant diverges or identify the mechanism behind the decline.

Scope and Reproducibility

The evaluation covers one backbone, one instruction dataset, and one GPU class. Reconstruction, transitions, router freezing, and optimizer-state storage are not separately ablated. Memory comparisons depend on precision and state placement. Reproduction additionally requires learning rates, sequence lengths, per-method batches, inverse-solver tolerances, and multilingual task composition. The H800 results do not establish single-consumer-GPU feasibility.

Token compression and state replay also act on different budgets. HTC-VLM and video encoders built on image representations reduce visual-token exposure [36, 37], whereas this evaluation changes hidden-state storage. Combining them would require measuring retained task evidence and reconstruction error alongside memory. Markets of Minds [17] allocates expert assistance by expected benefit and opportunity cost; that decision does not determine an expert’s training-state footprint.

Conclusion

DuplexTune combines coupled-state replay, width bridges, and staged backbone adaptation. State recovery requires convergence; weight and optimizer costs remain. The reported H800 configuration reduces memory relative to checkpointed SFT and improves three task scores, with multilingual and throughput tradeoffs. Further evaluation should measure matched-token quality, reconstruction error, and state residency.

References

References

  1. [1]N. Shazeer et al., “Outrageously large neural networks: The sparsely-gated mixture-of-experts layer,” CoRR, vol. abs/1701.06538, 2017.arxiv.org/abs/1701.06538
  2. [2]W. Fedus, B. Zoph and N. Shazeer, “Switch transformers: Scaling to trillion parameter models with simple and efficient sparsity,” 2022, arXiv:2101.03961.arxiv.org/abs/2101.03961
  3. [3]Qwen Team, “Qwen1.5-MoE-A2.7B: Model card,” Hugging Face, 2024.
  4. [4]A. Vaswani et al., “Attention is all you need,” CoRR, vol. abs/1706.03762, 2017.arxiv.org/abs/1706.03762
  5. [5]OpenAI, “GPT-4 technical report,” 2024, arXiv:2303.08774.arxiv.org/abs/2303.08774
  6. [6]H. Touvron, T. Lavril and G. Izacard, “LLaMA: Open and efficient foundation language models,” 2023, arXiv:2302.13971.arxiv.org/abs/2302.13971
  7. [7]E. J. Hu et al., “LoRA: Low-rank adaptation of large language models,” CoRR, vol. abs/2106.09685, 2021.arxiv.org/abs/2106.09685
  8. [8]T. Dettmers et al., “QLoRA: Efficient finetuning of quantized LLMs,” 2023, arXiv:2305.14314.arxiv.org/abs/2305.14314
  9. [9]S. Rajbhandari et al., “ZeRO: Memory optimizations toward training trillion parameter models,” arXiv preprint arXiv:1910.02054, 2020.arxiv.org/abs/1910.02054
  10. [10]Y. Zhao et al., “PyTorch FSDP: Experiences on scaling fully sharded data parallel,” 2023, arXiv:2304.11277.arxiv.org/abs/2304.11277
  11. [11]T. Chen et al., “Training deep nets with sublinear memory cost,” CoRR, vol. abs/1604.06174, 2016.arxiv.org/abs/1604.06174
  12. [12]W. Cai et al., “A survey on mixture of experts in large language models,” IEEE Transactions on Knowledge and Data Engineering, 2025.DOI
  13. [13]J. Zhang et al., “KABB: Knowledge-aware bayesian bandits for dynamic expert coordination in multi-agent systems,” in Proc. ICML, 2025.arxiv.org/abs/2502.07350
  14. [14]J. Zhang et al., “GAM-Agent: Game-theoretic and uncertainty-aware collaboration for complex visual reasoning,” in Advances in Neural Information Processing Systems, 2025, vol. 38.arxiv.org/abs/2505.23399
  15. [15]J. Duan et al., “Efficient training of large language models on distributed infrastructures: A survey,” 2024, arXiv:2407.20018.arxiv.org/abs/2407.20018
  16. [16]J. Zhang et al., “Why keep your doubts to yourself? trading visual uncertainties in multi-agent bandit systems,” 2026, arXiv:2601.18735.arxiv.org/abs/2601.18735
  17. [17]J. Zhang et al., “Markets of Minds: A 51-billion-state economy of intelligence,” 2026, arXiv:2610.32190.arxiv.org/abs/2610.32190
  18. [18]Z. Han et al., “Parameter-efficient fine-tuning for large models: A comprehensive survey,” 2024, arXiv:2403.14608.arxiv.org/abs/2403.14608
  19. [19]J. Zhang et al., “CF-VLM: Counterfactual vision-language fine-tuning,” in Advances in Neural Information Processing Systems, 2025, vol. 38.arxiv.org/abs/2506.17267
  20. [20]J. Zhang et al., “Learning dynamics of VLM finetuning,” 2025, arXiv:2510.11978.arxiv.org/abs/2510.11978
  21. [21]S.-Y. Liu et al., “DoRA: Weight-decomposed low-rank adaptation,” 2024, arXiv:2402.09353.arxiv.org/abs/2402.09353
  22. [22]H. Liu et al., “Few-shot parameter-efficient fine-tuning is better and cheaper than in-context learning,” 2022, arXiv:2205.05638.arxiv.org/abs/2205.05638
  23. [23]J. Zhang et al., “Self-rewarded multimodal coherent reasoning across diverse visual domains,” 2025, arXiv:2512.22545.arxiv.org/abs/2512.22545
  24. [24]J. Zhang et al., “MAT-Agent: Adaptive multi-agent training optimization,” in Advances in Neural Information Processing Systems, 2025, vol. 38.arxiv.org/abs/2510.17845
  25. [25]K. Lv et al., “Full parameter fine-tuning for large language models with limited resources,” 2024, arXiv:2306.09782.arxiv.org/abs/2306.09782
  26. [26]J. Zhao, Z. Zhang and B. Chen, “GaLore: Memory-efficient LLM training by gradient low-rank projection,” 2024, arXiv:2403.03507.arxiv.org/abs/2403.03507
  27. [27]D. P. Kingma and J. Ba, “Adam: A method for stochastic optimization,” 2017, arXiv:1412.6980.arxiv.org/abs/1412.6980
  28. [28]J. Zhang et al., “OSC: Cognitive orchestration through dynamic knowledge alignment in multi-agent LLM collaboration,” in Findings of EMNLP. 2025, pp. 6320–6337, Association for Computational Linguistics.arxiv.org/abs/2509.04876
  29. [29]J. Zhang et al., “Failure-driven workflow refinement,” 2025, arXiv:2510.10035.arxiv.org/abs/2510.10035
  30. [30]A. N. Gomez et al., “The reversible residual network: Backpropagation without storing activations,” 2017, arXiv:1707.04585.arxiv.org/abs/1707.04585
  31. [31]N. Kitaev, L. Kaiser and A. Levskaya, “Reformer: The efficient transformer,” CoRR, vol. abs/2001.04451, 2020.arxiv.org/abs/2001.04451
  32. [32]J. Behrmann et al., “Invertible residual networks,” in Proc. ICML. 2019, vol. 97, pp. 573–582, PMLR.
  33. [33]J. Zhang et al., “Drift: Dynamic routing diffusion with hierarchical attention for breaking the efficiency-quality trade-off,” 2025, arXiv:2509.02785.arxiv.org/abs/2509.02785
  34. [34]T. Dao et al., “FlashAttention: Fast and memory-efficient exact attention with IO-awareness,” 2022, arXiv:2205.14135.arxiv.org/abs/2205.14135
  35. [35]J. Ren et al., “ZeRO-Offload: Democratizing billion-scale model training,” in Proc. USENIX ATC. 2021, pp. 551–564, USENIX Association.arxiv.org/abs/2101.06840
  36. [36]J. Zhang et al., “Hybrid token compression for vision-language models,” 2025, arXiv:2512.08240.arxiv.org/abs/2512.08240
  37. [37]J. Zhang et al., “Video encoders built on image representations,” 2026, arXiv:2610.06616.arxiv.org/abs/2610.06616
  38. [38]D. Hendrycks, C. Burns and S. Basart, “Measuring massive multitask language understanding,” CoRR, vol. abs/2009.03300, 2020.
  39. [39]K. Cobbe et al., “Training verifiers to solve math word problems,” 2021, arXiv:2110.14168.arxiv.org/abs/2110.14168
  40. [40]L. Zheng et al., “Judging LLM-as-a-judge with MT-Bench and chatbot arena,” 2023, arXiv:2306.05685.arxiv.org/abs/2306.05685
  41. [41]J. Zhang et al., “Tri-MARF: A tri-modal multi-agent responsive framework for comprehensive 3D object annotation,” in The Thirty-ninth Annual Conference on Neural Information Processing Systems, 2025.DOI
  42. [42]J. Zhang et al., “MM-CoT: a benchmark for probing visual chain-of-thought reasoning in multimodal models,” 2025, arXiv:2512.08228.arxiv.org/abs/2512.08228

AI tools statement

No AI-use declaration is available for this version in Valency.

The available record does not establish whether AI systems or models contributed to this work.

How AI tools are recorded

Paper details

Cite this paper

Publication

Published
Version
Latest

Data & code

No code, data or supplementary files were declared for this version.

Pick where to look, or just type