SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2604.14612 · 2026

ConfLayers: Adaptive Confidence-based Layer Skipping for Self-Speculative Decoding

Walaa Amer, Uday Das, Fadi Kurdahi

arXiv · PDF · Open in the Atlas

Code that ran

3 of 4 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; 2 failures of our instrument; 1 no recorded run), 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/2604.14612.json · badge: /api/ran/2604.14612.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
WA225/ConfLayers community
Papers with Code archive
3 ran · 1 no recorded run
FunctionStatusWhere it lives
KVCache Ran
ran on a synthesized input · constructed an object; no result was computed
WA225/ConfLayers/model/conflayers/utils.py
code served (permissive licence) · get_code("3806786561bbfa40")
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 an instance of its own class, KVCache: the run constructed the object and did not call it, so no result was computed. 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

torch.manual_seed(0)

# Construct data tensor for KVCache
# Shape: (batch_size, num_heads, seq_len, head_dim)
# Using distinct sizes: 2 (batch), 3 (heads), 5 (seq_len), 4 (head_dim)
data = torch.randn(2, 3, 5, 4)

# current_length should be a scalar tensor that can be modified
current_length = torch.tensor(0)

ARGS = {
    "data": data,
    "current_length": current_length,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type KVCache — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a KVCache 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
clone_past_key_values Ran
ran; our contract draft was wrong, not the code
WA225/ConfLayers/model/conflayers/utils.py
code served (permissive licence) · get_code("9e4e659ce84ab8dc")
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 list, ndim 2, 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
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal transformer model with the required structure
class MinimalAttention(nn.Module):
    def __init__(self, hidden_size=4):
        super().__init__()
        self.q_proj = nn.Linear(hidden_size, hidden_size)
        self.k_proj = nn.Linear(hidden_size, hidden_size)
        self.v_proj = nn.Linear(hidden_size, hidden_size)

class MinimalLayer(nn.Module):
    def __init__(self, hidden_size=4):
        super().__init__()
        self.self_attn = MinimalAttention(hidden_size)

class MinimalModel(nn.Module):
    def __init__(self, num_layers=2, hidden_size=4):
        super().__init__()
        self.layers = nn.ModuleList([MinimalLayer(hidden_size) for _ in range(num_layers)])

# Create model with 2 layers (4 hidden layers worth of data for KV cache)
model = MinimalModel(num_layers=2, hidden_size=4)

# Number of hidden layers
num_hidden_layers = 2

# Create past_key_values_data_list
# Each layer has 2 (key, value) pairs
# Shape: (batch_size=2, num_heads=1, seq_len=8, head_dim=4)
past_key_values_data_list = []
data_per_device = []
for j in range(2 * num_hidden_layers):  # 2 (K,V) per layer
    data_per_device.append(torch.randn(2, 1, 8, 4))
past_key_values_data_list.append(data_per_device)

# Create current_length_data
# One scalar per layer pair (K, V), so 2 * num_hidden_layers scalars
current_length_data = torch.tensor([4, 4, 4, 4], dtype=torch.long)

ARGS = {
    "model": model,
    "past_key_values_data_list": past_key_values_data_list,
    "current_length_data": current_length_data,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 2, dtype family float — a list 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
sample Ran
ran; our contract draft was wrong, not the code
WA225/ConfLayers/model/conflayers/utils.py
code served (permissive licence) · get_code("7c3f3669cfd0ab5a")
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 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)

# Create a minimal LogitsProcessorList that implements __call__
class LogitsProcessorList:
    def __call__(self, input_ids, logits):
        # The function passes None as input_ids and logits as logits
        # We just return the logits unchanged
        return logits

# Create tiny logits tensor: batch_size=2, vocab_size=4
logits = torch.randn(2, 4)

# Create logits processor
logits_processor = LogitsProcessorList()

# k must be less than or equal to vocab_size for multinomial without replacement
k = 2

ARGS = {
    "logits": logits,
    "logits_processor": logits_processor,
    "k": k,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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
swift_draft Not yet run
unverified (harvested, no recorded run)
WA225/ConfLayers/model/conflayers/utils.py
code served (permissive licence) · get_code("0c96ebb80a67317a")
How it ran

no invocation recorded.

Also present in other papers' code

Of 4 samples lifted from this paper's linked repositories, 4 carry a function identity and 0 do not. Of the 4 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 later) and 3 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
KVCache
brick of this paper's assembly: helper
3 other papers
3 dated earlier · 3 only as an assembly brick
2406.17404 (2024-06)
Make Some Noise: Unlocking Language Model Parallel Inference Capability through Noisy Training
2410.06916 (2024-10)
SWIFT: On-the-Fly Self-Speculative Decoding for LLM Inference Acceleration
2508.16201 (2025-08)
SPECVLM: Enhancing Speculative Decoding of Video LLMs via Verifier-Guided Token Pruning

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

Self-speculative decoding is an inference technique for large language models designed to speed up generation without sacrificing output quality. It combines fast, approximate decoding using a compact version of the model as a draft model with selective re-evaluation by the full target model. Some existing methods form the draft model by dynamically learning which layers to skip during inference, effectively creating a smaller subnetwork to speed up computation. However, using heuristic-based approaches to select layers to skip can often be simpler and more effective. In this paper, we propose Con-fLayers, a dynamic plug-and-play approach to forming the draft model in self-speculative decoding via confidence-based intermediate layer skipping. The process iteratively computes confidence scores for all layers, selects layers to skip based on an adaptive threshold, evaluates the performance of the resulting set, and updates the best selection until no further improvement is achieved or a maximum number of iterations is reached. This framework avoids the overhead and complexity of training a layer skipping policy and can provide more consistent speed-quality trade-offs while preserving the adaptivity of the draft model to diverse tasks and datasets. The performance evaluation of ConfLayers across different models and datasets shows that our novel approach offers up to 1.4× speedup over vanilla LLM generation. The code is available on https: //github.com/WA225/ConfLayers.

For agents

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

get_harvested_code_for_paper("2604.14612")
get_code_for_paper("2604.14612")
have("2604.14612")

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

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

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

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

Connect an agent — have() is free.