Papers › MoH: Multi-Head Attention as Mixture-of-Head Attention

MoH: Multi-Head Attention as Mixture-of-Head Attention

15 Oct 2024arXiv:2410.11842archive 2025-07-28

Peng Jin, Bo Zhu, Li Yuan, Shuicheng Yan

In this work, we upgrade the multi-head attention mechanism, the core of the Transformer model, to improve efficiency while maintaining or surpassing the previous accuracy level. We show that multi-head attention can be expressed in the summation form. Drawing on the insight that not all attention heads hold equal significance, we propose Mixture-of-Head attention (MoH), a new architecture that treats attention heads as experts in the Mixture-of-Experts (MoE) mechanism. MoH has two significant advantages: First, MoH enables each token to select the appropriate attention heads, enhancing inference efficiency without compromising accuracy or increasing the number of parameters. Second, MoH replaces the standard summation in multi-head attention with a weighted summation, introducing flexibility to the attention mechanism and unlocking extra performance potential. Extensive experiments on ViT, DiT, and LLMs demonstrate that MoH outperforms multi-head attention by using only 50%-90% of the attention heads. Moreover, we demonstrate that pre-trained multi-head attention models, such as LLaMA3-8B, can be further continue-tuned into our MoH models. Notably, MoH-LLaMA3-8B achieves an average accuracy of 64.0% across 14 benchmarks, outperforming LLaMA3-8B by 2.4% by utilizing only 75% of the attention heads. We believe the proposed MoH is a promising alternative to multi-head attention and provides a strong foundation for developing advanced and efficient attention-based models.

PaperPDFCodeCode Syntology ranMethod as code

In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 18 code samples: 15 from 3 repositories linked to this paper, 3 identical to code harvested from another paper's repository. Across all 18: 14 ran (of which 5 constructed an object rather than computing a result; 5 with no instrument failure: 0 honoured, 0 violated, 5 with no contract checked; 9 where Syntology's instrument failed) · 4 unverified. Where Syntology's instrument failed: 6 where our contract draft was wrong; 3 where the contract check could not run; failures of Syntology's instrument, not of the code.

By repository: official repository: 4 samples from 1 repository, 3 ran (0 with no instrument failure; 3 where Syntology's instrument failed); community (archive-listed): 11 samples from 2 repositories, 8 ran (5 with no instrument failure; 3 where Syntology's instrument failed); 3 identical to code first harvested elsewhere. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Levels written between 2026-09-22 and 2026-09-24 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed. 8 of the 14 samples that ran have no recorded date.

skyworkai/moh officialmentioned in papermentioned on GitHubpytorchSyntology: 4 samples, 3 ran (3 instrument-failed) · 1 unverified report
pku-yuangroup/chat-univi mentioned on GitHubpytorchApache-2.0Syntology: 5 samples, 3 ran (3 instrument-failed) · 2 unverified report
skyworkai/moe-plus-plus mentioned on GitHubpytorchSyntology: 6 samples, 5 ran (0 instrument-failed) · 1 unverified report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

