SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2503.10135 · ICML · 2025

Gumiho: A Hybrid Architecture to Prioritize Early Tokens in Speculative Decoding

Dong Li, Yixing Xu, Edith Ngai, Emad Barsoum, Jinze Li, Haiduo Huang, Xuanwu Yin

arXiv · PDF · Open in the Atlas

Code that ran

12 of 15 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 2 violated it and 0 have no contract verdict; 10 failures of our instrument; 3 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, measured 2026-11-23; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2503.10135.json · badge: /api/ran/2503.10135.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
AMD-AIG-AIMA/Gumiho canonical (classifier label)
classifier basis not recorded on the link
12 ran · 3 no recorded run
FunctionStatusWhere it lives
repeat_kv Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
AMD-AIG-AIMA/Gumiho/gumiho/model/cnets.py
code served (permissive licence) · get_code("3c76e52815c5401d")
How it ran

Ran in Syntology's jail on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 4, dtype family float, shape (2, 6, 5, 4) as a later run recorded it. The image it ran in was not recorded. The comparison behind this sample's level is a different run: the peer-agreement lane ran it again on the host, not in the jail (report dated 2026-09-04T23:23:17Z). If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create a small tensor with shape (batch, num_key_value_heads, seqlen, head_dim)
# Using distinct sizes: batch=2, num_key_value_heads=3, seqlen=5, head_dim=4
hidden_states = torch.randn(2, 3, 5, 4)

# n_rep is the repetition factor
n_rep = 2

