SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2406.16758 · EMNLP · 2024

Towards Fast Multilingual LLM Inference: Speculative Decoding and Specialized Drafters

Se-Young Yun, Taehyeon Kim, Du-Seong Chang, Euiin Yi, Hongseok Jeung

arXiv · PDF · Open in the Atlas

Code that ran

4 of 6 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, 0 violated it and 0 have no contract verdict; 4 failures of our instrument; 2 no recorded run), measured 2026-11-22; 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/2406.16758.json · badge: /api/ran/2406.16758.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
Kthyeon/Multilingual-SpecBench canonical (classifier label)
classifier basis: census
4 ran · 2 no recorded run
FunctionStatusWhere it lives
baseline_forward Ran
ran; our contract draft was wrong, not the code
Kthyeon/Multilingual-SpecBench/evaluation/inference_baseline.py
code served (permissive licence) · get_code("87ed72425ac0f9d8")
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)

# Build a minimal model that supports generate() method
class MinimalLanguageModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.embedding = nn.Embedding(100, 4)
        self.linear = nn.Linear(4, 100)
    
    def forward(self, input_ids):
        x = self.embedding(input_ids)
        return self.linear(x)
    
    def generate(self, input_ids, do_sample=False, temperature=1.0, max_new_tokens=10):
        # Minimal generate implementation that returns output_ids
        # Returns concatenation of input_ids with new generated tokens
        batch_size = input_ids.shape[0]
        seq_len = input_ids.shape[1]
        
        # Simulate generating max_new_tokens new tokens
        new_tokens = torch.randint(0, 100, (batch_size, max_new_tokens))
        output_ids = torch.cat([input_ids, new_tokens], dim=1)
        
        return output_ids

# Build a minimal tokenizer
class MinimalTokenizer:
    def __call__(self, text):
        # Return a mock object with input_ids attribute
        return MockTokenizerOutput()

class MockTokenizerOutput:
    def __init__(self):
        self.input_ids = torch.tensor([[10, 20, 30], [40, 50, 60]])

# Create instances
model = MinimalLanguageModel()
tokenizer = MinimalTokenizer()

# Create inputs object with input_ids attribute
inputs = MockTokenizerOutput()

ARGS = {
    "inputs": inputs,
    "model": model,
    "tokenizer": tokenizer,
    "max_new_tokens": 5,
    "temperature": 0.7,
    "do_sample": True,
}
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
loading_config Ran
ran; our contract draft was wrong, not the code
Kthyeon/Multilingual-SpecBench/data_processing/processing_utils.py
code served (permissive licence) · get_code("3cd324610fed3cbe")
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. 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 tempfile
import os

# Create a temporary directory and JSON config file
temp_dir = tempfile.mkdtemp()
dataset_configs_path = os.path.join(temp_dir, "dataset_configs.json")

# Create a sample dataset config
dataset_configs = {
    "mnist": {
        "num_classes": 10,
        "input_size": 28,
        "batch_size": 32
    },
    "cifar10": {
        "num_classes": 10,
        "input_size": 32,
        "batch_size": 64
    },
    "custom_dataset": {
        "num_classes": 5,
        "input_size": 16,
        "batch_size": 16
    }
}

# Write config to file
with open(dataset_configs_path, 'w') as f:
    json.dump(dataset_configs, f)

ARGS = {
    "data_name": "mnist",
    "dataset_configs_path": dataset_configs_path
}
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 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
lookahead_forward Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Kthyeon/Multilingual-SpecBench/evaluation/inference_lookahead.py
code served (permissive licence) · get_code("57aba3c21a2ebe44")
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. 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 torch.nn as nn

torch.manual_seed(0)

# Create a minimal tokenizer stand-in
class MockTokenizer:
    pass

# Create a minimal model that implements the generate method
class MockModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def generate(self, input_ids, do_sample=False, temperature=0.0, max_new_tokens=10):
        # Return (output_ids, idx, accept_length_list)
        # output_ids should be a tensor with shape matching input but extended
        batch_size = input_ids.shape[0]
        seq_len = input_ids.shape[1]
        
        # Generate output_ids by extending input_ids
        output_ids = torch.cat([
            input_ids,
            torch.randint(0, 100, (batch_size, max_new_tokens))
        ], dim=1)
        
        idx = torch.tensor(5)
        accept_length_list = [1, 2]
        
        return output_ids, idx, accept_length_list

