arXiv:2610.18726cs.CLOct 2026

Manuscript Offprint

arXiv:2610.18726

Code-Switching Detection via Language-Selective Dimensions in Speech Foundation Models

Jie Chi, Zakaria Aldeneh, Masha Fedzechkina, Maureen de Seyssel, Natalie Schluter

ABSTRACT

Code-switching (CS), the alternation between languages within an utterance, is common in multilingual speech but underrepresented in pretraining corpora. Increasing CS coverage requires finding relevant utterances in large speech collections so that they can be included in training data. One way to find such utterances is to transcribe the speech and detect language alternation in the text, but this depends on obtaining accurate multilingual transcriptions. We propose a lightweight method that detects CS directly from speech. It uses frame-level language information in pretrained speech encoders to determine whether both languages are present within an utterance. Specifically, we identify language-selective hidden-state dimensions using monolingual recordings and aggregate their frame-level activations into a CS prediction. With a small CS set used to tune a decision rule, we show that the Whisper-small encoder achieves a mean F1 of 0.798 across 14 language pairs in CS-FLEURS, compared with 0.776 for a CNN and 0.751 for a HuBERT linear baseline trained for monolingual language identification. Our findings suggest that pretrained speech encoders already encode the information needed to identify CS utterances, and they provide a lightweight tool for building more representative multilingual corpora.

Index Terms— Code-switching Detection, Multilingual Speech Models, Language-selective Dimensions

1. INTRODUCTION

Multilingual speech corpora cover many languages but often contain few code-switched (CS) utterances. As a result, models trained on these corpora have limited exposure to mixed-language speech. Recent work shows that training or adapting ASR systems with CS data improves recognition of such speech [1, 2, 3]. A recent study introducing CS-YODAS, a dataset of naturally occurring CS speech mined from the large multilingual YODAS speech corpus, also reports gains in spoken language identification when this speech is added to training [4].

Existing corpora such as SEAME [5], the Miami corpora [6], and the South African soap-opera corpus [7] provide natural CS speech, but the amount available for training is limited by their size, language-pair coverage, and the proportion of recordings that contain a switch. For example, only 8% of utterances in the Miami corpus are code-switched. Even in SEAME, where some interview questions were designed to elicit code-switching, the reported proportion is 52% [8]. Therefore, larger multilingual CS benchmarks have relied mainly on read or synthetic speech [9, 10, 11]. Mining CS utterances from larger speech collections could provide more natural examples across languages and domains.

Mining CS utterances from a large speech collection requires identifying which recordings contain CS. CS-YODAS [4] shows that natural CS speech can be mined from web audio using a pipeline that uses ASR transcripts, a 14B-parameter language model, and bilingual human feedback. Having access to a model that can detect CS directly from speech can be beneficial as a pre-filter before running more expensive parts of the pipeline. We therefore investigate whether CS can be detected directly from speech with a lightweight binary detector.

Prior work has shown that frame-level hidden representations of pretrained speech models encode information about spoken language [12]. In this work, we ask whether this frame-level information can be used to detect whether code-switching has occurred within a given utterance. Our approach proceeds in two steps: we first identify hidden-state dimensions in a pretrained speech encoder whose activations differ between the target languages, using a small set of monolingual recordings; then, at test time, we monitor these same dimensions to predict whether a switch in language occurs within a given utterance. We study the utility of this approach and show that it yields an effective CS detector.

References (23)