ARGS = {
    "hidden_states": hidden_states,
    "n_rep": n_rep,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 6, 5, 4) — shape (2, 6, 5, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
apply_rotary_pos_emb Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
AMD-AIG-AIMA/Gumiho/gumiho/model/cnets.py
code served (permissive licence) · get_code("9a65a30d006fc96e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple, ndim 5, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Analyze the function:
# - q: tensor, used with *, rotate_half, and arithmetic ops
# - k: tensor, used with *, rotate_half, and arithmetic ops
# - cos: tensor, squeezed twice on dims 1 and 0, indexed by position_ids, unsqueezed
# - sin: tensor, squeezed twice on dims 1 and 0, indexed by position_ids, unsqueezed
# - position_ids: tensor, used to index into cos and sin

# The function expects:
# - q and k to have shape compatible with rotate_half (last dim must be even)
# - cos and sin to have shape (seq_len, 1, hidden_dim) before squeezing
# - position_ids to be indices into the sequence dimension

batch_size = 2
seq_len = 3
hidden_dim = 4
num_positions = 5

# q and k: (batch, seq_len, hidden_dim)
q = torch.randn(batch_size, seq_len, hidden_dim)
k = torch.randn(batch_size, seq_len, hidden_dim)

# cos and sin: (num_positions, 1, hidden_dim)
# After squeeze(1).squeeze(0), they become (num_positions, hidden_dim)
cos = torch.randn(num_positions, 1, hidden_dim)
sin = torch.randn(num_positions, 1, hidden_dim)

# position_ids: indices into the position dimension, shape (batch, seq_len)
position_ids = torch.tensor([[0, 1, 2], [1, 2, 3]], dtype=torch.long)

ARGS = {
    "q": q,
    "k": k,
    "cos": cos,
    "sin": sin,
    "position_ids": position_ids,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 5, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
generate_tree_buffers Ran
ran; our contract draft was wrong, not the code
AMD-AIG-AIMA/Gumiho/gumiho/model/utils_c.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from SAI-Lab-NYU/DREAM-S, is pointer only (licence: NONE) · get_code("3519ee6c91b32335")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from SAI-Lab-NYU/DREAM-S, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

generate_tree_buffers Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
AMD-AIG-AIMA/Gumiho/gumiho/model/utils.py
code served (permissive licence) · get_code("d27b9a7a10267a63")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import copy
from typing import List

torch.manual_seed(0)

# Construct tree_choices - a list of paths through a tree
# Each path is a list of integers representing choices at each level
tree_choices = [
    [0],
    [1],
    [2],
    [0, 0],
    [0, 1],
    [1, 0],
    [0, 0, 0],
]

ARGS = {
    "tree_choices": tree_choices,
    "device": "cpu",
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
loguru, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
initialize_past_key_values Ran
ran; our contract draft was wrong, not the code
AMD-AIG-AIMA/Gumiho/gumiho/model/kv_cache.py
code served (permissive licence) · get_code("aadc9c83d7ec2701")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

class MockConfig:
    def __init__(self):
        self.num_hidden_layers = 2
        self.num_key_value_heads = 3
        self.max_position_embeddings = 8
        self.hidden_size = 12
        self.num_attention_heads = 4

class MockAttention(nn.Module):
    def __init__(self):
        super().__init__()
        self.q_proj = nn.Linear(12, 12)

class MockLayer(nn.Module):
    def __init__(self):
        super().__init__()
        self.self_attn = MockAttention()

class MockModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.config = MockConfig()
        self.model = nn.Module()
        self.model.layers = nn.ModuleList([MockLayer() for _ in range(self.config.num_hidden_layers)])
        self.dtype = torch.float32

model = MockModel()

ARGS = {
    "model": model
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
pad_path Ran
ran, violated the contract we drafted
AMD-AIG-AIMA/Gumiho/gumiho/model/utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from SAI-Lab-NYU/DREAM-S, is pointer only (licence: NONE) · get_code("a40c43d3dbc369d3")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from SAI-Lab-NYU/DREAM-S, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

pad_path Ran
ran, violated the contract we drafted
AMD-AIG-AIMA/Gumiho/gumiho/model/utils_c.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from SAI-Lab-NYU/DREAM-S, is pointer only (licence: NONE) · get_code("dfb6f2c070ac64a8")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from SAI-Lab-NYU/DREAM-S, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

prepare_logits_processor Ran
ran; our contract draft was wrong, not the code
AMD-AIG-AIMA/Gumiho/gumiho/model/utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from SAI-Lab-NYU/DREAM-S, is pointer only (licence: NONE) · get_code("78ae913ae6243c38")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from SAI-Lab-NYU/DREAM-S, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

repeat_kv Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
AMD-AIG-AIMA/Gumiho/gumiho/model/modeling_llama_kv.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from SAI-Lab-NYU/DREAM-S, is pointer only (licence: NONE) · get_code("f6e0c0fc3868b787")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from SAI-Lab-NYU/DREAM-S, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

reset_past_key_values Ran
ran; our contract draft was wrong, not the code
AMD-AIG-AIMA/Gumiho/gumiho/model/utils_c.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from SAI-Lab-NYU/DREAM-S, is pointer only (licence: NONE) · get_code("272b0f3a92684ed4")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from SAI-Lab-NYU/DREAM-S, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

rotate_half Ran
ran; our contract draft was wrong, not the code
AMD-AIG-AIMA/Gumiho/gumiho/model/cnets.py
code served (permissive licence) · get_code("e03d53ba9d4f9ae5")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function takes a single parameter 'x' which is a tensor
# It accesses x[..., :x.shape[-1] // 2] and x[..., x.shape[-1] // 2:]
# So x needs to be a tensor with a last dimension that can be split in half
# Let's create a small tensor with batch size 2 and feature dimension 4

x = torch.randn(2, 4)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
rotate_half Ran
ran; our contract draft was wrong, not the code
AMD-AIG-AIMA/Gumiho/gumiho/model/modeling_llama_kv.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from SAI-Lab-NYU/DREAM-S, is pointer only (licence: NONE) · get_code("b71b0ed70aa2939c")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from SAI-Lab-NYU/DREAM-S, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

apply_rotary_pos_emb Not yet run
unverified (harvested, no recorded run)
AMD-AIG-AIMA/Gumiho/gumiho/model/modeling_llama_kv.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from SAI-Lab-NYU/DREAM-S, is pointer only (licence: NONE) · get_code("bad260f6d71db00c")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from SAI-Lab-NYU/DREAM-S, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

gumiho_forward Not yet run
unverified (harvested, no recorded run)
AMD-AIG-AIMA/Gumiho/gumiho/evaluation/gen_baseline_answer_llama3chat.py
code served (permissive licence) · get_code("7b6815daba467d5f")
How it ran

no invocation recorded.

gumiho_forward Not yet run
unverified (harvested, no recorded run)
AMD-AIG-AIMA/Gumiho/gumiho/evaluation/gen_baseline_answer_vicuna.py
code served (permissive licence) · get_code("8213b0e73fb144d8")
How it ran

no invocation recorded.

Also present in other papers' code

Of 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 9 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 3 the same month, 8 later) and 2 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
rotate_half 360 other papers
250 dated earlier, 14 the same month, 88 later, 5 same year, order not determinable, 3 undated · 30 only as an assembly brick
1901.02860 (2019-01)
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
2203.08913 (2022-03)
Memorizing Transformers
2302.13971 (2023-02)
LLaMA: Open and Efficient Foundation Language Models
and 357 more not named here
repeat_kv 243 other papers
167 dated earlier, 10 the same month, 60 later, 4 same year, order not determinable, 2 undated · 22 only as an assembly brick
1901.02860 (2019-01)
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
2203.08913 (2022-03)
Memorizing Transformers
2305.17888 (2023-05)
LLM-QAT: Data-Free Quantization Aware Training for Large Language Models
and 240 more not named here
apply_rotary_pos_emb 83 other papers
66 dated earlier, 1 the same month, 13 later, 3 same year, order not determinable · 6 only as an assembly brick
2306.15595 (2023-06)
Extending Context Window of Large Language Models via Positional Interpolation
2307.05695 (2023-07)
ReLoRA: High-Rank Training Through Low-Rank Updates
2307.06945 (2023-07)
In-context Autoencoder for Context Compression in a Large Language Model
and 80 more not named here
pad_path 4 other papers
1 dated earlier, 3 later
2408.00264 (2024-08)
Clover-2: Accurate Inference for Regressive Lightweight Speculative Decoding
2601.15498 (2026-01)
MARS: Unleashing the Power of Speculative Decoding via Margin-Aware Verification
2602.16052 (2026-02)
MoE-Spec: Expert Budgeting for Efficient Speculative Decoding
and 1 more not named here
prepare_logits_processor 4 other papers
4 later
2601.15498 (2026-01)
MARS: Unleashing the Power of Speculative Decoding via Margin-Aware Verification
2601.19278 (2026-01)
DART: Diffusion-Inspired Speculative Decoding for Fast LLM Inference
2602.16052 (2026-02)
MoE-Spec: Expert Budgeting for Efficient Speculative Decoding
and 1 more not named here
generate_tree_buffers 2 other papers
1 dated earlier, 1 later
2502.06352 (2025-02)
LANTERN++: Enhancing Relaxed Speculative Decoding with Static Tree Drafting for Visual Auto-regressive Models
2606.00535 (2026-06)
DREAM-S: Speculative Decoding with Searchable Drafting and Target-Aware Refinement for Multimodal Generation
generate_tree_buffers 2 other papers
2 later
2602.16052 (2026-02)
MoE-Spec: Expert Budgeting for Efficient Speculative Decoding
2606.00535 (2026-06)
DREAM-S: Speculative Decoding with Searchable Drafting and Target-Aware Refinement for Multimodal Generation
initialize_past_key_values 2 other papers
2 dated earlier
2408.00264 (2024-08)
Clover-2: Accurate Inference for Regressive Lightweight Speculative Decoding
2410.06916 (2024-10)
SWIFT: On-the-Fly Self-Speculative Decoding for LLM Inference Acceleration
reset_past_key_values 1 other paper
1 later
2606.00535 (2026-06)
DREAM-S: Speculative Decoding with Searchable Drafting and Target-Aware Refinement for Multimodal Generation

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Speculative decoding (SPD) aims to accelerate the auto-regressive token generation process of a target Large Language Model (LLM). Some approaches employ a draft model with multiple heads to predict a sequence of future tokens, where each head handles a token in the sequence. The target LLM verifies the predicted sequence and accepts aligned tokens, enabling efficient multi-token generation. However, existing methods assume that all tokens within a sequence are equally important, employing identical head structures and relying on a single-generation paradigm, either serial or parallel. To this end, we theoretically demonstrate that initial tokens in the draft sequence are more important than later ones. Building on this insight, we propose Gumiho, a hybrid model combining serial and parallel heads. Specifically, given the critical importance of early tokens, we employ a sophisticated Transformer architecture for the early draft heads in a serial configuration to improve accuracy. For later tokens, we utilize multiple lightweight MLP heads operating in parallel to enhance efficiency. By allocating more advanced model structures and longer running times to the early heads, Gumiho achieves improved overall performance. The experimental results demonstrate that our method outperforms existing approaches, fully validating its effectiveness. Our code is available at https://github.com/AMD-AIG-AIMA/Gumiho.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2503.10135")
get_code_for_paper("2503.10135")
have("2503.10135")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2503.10135.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2503.10135.svg)](https://syntology.ai/paper/2503.10135)

Connect an agent — have() is free.