18 samples harvested: 14 ran (of which 5 constructed an object rather than computing a result; 5 with no instrument failure: 0 honoured, 0 violated, 5 with no contract checked; 9 where Syntology's instrument failed) · 4 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page last changed ; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

6ran · our draft was wrong
3ran; the contract check could not run
5ran
4unverified

Licence: 3 of the 18 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 3 repositories linked to this paper, official or community; the list below is grouped by repository, each group headed by its name and what it is to the paper. 3 samples are listed last, in a group without a repository. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of six reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.

skyworkai/moh official repository 4 samples, 3 ran (3 instrument-failed) · 1 unverified
normal_kl in 188 papers
census: 14 implementations from 24 papers, 2 distinct outputs on one shared input this sample: bucket 1 of 1, arg 1: rank 2, kind float, dtype float32 · arg 2: rank 2, kind float, dtype float32 · arg 3: rank 2, kind float, dtype float32 · arg 4: rank 2, kind float, dtype float32
MoH-DiT/diffusion/diffusion_utils.py ran; the contract check could not run (RAISES) · metamorphic tier: invariant fingerprinted Apache-2.0 (permissive) · 3f37a54ade181a61 · report fixture: signature mean1:Tensor/2/float, logvar1:Tensor/2/float, mean2:Tensor/2/float, logvar2:Tensor/2/float · returned Tensor · level recorded, date not recorded
approx_standard_normal_cdf in 150 papers
census: 4 implementations from 14 papers, 1 distinct output on one shared input this sample: bucket 1 of 1, arg 1: rank 2, kind float, dtype float32
MoH-DiT/diffusion/diffusion_utils.py ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · d6a68e210556f857 · report fixture: signature x:Tensor/2/float · returned Tensor · level recorded, date not recorded
continuous_gaussian_log_likelihood in 27 papers
census: 2 implementations from 5 papers, 1 distinct output on one shared input this sample: bucket 1 of 1, arg 1: rank 2, kind float, dtype float32 · arg 2: rank 2, kind float, dtype float32 · arg 3: rank 2, kind float, dtype float32
MoH-DiT/diffusion/diffusion_utils.py ran · our draft was wrong Apache-2.0 (permissive) · 57848f6ed380e2e5 · report fixture: signature x:Tensor/2/float, means:Tensor/2/float, log_scales:Tensor/2/float · returned Tensor · level recorded, date not recorded
pku-yuangroup/chat-univi community (archive-listed) 5 samples, 3 ran (3 instrument-failed) · 2 unverified
get_chunk in 197 papers ChatUniVi/eval/model_coco_vqa.py ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 42a46570620cd9fa · report fixture: signature lst:list/1/int, n:int/0/int, k:int/0/int · returned list · level recorded, date not recorded
read_json in 250 papers ChatUniVi/eval/model_video_qa.py ran · our draft was wrong Apache-2.0 (permissive) · c578a6846674ff45 · report fixture: signature file:str/0/str · returned dict · level recorded 2026-09-24
split_list in 223 papers ChatUniVi/eval/model_coco_vqa.py ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 076c252c52cbb161 · report fixture: signature lst:list/1/int, n:int/0/int · returned list · level recorded, date not recorded
save_image_to_local in 8 papers main_demo_13B.py unverified Apache-2.0 (permissive) · e2e5c3a95a6aebb4 · report
save_video_to_local in 8 papers main_demo_13B.py unverified Apache-2.0 (permissive) · cab3546afd60006d · report
skyworkai/moe-plus-plus community (archive-listed) 6 samples, 5 ran (0 instrument-failed) · 1 unverified
DynamicNTKScalingRotaryEmbedding MoE++/modeling_moe_plus_plus.py ran Apache-2.0 (permissive) · c39d2f7f60570686 · report fixture: returned DynamicNTKScalingRotaryEmbedding · level recorded 2026-09-22
LinearScalingRotaryEmbedding MoE++/modeling_moe_plus_plus.py ran Apache-2.0 (permissive) · eebf71aed18a0f87 · report fixture: returned LinearScalingRotaryEmbedding · level recorded 2026-09-22
MoeConfig MoE++/modeling_moe_plus_plus.py ran Apache-2.0 (permissive) · 420932dc6224ccb9 · report fixture: returned MoeConfig · level recorded 2026-09-22
NTKScalingRotaryEmbedding MoE++/modeling_moe_plus_plus.py ran Apache-2.0 (permissive) · 9a1f7fea1bda87f8 · report fixture: returned NTKScalingRotaryEmbedding · level recorded 2026-09-22
RotaryEmbedding in 27 papers MoE++/modeling_moe_plus_plus.py ran Apache-2.0 (permissive) · 4390a52a532857aa · report fixture: returned RotaryEmbedding · level recorded 2026-09-22
Repository not located 3 samples, 3 ran (3 instrument-failed) · 0 unverified
3 samples are identical to code Syntology harvested from another paper's repository; this paper's own copy was not located, so no repository is named and no licence is recorded.
repeat_kv in 244 papers
census: 15 implementations from 60 papers, 2 distinct outputs on one shared input this sample: bucket 1 of 1, arg 1: rank 4, kind float, dtype float32
repository not located ran; the contract check could not run (RAISES) · metamorphic tier: invariant fingerprinted licence of this copy not recorded · 30d7eec482ebf6b1 · report fixture: signature hidden_states:Tensor/4/float, n_rep:int/0/int · returned Tensor · level recorded, date not recorded
apply_rotary_pos_emb in 393 papers
census: 14 implementations from 15 papers, 8 distinct outputs across 7 buckets, one shared input per bucket
repository not located ran; the contract check could not run (RAISES) · metamorphic tier: invariant licence of this copy not recorded · d61c483a3c2b3156 · report fixture: signature q:Tensor/4/float, k:Tensor/4/float, cos:Tensor/2/float, sin:Tensor/2/float, position_ids:Tensor/2/int, unsqueeze_dim:int/0/int · returned tuple · level recorded, date not recorded
rotate_half in 424 papers
census: 24 implementations from 96 papers, 4 distinct outputs across 2 buckets, one shared input per bucket this sample: bucket 1 of 2, arg 1: rank 2, kind float, dtype float32
repository not located ran · our draft was wrong fingerprinted licence of this copy not recorded · b99eea6376d1e212 · report fixture: signature x:Tensor/2/float · returned Tensor · level recorded, date not recorded

Method as code Syntology

What Syntology's graph records as this paper's claimed method, lifted into code: each assembly names its bricks (functions and classes), each with its own role and its own verification level. An assembly is not a check that the code implements the method correctly or reproduces the paper's results. Levels are each brick's own verification level in Syntology's graph (level 0: no recorded run), listed brick by brick and never combined into one level; “ran” means the brick executed on a synthesized input, not that its output is correct, and the instrument figure counts failures of Syntology's instrument, not of the code. Where a model read the code against the paper's claim, each assembly's label verdict is one model's judgement, kept in this page's JSON twin; it is not calibrated, so no card prints it. Siblings are assemblies lifted from this paper in the same batch for the same method: alternative readings kept side by side; none replaces or supersedes another.

2 assemblies on this paper: 2 harvested, 0 generated, listed in 1 groups (siblings lifted in one batch form one group).

2 sibling assemblies for Mixture-of-Head attention (MoH) (harvested), lifted in the same batch on 2026-09-09: alternative readings kept side by side; none replaces or supersedes another.

harvested Assembly for Mixture-of-Head attention (MoH) (graph method: Mixture-of-Head attention (MoH)). 9 bricks; individually on a fixture: 8 ran (of which 5 constructed an object rather than computing a result; 5 with no instrument failure: 0 honoured, 0 violated, 5 with no contract checked; 3 where Syntology's instrument failed) · 1 unverified. The assembly has not been run end-to-end.

one of 2 siblings

  1. Attention entry · level 0 · unverified · 513d27b0995b5f3e
  2. DynamicNTKScalingRotaryEmbedding helper · level 1 · ran · c39d2f7f60570686
  3. LinearScalingRotaryEmbedding helper · level 1 · ran · eebf71aed18a0f87
  4. MoeConfig helper · level 1 · ran · 420932dc6224ccb9
  5. NTKScalingRotaryEmbedding helper · level 1 · ran · 9a1f7fea1bda87f8
  6. RotaryEmbedding helper · level 1 · ran · 4390a52a532857aa
  7. apply_rotary_pos_emb helper · level 1 · ran; the contract check could not run · 9a65a30d006fc96e
  8. repeat_kv helper · level 2 · ran; the contract check could not run · 3c76e52815c5401d
  9. rotate_half helper · level 1 · ran · our draft was wrong · e03d53ba9d4f9ae5

harvested Assembly for Mixture-of-Head attention (MoH) (graph method: Mixture-of-Head attention (MoH)). 1 brick; individually on a fixture: 0 ran · 1 unverified. The assembly has not been run end-to-end.

one of 2 siblings

  1. Attention entry · level 0 · unverified · 7b9f5a8e366cc24e

Each brick ends with its code_sha256, Syntology's identity for that exact code; click one to copy the get_code call that returns it. For agents, on Syntology's MCP service: assembly(arxiv_id="2410.11842") returns these assemblies with each brick's role and wiring (how to connect).

Tasks

Mixture-of-Experts

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections