SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2604.11096 · 2026

Efficient Training for Cross-lingual Speech Language Models

Yang Feng, Qingkai Fang, Yan Zhou, Yun Hong

arXiv · PDF · Open in the Atlas

Code that ran

5 of 6 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; 4 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 0 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.11096.json · badge: /api/ran/2604.11096.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
deepspeedai/DeepSpeed community
Papers with Code archive
5 ran · 1 no recorded run
FunctionStatusWhere it lives
AutoTPMeta Ran
ran on a synthesized input · constructed an object; no result was computed
deepspeedai/DeepSpeed/deepspeed/sequence/layer.py
code served (permissive licence) · get_code("4346fff083939110")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned AutoTPMeta: the class was constructed and called, and the call returned an instance of its own class. 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.

from dataclasses import dataclass
from typing import Optional

_ATTN_HEAD_ATTRS = ('num_attention_heads', 'num_heads', 'n_heads', 'n_head', 'attention_heads')

_KV_HEAD_ATTRS = ('num_key_value_heads', 'num_kv_heads', 'multi_query_group_num', 'n_head_kv', 'kv_n_heads', 'num_attention_heads', 'n_heads', 'attention_heads')

def _attention_head_count_from(config) -> Optional[int]:
    """First non-None attention head count found on ``config`` via :data:`_ATTN_HEAD_ATTRS`, else ``None``."""
    for name in _ATTN_HEAD_ATTRS:
        value = getattr(config, name, None)
        if value is not None:
            return value
    return None

def _kv_head_count_from(config) -> Optional[int]:
    """First non-None kv-head count found on ``config`` via :data:`_KV_HEAD_ATTRS`, else ``None``."""
    for name in _KV_HEAD_ATTRS:
        value = getattr(config, name, None)
        if value is not None:
            return value
    return None

@dataclass(frozen=True)
class AutoTPMeta:
    """Per-model tensor-parallel metadata AutoTP derives from the model config.

    Each model carries its own kv-head / grain values so its layers, fused-QKV repacking and
    checkpoint conversion shard consistently, and more than one AutoTP model can live in the
    same process.
    """
    num_kv_heads: Optional[int] = None
    num_attention_heads: Optional[int] = None
    n_embd: Optional[int] = None
    tp_grain_size: int = 1

    @classmethod
    def from_model_config(cls, model_config, tp_grain_size: int=1) -> 'AutoTPMeta':
        """The single source of truth for reading kv-head / hidden / attention-head counts.

        ``model_config`` may be ``None`` for callers that build a synthetic AutoTP with no real
        model (some unit tests); they get an empty meta and the resulting even-grain split.
        """
        if model_config is None:
            return cls(tp_grain_size=tp_grain_size)
        text_config = getattr(model_config, 'text_config', None)
        if text_config is not None:
            model_config = text_config
        num_kv_heads = _kv_head_count_from(model_config)
        n_embd = None
        for name in ('n_embd', 'hidden_size'):
            if hasattr(model_config, name):
                n_embd = getattr(model_config, name)
            if n_embd is not None:
                break
        num_attention_heads = _attention_head_count_from(model_config)
        return cls(num_kv_heads=num_kv_heads, num_attention_heads=num_attention_heads, n_embd=n_embd, tp_grain_size=tp_grain_size)


class MockConfig:
    def __init__(self, num_attention_heads=8, num_kv_heads=2, hidden_size=256):
        self.num_attention_heads = num_attention_heads
        self.num_kv_heads = num_kv_heads
        self.hidden_size = hidden_size


INIT_ARGS = {
    'num_kv_heads': None,
    'num_attention_heads': None,
    'n_embd': None,
    'tp_grain_size': 1,
}

ARGS = {
    'model_config': MockConfig(num_attention_heads=8, num_kv_heads=2, hidden_size=256),
    'tp_grain_size': 2,
}

METHOD = 'from_model_config'

