SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2025.emnlp-main.240 · EMNLP · 2025

QSPEC: Speculative Decoding with Complementary Quantization Schemes

Lingpeng Kong, Chuan Wu, Sheng Wang, Wenhao Lu, Juntao Zhao

Open in the Atlas

Code that ran

7 of 9 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; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 6 failures of our instrument; 2 no recorded run), measured 2026-11-24; 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/2025.emnlp-main.240.json · badge: /api/ran/2025.emnlp-main.240.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
hku-netexplo-lab/QSpec canonical (classifier label)
classifier basis: census
7 ran · 2 no recorded run
FunctionStatusWhere it lives
async_request_deepspeed_mii Ran
ran; our contract draft was wrong, not the code
hku-netexplo-lab/QSpec/benchmarks/backend_request_func.py
code served (permissive licence) · get_code("9576cce4a3af2a74")
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 coroutine. 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 aiohttp
from dataclasses import dataclass, field
from typing import List, Optional
from tqdm.asyncio import tqdm

@dataclass
class RequestFuncInput:
    prompt: str
    api_url: str
    prompt_len: int
    output_len: int
    model: str
    model_name: Optional[str] = None
    best_of: int = 1
    logprobs: Optional[int] = None
    extra_body: Optional[dict] = None
    multi_modal_content: Optional[dict] = None
    ignore_eos: bool = False

@dataclass
class RequestFuncOutput:
    generated_text: str = ''
    success: bool = False
    latency: float = 0.0
    ttft: float = 0.0
    itl: List[float] = field(default_factory=list)
    tpot: float = 0.0
    prompt_len: int = 0
    error: str = ''

request_input = RequestFuncInput(
    prompt="This is a test prompt for the API.",
    api_url="http://localhost:8000/generate",
    prompt_len=8,
    output_len=64,
    model="test-model",
    model_name="test-model-v1",
    best_of=1,
    logprobs=None,
    extra_body=None,
    multi_modal_content=None,
    ignore_eos=False
)

pbar = None

