Papers › Hydra: Sequentially-Dependent Draft Heads for Medusa Decoding

Hydra: Sequentially-Dependent Draft Heads for Medusa Decoding

7 Feb 2024arXiv:2402.05109archive 2025-07-28

Zachary Ankner, Rishab Parthasarathy, Aniruddha Nrusimha, Christopher Rinard, Jonathan Ragan-Kelley, William Brandon

To combat the memory bandwidth-bound nature of autoregressive LLM inference, previous research has proposed the speculative decoding frame-work. To perform speculative decoding, a small draft model proposes candidate continuations of the input sequence that are then verified in parallel by the base model. One way to specify the draft model, as used in the recent Medusa decoding framework, is as a collection of lightweight heads, called draft heads, that operate on the base model's hidden states. To date, all existing draft heads have been sequentially independent, meaning that they speculate tokens in the candidate continuation independently of any preceding tokens in the candidate continuation. In this work, we propose Hydra heads: a sequentially-dependent drop-in replacement for standard draft heads that significantly improves the accuracy of draft head speculation. We further explore the design space of Hydra head training objectives and architectures, and propose a carefully tuned Hydra head recipe, which we call Hydra++, that improves decoding throughput by up to 1.31x and 2.70x compared to Medusa decoding and autoregressive de-coding respectively. Overall, Hydra heads are a simple and well-motivated intervention on standard draft heads that significantly improve the end-to-end speed of draft head-based speculative decoding. We make our code publicly available at https://github.com/zankner/Hydra.

PaperPDFCodeCode Syntology ran

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

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2402.05109")

Code

Syntology Ran 8 of 10 code samples harvested from 1 repository linked to this paper; 2 have no recorded run. Of those that ran: 1 ran · violated contract; 7 ran with no contract checked.

By repository: official repository: 10 samples from 1 repository, 8 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

zankner/hydra officialmentioned in papermentioned on GitHubpytorchApache-2.0 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

10 samples harvested; 8 ran; 0 honoured the contract we drafted; 2 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · violated contract
7ran
2unverified

Licence: 0 of the 10 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 zankner/hydra. “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. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (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 from a repository marked official are listed first. 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 four 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; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). 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.

generate_hydra_buffers zankner/hydra/hydra/model/utils.py official repository ran Apache-2.0 (permissive) · 395871bd98d29b08 · report
get_constant_schedule_with_warmup zankner/hydra/hydra/train/utils.py official repository ran Apache-2.0 (permissive) · 813156115eaf61cc · report
get_cosine_schedule_with_warmup zankner/hydra/hydra/train/utils.py official repository ran Apache-2.0 (permissive) · 48e7f6a3de154240 · report
get_linear_schedule_with_warmup zankner/hydra/hydra/train/utils.py official repository ran Apache-2.0 (permissive) · b0d392034f20d785 · report
initialize_past_key_values zankner/hydra/hydra/model/kv_cache.py official repository ran Apache-2.0 (permissive) · d2d232761fe51ccb · report
pad_path zankner/hydra/hydra/model/utils.py official repository ran · violated contract fingerprinted Apache-2.0 (permissive) · a0751eee3897a746 · report
repeat_kv zankner/hydra/hydra/model/modeling_llama_kv.py official repository ran fingerprinted Apache-2.0 (permissive) · f6e0c0fc3868b787 · report
rotate_half zankner/hydra/hydra/model/modeling_llama_kv.py official repository ran fingerprinted Apache-2.0 (permissive) · b71b0ed70aa2939c · report
apply_rotary_pos_emb zankner/hydra/hydra/model/modeling_llama_kv.py official repository unverified Apache-2.0 (permissive) · bad260f6d71db00c · report
initialize_hydra zankner/hydra/hydra/model/utils.py official repository unverified Apache-2.0 (permissive) · 2475708ca93552ac · report

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

BASEHydraSPEED

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