# Create a minimal inputs object with input_ids attribute
class MockInputs:
    def __init__(self, input_ids):
        self.input_ids = input_ids

# Set up arguments
inputs = MockInputs(input_ids=[[10, 20, 30, 40], [50, 60, 70, 80]])
model = MockModel()
tokenizer = MockTokenizer()
max_new_tokens = 5

ARGS = {
    "inputs": inputs,
    "model": model,
    "tokenizer": tokenizer,
    "max_new_tokens": max_new_tokens
}
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
pld_forward Ran
ran; our contract draft was wrong, not the code
Kthyeon/Multilingual-SpecBench/evaluation/inference_pld.py
code served (permissive licence) · get_code("ccf07672a5bb126f")
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
from transformers import StoppingCriteriaList, MaxLengthCriteria

torch.manual_seed(0)

# Create a minimal tokenizer stand-in
class MinimalTokenizer:
    def __init__(self):
        self.pad_token_id = 0
        self.eos_token_id = 2

# Create a minimal model that implements greedy_search_pld
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def greedy_search_pld(self, input_ids, attention_mask=None, stopping_criteria=None, 
                          draft_matching_window_size=None, draft_num_candidate_tokens=None, 
                          use_cache=None, pad_token_id=None, eos_token_id=None, 
                          return_dict_in_generate=None):
        # Return dummy outputs: (output_ids, idx, accept_length_list)
        # output_ids should be a tensor with shape [batch_size, sequence_length]
        batch_size = input_ids.shape[0]
        input_len = input_ids.shape[1]
        max_new_tokens = 5
        
        # Create output with some new tokens, including an EOS token for one sequence
        output_ids = torch.cat([
            input_ids,
            torch.randint(3, 100, (batch_size, max_new_tokens))
        ], dim=1)
        
        # Add EOS token to first sequence to test the EOS handling logic
        output_ids[0, input_len + 2] = eos_token_id
        
        idx = torch.tensor(1)
        accept_length_list = [1, 2, 1, 3, 2]
        
        return output_ids, idx, accept_length_list

# Create a minimal inputs object
class MinimalInputs:
    def __init__(self, input_ids, attention_mask):
        self.input_ids = input_ids
        self.attention_mask = attention_mask

# Construct arguments
batch_size = 2
seq_len = 6
max_new_tokens = 5

input_ids = torch.randint(3, 100, (batch_size, seq_len))
attention_mask = torch.ones((batch_size, seq_len))

inputs = MinimalInputs(input_ids, attention_mask)
model = MinimalModel()
tokenizer = MinimalTokenizer()

ARGS = {
    "inputs": inputs,
    "model": model,
    "tokenizer": tokenizer,
    "max_new_tokens": max_new_tokens
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — 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
load_and_transform_json Not yet run
unverified (harvested, no recorded run)
Kthyeon/Multilingual-SpecBench/data_generation/convert_to_train.py
code served (permissive licence) · get_code("e8d521071d16dadf")
How it ran

no invocation recorded.

loading_dataset Not yet run
unverified (harvested, no recorded run)
Kthyeon/Multilingual-SpecBench/data_processing/processing_utils.py
code served (permissive licence) · get_code("7d1be98a44359d93")
How it ran

no invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 2 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 2 later) and 4 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
lookahead_forward 1 other paper
1 later
2408.08696 (2024-08)
Turning Trash into Treasure: Accelerating Inference of Large Language Models with Token Recycling
pld_forward 1 other paper
1 later
2408.08696 (2024-08)
Turning Trash into Treasure: Accelerating Inference of Large Language Models with Token Recycling

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

Repositories linked to this paper

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

Abstract

Large language models (LLMs) have revolutionized natural language processing and broadened their applicability across diverse commercial applications. However, the deployment of these models is constrained by high inference time in multilingual settings. To mitigate this challenge, this paper explores a training recipe of an assistant model in speculative decoding, which is leveraged to draft and-then its future tokens are verified by the target LLM. We show that language-specific draft models, optimized through a targeted pretrain-and-finetune strategy, substantially brings a speedup in inference time compared to the previous methods. We validate these models across various languages in inference time, out-of-domain speedup, and GPT-4o evaluation.

For agents

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

get_harvested_code_for_paper("2406.16758")
get_code_for_paper("2406.16758")
have("2406.16758")

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

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

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

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

Connect an agent — have() is free.