if __name__ == '__main__':
    instance = AutoTPMeta(**INIT_ARGS)
    print(f"Instance created: {instance}")
    
    result = instance.from_model_config(**ARGS)
    print(f"Method result: {result}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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 AutoTPMeta — the call returned an instance of its own class, which has no array shape; none is stated — the instrument coerces any output to an array; for a AutoTPMeta 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
_attention_head_count_from Ran
ran, honoured the contract we drafted
deepspeedai/DeepSpeed/deepspeed/sequence/layer.py
code served (permissive licence) · get_code("6838070708760fe4")
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 torch
import torch.nn as nn

# Create a minimal config class with attention head count attribute
class MinimalConfig:
    def __init__(self, num_attention_heads=8):
        self.num_attention_heads = num_attention_heads

# Test case 1: config with num_attention_heads attribute
config_with_heads = MinimalConfig(num_attention_heads=12)

ARGS = {
    'config': config_with_heads
}
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 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
_kv_head_count_from Ran
ran, honoured the contract we drafted
deepspeedai/DeepSpeed/deepspeed/sequence/layer.py
code served (permissive licence) · get_code("1fd65563e4f7ec38")
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 torch
import numpy as np

class MockConfig:
    """Stand-in config object for testing _kv_head_count_from"""
    def __init__(self, num_key_value_heads=None, num_kv_heads=None, 
                 multi_query_group_num=None, n_head_kv=None, kv_n_heads=None,
                 num_attention_heads=None, n_heads=None, attention_heads=None):
        self.num_key_value_heads = num_key_value_heads
        self.num_kv_heads = num_kv_heads
        self.multi_query_group_num = multi_query_group_num
        self.n_head_kv = n_head_kv
        self.kv_n_heads = kv_n_heads
        self.num_attention_heads = num_attention_heads
        self.n_heads = n_heads
        self.attention_heads = attention_heads

# Test case 1: config with num_key_value_heads set
config_with_kv_heads = MockConfig(num_key_value_heads=8)

ARGS = {
    "config": config_with_kv_heads
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — 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
get_shard_size Ran
ran, honoured the contract we drafted
deepspeedai/DeepSpeed/deepspeed/sequence/layer.py
code served (permissive licence) · get_code("52ac3e38db39cd2f")
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 torch
import numpy as np
from dataclasses import dataclass
from typing import Optional

# Define AutoTPMeta since it's used in the function
@dataclass(frozen=True)
class AutoTPMeta:
    """Per-model tensor-parallel metadata AutoTP derives from the model config."""
    num_kv_heads: Optional[int] = None
    num_attention_heads: Optional[int] = None
    n_embd: Optional[int] = None
    tp_grain_size: int = 1

# Create a mock dist module with necessary functions
class MockDist:
    def __init__(self):
        self._rank = 0
        self._world_size = 2
    
    def get_rank(self, group=None):
        return self._rank
    
    def get_world_size(self, group=None):
        return self._world_size

# Set up the global dist
import types as _types
dist = MockDist()

# Now define ARGS with all required parameters for get_shard_size
ARGS = {
    'total_size': 256,
    'mp_size': 2,
    'meta': AutoTPMeta(num_kv_heads=8, num_attention_heads=32, n_embd=512, tp_grain_size=64),
    'name': 'attention_layer',
    'rank': 0,
    'mp_group': None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — 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
get_shard_size_list Ran
ran, honoured the contract we drafted
deepspeedai/DeepSpeed/deepspeed/sequence/layer.py
code served (permissive licence) · get_code("349bb5104a5aa798")
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 1, dtype family int; 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
from dataclasses import dataclass
from typing import Optional

torch.manual_seed(0)

@dataclass(frozen=True)
class AutoTPMeta:
    num_kv_heads: Optional[int] = None
    num_attention_heads: Optional[int] = None
    n_embd: Optional[int] = None
    tp_grain_size: int = 1

    @classmethod
    def from_model_config(cls, model_config, tp_grain_size: int=1) -> 'AutoTPMeta':
        if model_config is None:
            return cls(tp_grain_size=tp_grain_size)
        text_config = getattr(model_config, 'text_config', None)
        if text_config is not None:
            model_config = text_config
        num_kv_heads = _kv_head_count_from(model_config)
        n_embd = None
        for name in ('n_embd', 'hidden_size'):
            if hasattr(model_config, name):
                n_embd = getattr(model_config, name)
            if n_embd is not None:
                break
        num_attention_heads = _attention_head_count_from(model_config)
        return cls(num_kv_heads=num_kv_heads, num_attention_heads=num_attention_heads, n_embd=n_embd, tp_grain_size=tp_grain_size)

_ATTN_HEAD_ATTRS = ('num_attention_heads', 'num_heads', 'n_heads', 'n_head', 'attention_heads')
_KV_HEAD_ATTRS = ('num_key_value_heads', 'num_kv_heads', 'multi_query_group_num', 'n_head_kv', 'kv_n_heads', 'num_attention_heads', 'n_heads', 'attention_heads')

def _attention_head_count_from(config) -> Optional[int]:
    for name in _ATTN_HEAD_ATTRS:
        value = getattr(config, name, None)
        if value is not None:
            return value
    return None

def _kv_head_count_from(config) -> Optional[int]:
    for name in _KV_HEAD_ATTRS:
        value = getattr(config, name, None)
        if value is not None:
            return value
    return None

def get_shard_size(total_size, mp_size, meta: AutoTPMeta, name=None, rank=None, mp_group=None):
    num_kv_heads = meta.num_kv_heads
    tp_grain_size = meta.tp_grain_size
    last_linear = ['lm_head', 'embed_out']
    moe_mlp_layer = ['gate_proj', 'up_proj', 'down_proj', 'w1', 'w2', 'w3']
    not_moe_mlp_layer = True
    if name != None and any((s in str(name) for s in moe_mlp_layer)):
        not_moe_mlp_layer = False
    
    if rank is None:
        rank = 0
    
    if num_kv_heads is not None and total_size % num_kv_heads == 0 and ('mlp' not in str(name)) and (str(name) not in last_linear) and not_moe_mlp_layer:
        my_slices = num_kv_heads // mp_size + (1 if rank < num_kv_heads % mp_size else 0)
        return total_size * my_slices // num_kv_heads
    elif total_size >= tp_grain_size:
        grain_size, remainder = divmod(total_size, tp_grain_size)
        shard_size = (grain_size // mp_size + (1 if rank < grain_size % mp_size else 0)) * tp_grain_size
        if rank == mp_size - 1:
            shard_size += remainder
        return shard_size
    else:
        return total_size // mp_size + (1 if rank < total_size % mp_size else 0)

def get_shard_size_list(total_size, mp_size, meta: AutoTPMeta, name=None):
    shard_sizes = []
    for i in range(mp_size):
        shard_sizes.append(get_shard_size(total_size, mp_size, meta, name, i))
    assert sum(shard_sizes) == total_size, f"AutoTP shard sizes {shard_sizes} for layer '{name}' do not sum to the dimension size {total_size} with tp_size={mp_size}, tp_grain_size={meta.tp_grain_size}"
    return shard_sizes

meta = AutoTPMeta(num_kv_heads=8, num_attention_heads=32, n_embd=256, tp_grain_size=64)

ARGS = {
    'total_size': 512,
    'mp_size': 4,
    'meta': meta,
    'name': 'attention_layer'
}
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 1, dtype family int — 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
uneven_heads_all2all Not yet run
unverified (harvested, no recorded run)
deepspeedai/DeepSpeed/deepspeed/sequence/layer.py
code served (permissive licence) · get_code("556e5b0b420e135d")
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, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 6 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.

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

Currently, large language models (LLMs) predominantly focus on the text modality. To enable more natural human-AI interaction, speech LLMs are emerging, but building effective endto-end speech LLMs remains challenging due to limited data and the difficulty in expanding to more languages. In this paper, we introduce Cross-lingual Speech Language Model (CSLM), an efficient training method for crosslingual speech LLMs based on discrete speech tokens. We propose a novel alignment strategy that achieves cross-modal and cross-lingual alignment through continual pre-training. By conducting instruction fine-tuning following a speech-text interleaved chain-of-modality generation process, we enhance modal alignment at a finer granularity, thereby improving generation quality and reducing latency. CSLM aligns different modalities and languages simultaneously without the need for massive speech data, thus exhibiting good language scalability. Evaluations on cross-modal tasks, mono-lingual conversational tasks, and cross-lingual conversational tasks demonstrate CSLM's strong cross-modal alignment capabilities and general task abilities. 1

For agents

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

get_harvested_code_for_paper("2604.11096")
get_code_for_paper("2604.11096")
have("2604.11096")

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

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

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

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

Connect an agent — have() is free.