SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2404.16710 · ACL · 2024

LayerSkip: Enabling Early Exit Inference and Self-Speculative Decoding

Beidi Chen, Akshat Shrivastava, Carole-Jean Wu, Bilge Acun, Mostafa Elhoushi, Anas Mahmoud, Liangzhen Lai, Bram Wasti, Diana Liskovich, Basil Hosmer, Ahmed Roman, Saurabh Agarwal, and 1 more

arXiv · PDF · Open in the Atlas

Code that ran

4 of 5 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 3 failures of our instrument; 1 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; 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/2404.16710.json · badge: /api/ran/2404.16710.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
facebookresearch/layerskip marked official in Papers with Code
Papers with Code archive
4 ran · 1 no recorded run
FunctionStatusWhere it lives
ForwardResult Ran
ran on a synthesized input · constructed an object; no result was computed
facebookresearch/layerskip/self_speculation/llama_model_utils.py
pointer only (licence: NOASSERTION) · get_code("523cc4a218246a99")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, facebookresearch/layerskip (NOASSERTION). 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.

_expand_mask Ran
ran; our contract draft was wrong, not the code
facebookresearch/layerskip/self_speculation/llama_model_utils.py
pointer only (licence: NOASSERTION) · get_code("fc6b3d6f55e1835e")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, facebookresearch/layerskip (NOASSERTION). 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.

_make_causal_mask Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
facebookresearch/layerskip/self_speculation/llama_model_utils.py
pointer only (licence: NOASSERTION) · get_code("72d28356d328b1e1")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, facebookresearch/layerskip (NOASSERTION). 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_decoder_attention_mask Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
facebookresearch/layerskip/self_speculation/llama_model_utils.py
pointer only (licence: NOASSERTION) · get_code("bdb174316c821be9")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, facebookresearch/layerskip (NOASSERTION). 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.

forward_early Not yet run
unverified (harvested, no recorded run)
facebookresearch/layerskip/self_speculation/llama_model_utils.py
pointer only (licence: NOASSERTION) · get_code("0b97715e46a835ff")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, facebookresearch/layerskip (NOASSERTION). 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.

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 3 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 3 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
_expand_mask
brick of this paper's assembly: helper
16 other papers
9 dated earlier, 7 later · 8 only as an assembly brick
2203.08913 (2022-03)
Memorizing Transformers
2204.05999 (2022-04)
InCoder: A Generative Model for Code Infilling and Synthesis
2307.09288 (2023-07)
Llama 2: Open Foundation and Fine-Tuned Chat Models
and 13 more not named here
_make_causal_mask
brick of this paper's assembly: helper
9 other papers
4 dated earlier, 5 later · 8 only as an assembly brick
2203.08913 (2022-03)
Memorizing Transformers
2401.07159 (2024-01)
Quantized Side Tuning: Fast and Memory-Efficient Tuning of Quantized Large Language Models
2402.01469 (2024-02)
AMOR: A Recipe for Building Adaptable Modular Knowledge Agents Through Process Feedback
and 6 more not named here
_prepare_decoder_attention_mask
brick of this paper's assembly: helper
1 other paper
1 later · 1 only as an assembly brick
2506.03700 (2025-06)
AdaDecode: Accelerating LLM Decoding with Adaptive Layer Parallelism

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

We present LayerSkip, an end-to-end solution to speed-up inference of large language models (LLMs). First, during training we apply layer dropout, with low dropout rates for earlier layers and higher dropout rates for later layers, and an early exit loss where all transformer layers share the same exit. Second, during inference, we show that this training recipe increases the accuracy of early exit at earlier layers, without adding any auxiliary layers or modules to the model. Third, we present a novel self-speculative decoding solution where we exit at early layers and verify and correct with remaining layers of the model. Our proposed self-speculative decoding approach has less memory footprint than other speculative decoding approaches and benefits from shared compute and activations of the draft and verification stages. We run experiments on different Llama model sizes on different types of training: pretraining from scratch, continual pretraining, finetuning on specific data domain, and finetuning on specific task. We implement our inference solution and show speedups of up to 2.16× on summarization for CNN/DM documents, 1.82× on coding, and 2.0× on TOPv2 semantic parsing task. We open source code at https://github.com/ facebookresearch/LayerSkip.

For agents

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

get_harvested_code_for_paper("2404.16710")
get_code_for_paper("2404.16710")
have("2404.16710")

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

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

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

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

Connect an agent — have() is free.