ARGS = {
    'request_func_input': request_input,
    'pbar': pbar
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
aiohttp, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type coroutine — a coroutine output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a coroutine 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
async_request_tgi Ran
ran; our contract draft was wrong, not the code
hku-netexplo-lab/QSpec/benchmarks/backend_request_func.py
code served (permissive licence) · get_code("2d5a7161f18dfdfe")
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 coroutine. 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 aiohttp
from dataclasses import dataclass, field
from typing import List, Optional
from tqdm.asyncio import tqdm

@dataclass
class RequestFuncInput:
    prompt: str
    api_url: str
    prompt_len: int
    output_len: int
    model: str
    model_name: Optional[str] = None
    best_of: int = 1
    logprobs: Optional[int] = None
    extra_body: Optional[dict] = None
    multi_modal_content: Optional[dict] = None
    ignore_eos: bool = False

@dataclass
class RequestFuncOutput:
    generated_text: str = ''
    success: bool = False
    latency: float = 0.0
    ttft: float = 0.0
    itl: List[float] = field(default_factory=list)
    tpot: float = 0.0
    prompt_len: int = 0
    error: str = ''

request_func_input = RequestFuncInput(
    prompt="This is a test prompt for the TGI API.",
    api_url="http://localhost:8080/generate_stream",
    prompt_len=10,
    output_len=50,
    model="gpt2",
    model_name="gpt2-small",
    best_of=1,
    logprobs=None,
    extra_body=None,
    multi_modal_content=None,
    ignore_eos=False
)

pbar = None

ARGS = {
    "request_func_input": request_func_input,
    "pbar": pbar
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
aiohttp, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type coroutine — a coroutine output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a coroutine 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
async_request_trt_llm Ran
ran; our contract draft was wrong, not the code
hku-netexplo-lab/QSpec/benchmarks/backend_request_func.py
code served (permissive licence) · get_code("7e1c24433ee7d75d")
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 coroutine. 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 json
import sys
import time
import traceback
from dataclasses import dataclass, field
from typing import List, Optional, Union
from unittest.mock import AsyncMock, MagicMock, patch
import aiohttp
from tqdm.asyncio import tqdm

@dataclass
class RequestFuncInput:
    prompt: str
    api_url: str
    prompt_len: int
    output_len: int
    model: str
    model_name: Optional[str] = None
    best_of: int = 1
    logprobs: Optional[int] = None
    extra_body: Optional[dict] = None
    multi_modal_content: Optional[dict] = None
    ignore_eos: bool = False

@dataclass
class RequestFuncOutput:
    generated_text: str = ''
    success: bool = False
    latency: float = 0.0
    ttft: float = 0.0
    itl: List[float] = field(default_factory=list)
    tpot: float = 0.0
    prompt_len: int = 0
    error: str = ''

# Create a minimal RequestFuncInput instance
request_func_input = RequestFuncInput(
    prompt="What is the capital of France?",
    api_url="http://localhost:8000/generate_stream",
    prompt_len=8,
    output_len=32,
    model="gpt-3.5",
    model_name="gpt-3.5-turbo",
    best_of=1,
    logprobs=None,
    extra_body=None,
    multi_modal_content=None,
    ignore_eos=False
)

# Create a mock progress bar
pbar = None

ARGS = {
    "request_func_input": request_func_input,
    "pbar": pbar
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
aiohttp, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type coroutine — a coroutine output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a coroutine 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
check_wheel_size Ran
ran, honoured the contract we drafted
hku-netexplo-lab/QSpec/.buildkite/check-wheel-size.py
code served (permissive licence) · get_code("95e3362a392b24d6")
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 int, ndim 0, dtype family int, shape () 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 os
import zipfile
import tempfile

# Create a temporary directory for testing
temp_dir = tempfile.mkdtemp()

# Create a test wheel file (it's just a zip file)
test_wheel_path = os.path.join(temp_dir, "test_package.whl")

# Create a small zip file with some test files
with zipfile.ZipFile(test_wheel_path, 'w') as z:
    z.writestr("file1.txt", "a" * (1024 * 100))  # 100 KB
    z.writestr("file2.txt", "b" * (1024 * 50))   # 50 KB
    z.writestr("file3.txt", "c" * (1024 * 25))   # 25 KB

ARGS = {
    "directory": temp_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () 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
run Ran
ran; our contract draft was wrong, not the code
hku-netexplo-lab/QSpec/collect_env.py
code served (permissive licence) · get_code("6b73fe0480a96ad9")
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, ndim 1, 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 locale
import subprocess
import sys

# The function 'run' takes a single parameter 'command'
# which can be either a string (shell=True) or a list (shell=False)
# It executes the command and returns (return_code, stdout, stderr)

# Valid arguments for the run function:
ARGS = {
    'command': ['echo', 'hello world']  # List form - will execute with shell=False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, 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
run_and_parse_first_match Ran
ran; our contract draft was wrong, not the code
hku-netexplo-lab/QSpec/collect_env.py
code served (permissive licence) · get_code("ce7a62e37fe78c0d")
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 str. 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 re

def mock_run_lambda(command):
    """Mock run_lambda that simulates running a shell command."""
    # Simulate successful execution with output containing a match
    if command == "test_command":
        return (0, "The version is 1.2.3 and other info", None)
    else:
        return (1, "", None)

def test_run_lambda_failure(command):
    """Mock run_lambda that returns non-zero exit code."""
    return (1, "error output", None)

def test_run_lambda_no_match(command):
    """Mock run_lambda that returns output with no regex match."""
    return (0, "output without version pattern", None)

# Define ARGS dict with all parameters
ARGS = {
    "run_lambda": mock_run_lambda,
    "command": "test_command",
    "regex": r"version is ([0-9.]+)"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
run_and_read_all Ran
ran; our contract draft was wrong, not the code
hku-netexplo-lab/QSpec/collect_env.py
code served (permissive licence) · get_code("5ae630bfc3821b6e")
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 str. 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

def create_run_lambda():
    """Create a mock run_lambda function that returns (rc, stdout, stderr)"""
    def mock_run_lambda(command):
        # Simulate successful command execution
        if "error" in command:
            return 1, "", "error occurred"
        else:
            return 0, "command output", ""
    return mock_run_lambda

ARGS = {
    "run_lambda": create_run_lambda(),
    "command": "echo 'test command'"
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
find_cuda_init Not yet run
unverified (harvested, no recorded run)
hku-netexplo-lab/QSpec/find_cuda_init.py
code served (permissive licence) · get_code("6a9382e5d439d948")
How it ran

no invocation recorded.

sample_requests Not yet run
unverified (harvested, no recorded run)
hku-netexplo-lab/QSpec/benchmarks/benchmark_guided.py
code served (permissive licence) · get_code("277d25f29be90815")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 8 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 8 later) and 1 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
run_and_parse_first_match 14 other papers
10 dated earlier, 3 later, 1 same year, order not determinable
2109.04003 (2021-09)
Improving Deep Metric Learning by Divide and Conquer
2109.08267 (2021-09)
CompilerGym: Robust, Performant Compiler Optimization Environments for AI Research
2202.04053 (2022-02)
DALL-Eval: Probing the Reasoning Skills and Social Biases of Text-to-Image Generation Models
and 11 more not named here
run_and_read_all 14 other papers
10 dated earlier, 3 later, 1 same year, order not determinable
2109.04003 (2021-09)
Improving Deep Metric Learning by Divide and Conquer
2109.08267 (2021-09)
CompilerGym: Robust, Performant Compiler Optimization Environments for AI Research
2202.04053 (2022-02)
DALL-Eval: Probing the Reasoning Skills and Social Biases of Text-to-Image Generation Models
and 11 more not named here
run 6 other papers
4 dated earlier, 1 later, 1 same year, order not determinable
2405.16444 (2024-05)
CacheBlend: Fast Large Language Model Serving for RAG with Cached Knowledge Fusion
2406.19215 (2024-06)
SeaKR: Self-aware Knowledge Retrieval for Adaptive Retrieval Augmented Generation
2410.00428 (2024-10)
LayerKV: Optimizing Large Language Model Serving with Layer-wise KV Cache Management
and 3 more not named here
check_wheel_size 4 other papers
3 later, 1 same year, order not determinable
2512.09472 (2025-12)
WarmServe: Enabling One-for-Many GPU Prewarming for Multi-LLM Serving
2601.20309 (2026-01)
SuperInfer: SLO-Aware Rotary Scheduling and Memory Management for LLM Inference on Superchips
2602.07223 (2026-02)
Vegas: Self-Speculative Decoding with Verification-Guided Sparse Attention
and 1 more not named here
async_request_deepspeed_mii 2 other papers
1 later, 1 same year, order not determinable
2512.09472 (2025-12)
WarmServe: Enabling One-for-Many GPU Prewarming for Multi-LLM Serving
2601.20309 (2026-01)
SuperInfer: SLO-Aware Rotary Scheduling and Memory Management for LLM Inference on Superchips
find_cuda_init 2 other papers
1 later, 1 same year, order not determinable
2512.09472 (2025-12)
WarmServe: Enabling One-for-Many GPU Prewarming for Multi-LLM Serving
2601.20309 (2026-01)
SuperInfer: SLO-Aware Rotary Scheduling and Memory Management for LLM Inference on Superchips
async_request_tgi 1 other paper
1 later
2601.20309 (2026-01)
SuperInfer: SLO-Aware Rotary Scheduling and Memory Management for LLM Inference on Superchips
async_request_trt_llm 1 other paper
1 later
2601.20309 (2026-01)
SuperInfer: SLO-Aware Rotary Scheduling and Memory Management for LLM Inference on Superchips

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-24.

Repositories linked to this paper

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

Abstract

Quantization is widely adopted to accelerate inference and reduce memory consumption in large language models (LLMs). While activation-weight joint quantization enables efficient low-precision decoding, it suffers from substantial performance degradation on multistep reasoning tasks. We propose QSPEC, a novel quantization paradigm that decouples efficiency from quality by integrating two complementary schemes via speculative decoding: low-precision joint quantization for fast drafting and high-precision weight-only quantization for accurate verification. QSPEC reuses both weights and KV cache across stages, enabling near-zero-cost switching without retraining or auxiliary models. Compared to highprecision baselines, QSPEC achieves up to 1.64× speedup without quality degradation, and outperforms state-of-the-art speculative decoding methods by up to 1.55× in batched settings. Furthermore, QSPEC supports plug-andplay deployment and generalizes well across model scales, quantization methods, and workloads. These properties make QSPEC a practical and scalable solution for high-fidelity quantized LLM serving under memory-constrained scenarios. Our code is available at https: //github.com/hku-netexplo-lab/QSpec.

For agents

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

get_harvested_code_for_paper("2025.emnlp-main.240")
get_code_for_paper("2025.emnlp-main.240")
have("2025.emnlp-main.240")

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

curl https://syntology.ai/api/ran/2025.emnlp-main.240.json

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

[![Syntology run record](https://syntology.ai/api/ran/2025.emnlp-main.240.svg)](https://syntology.ai/paper/2025.emnlp-main.240)

Connect an agent — have() is free.